@lwrjs/client-modules 0.23.3 → 0.23.4

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.28.1 */
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,23 +1651,17 @@ 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'];
1656
+ // No longer the primary mitigation path as of 264; kept for compatibility. Excluded from coverage.
1657
+ // istanbul ignore next: behavior will not be tested in collection coverage
1742
1658
  function markForUnsafePropertyBlocking$LWS(childWindow$LWS) {
1743
- // If this function somehow receives the rootWindow, just return it.
1744
1659
  if (!childWindow$LWS || childWindow$LWS === rootWindow$LWS$1) {
1745
1660
  return childWindow$LWS;
1746
1661
  }
1747
1662
  for (const blocked$LWS of CHILD_WINDOW_BLOCKED_PROPERTIES$LWS) {
1748
1663
  const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(childWindow$LWS, blocked$LWS);
1749
- const replacement$LWS = /* istanbul ignore next: this replacement function will never actually be called */() => {};
1664
+ const replacement$LWS = () => {};
1750
1665
  ReflectDefineProperty$LWS$1(replacement$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, {
1751
1666
  __proto__: null,
1752
1667
  configurable: false,
@@ -1755,29 +1670,17 @@ function markForUnsafePropertyBlocking$LWS(childWindow$LWS) {
1755
1670
  return true;
1756
1671
  }
1757
1672
  });
1758
- // istanbul ignore else: currently unreachable via tests
1759
1673
  if (typeof childWindow$LWS[blocked$LWS] === 'function') {
1760
1674
  descriptor$LWS.value = replacement$LWS;
1761
1675
  }
1762
- /* Eventually there will be other types of blocked properties
1763
- else {
1764
- descriptor.get = replacement;
1765
- }
1766
- */
1767
1676
  ReflectDefineProperty$LWS$1(childWindow$LWS, blocked$LWS, descriptor$LWS);
1768
1677
  }
1769
1678
  return childWindow$LWS;
1770
1679
  }
1680
+ // No longer the primary mitigation path as of 264; kept for compatibility. Excluded from coverage.
1681
+ // istanbul ignore next: behavior will not be tested in collection coverage
1771
1682
  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
1683
  const getPossiblyBlockedPropertyFromSandbox$LWS = virtualEnvironmentEvaluator$LWS(`() => globalThis.${name$LWS}`);
1780
- // istanbul ignore else: it is unnecessary to cover the else path here
1781
1684
  if (getPossiblyBlockedPropertyFromSandbox$LWS()[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
1782
1685
  throw new LockerSecurityError$LWS(`Cannot call ${name$LWS} on this window.`);
1783
1686
  }
@@ -1845,6 +1748,153 @@ function normalizeWindowOpenArguments$LWS(args$LWS) {
1845
1748
  }
1846
1749
  return normalizedArgs$LWS;
1847
1750
  }
1751
+ const {
1752
+ // We don't cherry-pick the 'userAgent' property from `navigator` here
1753
+ // to avoid triggering its getter.
1754
+ navigator: navigator$LWS$1,
1755
+ navigator: {
1756
+ userAgentData: userAgentData$LWS$1
1757
+ }
1758
+ } = rootWindow$LWS$1;
1759
+ // The user-agent client hints API is experimental and subject to change.
1760
+ // https://caniuse.com/mdn-api_navigator_useragentdata
1761
+ // 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
1762
+ const brands$LWS$1 = userAgentData$LWS$1 == null ? void 0 : userAgentData$LWS$1.brands;
1763
+ // Note: Chromium identifies itself as Chrome in its user-agent string.
1764
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
1765
+ const chromiumUserAgentRegExp$LWS$1 = / (?:Headless)?Chrome\/\d+/;
1766
+ const webKitUserAgentRegExp$LWS = /WebKit/i;
1767
+ let userAgent$LWS$1;
1768
+ function getUserAgent$LWS$1() {
1769
+ if (userAgent$LWS$1 === undefined) {
1770
+ userAgent$LWS$1 = navigator$LWS$1.userAgent;
1771
+ }
1772
+ return userAgent$LWS$1;
1773
+ }
1774
+ const CUSTOM_ELEMENT_REGISTRY_ATTRIBUTE_NAME$LWS = LOCKER_SERVICE_KEY_LOWERED$LWS;
1775
+ // Used by '@locker/near-membrane-dom'.
1776
+ const IS_CHROMIUM_BROWSER$LWS$1 =
1777
+ // While experimental, `navigator.userAgentData.brands` may be defined as an
1778
+ // empty array in headless Chromium based browsers.
1779
+ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ?
1780
+ // Use user-agent client hints API if available to avoid deprecation
1781
+ // warnings.
1782
+ // https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API
1783
+ // istanbul ignore next: this code is not reachable in the coverage run.
1784
+ ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
1785
+ // prettier-ignore
1786
+ // istanbul ignore next: this code is not reachable in the coverage run.
1787
+ item$LWS => (item$LWS == null ? void 0 : item$LWS.brand) === 'Chromium']) !== undefined :
1788
+ // Fallback to a standard user-agent string sniff.
1789
+ ReflectApply$LWS$1(RegExpProtoTest$LWS$1, chromiumUserAgentRegExp$LWS$1, [getUserAgent$LWS$1()]);
1790
+ const IS_WEBKIT_BROWSER$LWS = !IS_CHROMIUM_BROWSER$LWS$1 && (
1791
+ // istanbul ignore next: this code is not reachable in the coverage run.
1792
+ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ? ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
1793
+ // istanbul ignore next
1794
+ item$LWS => {
1795
+ const brand$LWS = item$LWS == null ? void 0 : item$LWS.brand;
1796
+ return typeof brand$LWS === 'string' && ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [brand$LWS]);
1797
+ }]) !== undefined : ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [getUserAgent$LWS$1()]));
1798
+ // Pattern to match CSP nonce values, e.g., 'nonce-abc123'
1799
+ // The nonce value is base64 encoded and may contain alphanumeric characters, +, /, and =
1800
+ const NONCE_PATTERN$LWS = /'nonce-[A-Za-z0-9+/=]+'/g;
1801
+ const BLOCKED_ELEMENTS$LWS = toSafeSet$LWS(new SetCtor$LWS$1(['base']));
1802
+ function isBlockedElement$LWS(tagName$LWS) {
1803
+ return BLOCKED_ELEMENTS$LWS.has(tagName$LWS);
1804
+ }
1805
+ const {
1806
+ prototype: ElementProto$LWS
1807
+ } = Element;
1808
+ const ElementAriaAttributesToPropertyName$LWS = {
1809
+ __proto__: null,
1810
+ 'aria-activedescendant': 'ariaActiveDescendant',
1811
+ 'aria-atomic': 'ariaAtomic',
1812
+ 'aria-autocomplete': 'ariaAutoComplete',
1813
+ 'aria-busy': 'ariaBusy',
1814
+ 'aria-checked': 'ariaChecked',
1815
+ 'aria-colcount': 'ariaColCount',
1816
+ 'aria-colindex': 'ariaColIndex',
1817
+ 'aria-colspan': 'ariaColSpan',
1818
+ 'aria-controls': 'ariaControls',
1819
+ 'aria-current': 'ariaCurrent',
1820
+ 'aria-describedby': 'ariaDescribedBy',
1821
+ 'aria-details': 'ariaDetails',
1822
+ 'aria-disabled': 'ariaDisabled',
1823
+ 'aria-errormessage': 'ariaErrorMessage',
1824
+ 'aria-expanded': 'ariaExpanded',
1825
+ 'aria-flowto': 'ariaFlowTo',
1826
+ 'aria-haspopup': 'ariaHasPopup',
1827
+ 'aria-hidden': 'ariaHidden',
1828
+ 'aria-invalid': 'ariaInvalid',
1829
+ 'aria-keyshortcuts': 'ariaKeyShortcuts',
1830
+ 'aria-label': 'ariaLabel',
1831
+ 'aria-labelledby': 'ariaLabelledBy',
1832
+ 'aria-level': 'ariaLevel',
1833
+ 'aria-live': 'ariaLive',
1834
+ 'aria-modal': 'ariaModal',
1835
+ 'aria-multiline': 'ariaMultiLine',
1836
+ 'aria-multiselectable': 'ariaMultiSelectable',
1837
+ 'aria-orientation': 'ariaOrientation',
1838
+ 'aria-owns': 'ariaOwns',
1839
+ 'aria-placeholder': 'ariaPlaceholder',
1840
+ 'aria-posinset': 'ariaPosInSet',
1841
+ 'aria-pressed': 'ariaPressed',
1842
+ 'aria-readonly': 'ariaReadOnly',
1843
+ 'aria-relevant': 'ariaRelevant',
1844
+ 'aria-required': 'ariaRequired',
1845
+ 'aria-roledescription': 'ariaRoleDescription',
1846
+ 'aria-rowcount': 'ariaRowCount',
1847
+ 'aria-rowindex': 'ariaRowIndex',
1848
+ 'aria-rowspan': 'ariaRowSpan',
1849
+ 'aria-selected': 'ariaSelected',
1850
+ 'aria-setsize': 'ariaSetSize',
1851
+ 'aria-sort': 'ariaSort',
1852
+ 'aria-valuemax': 'ariaValueMax',
1853
+ 'aria-valuemin': 'ariaValueMin',
1854
+ 'aria-valuenow': 'ariaValueNow',
1855
+ 'aria-valuetext': 'ariaValueText'
1856
+ };
1857
+ // Used by '@locker/near-membrane-dom'.
1858
+ const {
1859
+ remove: ElementProtoRemove$LWS$1
1860
+ } = ElementProto$LWS;
1861
+ const {
1862
+ closest: ElementProtoClosest$LWS,
1863
+ getAttribute: ElementProtoGetAttribute$LWS,
1864
+ getAttributeNode: ElementProtoGetAttributeNode$LWS,
1865
+ getAttributeNodeNS: ElementProtoGetAttributeNodeNS$LWS,
1866
+ hasAttribute: ElementProtoHasAttribute$LWS,
1867
+ querySelector: ElementProtoQuerySelector$LWS,
1868
+ querySelectorAll: ElementProtoQuerySelectorAll$LWS,
1869
+ removeAttribute: ElementProtoRemoveAttribute$LWS,
1870
+ removeAttributeNode: ElementProtoRemoveAttributeNode$LWS,
1871
+ removeAttributeNS: ElementProtoRemoveAttributeNS$LWS,
1872
+ setAttribute: ElementProtoSetAttribute$LWS$1,
1873
+ setAttributeNS: ElementProtoSetAttributeNS$LWS,
1874
+ toggleAttribute: ElementProtoToggleAttribute$LWS
1875
+ } = ElementProto$LWS;
1876
+ const {
1877
+ get: ElementProtoInnerHTMLGetter$LWS,
1878
+ set: ElementProtoInnerHTMLSetter$LWS
1879
+ } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'innerHTML');
1880
+ const ElementProtoNamespaceURIGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'namespaceURI');
1881
+ const {
1882
+ get: ElementProtoOuterHTMLGetter$LWS
1883
+ } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'outerHTML');
1884
+ const ElementProtoTagNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'tagName');
1885
+ /**
1886
+ * Removes CSP nonce patterns from a string.
1887
+ *
1888
+ * CSP nonces (e.g., 'nonce-abc123') are cryptographic tokens used to allowlist
1889
+ * inline scripts/styles. This function strips them from serialized content to
1890
+ * prevent nonce exfiltration attacks.
1891
+ *
1892
+ * @param content - The string to sanitize (e.g., innerHTML, CSP content attribute)
1893
+ * @returns The string with all 'nonce-xxx' patterns removed
1894
+ */
1895
+ function removeNoncePatterns$LWS(content$LWS) {
1896
+ return ReflectApply$LWS$1(StringProtoReplace$LWS, content$LWS, [NONCE_PATTERN$LWS, '']);
1897
+ }
1848
1898
  const HTMLElement$LWS = getUnmaskedFunction$LWS(rootWindow$LWS$1.HTMLElement);
1849
1899
  const {
1850
1900
  prototype: HTMLElementProto$LWS
@@ -1875,11 +1925,40 @@ const NodeProtoIsConnectedGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS
1875
1925
  // Used by '@locker/near-membrane-dom'.
1876
1926
  ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'lastChild');
1877
1927
  const NodeProtoNodeNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'nodeName');
1928
+ function getNodeName$LWS(node$LWS) {
1929
+ return ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, []);
1930
+ }
1878
1931
  const NodeProtoOwnerDocumentGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'ownerDocument');
1879
1932
  ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'parentNode');
1880
1933
  ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
1881
1934
  const rootDocumentDetachedFragment$LWS = ReflectApply$LWS$1(DocumentProtoCreateDocumentFragment$LWS, rootDocument$LWS, []);
1882
1935
  const rootDocumentDetachedContainer$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['div']);
1936
+ // Regex to match null bytes and zero-width characters that browsers may strip or ignore
1937
+ // \x00 - Null byte
1938
+ // \u00AD - Soft Hyphen
1939
+ // \u034F - Combining Grapheme Joiner
1940
+ // \u200B - Zero Width Space
1941
+ // \u200C - Zero Width Non-Joiner
1942
+ // \u200D - Zero Width Joiner
1943
+ // \u2060 - Word Joiner
1944
+ // \uFEFF - Zero Width No-Break Space (BOM)
1945
+ // eslint-disable-next-line no-control-regex, no-misleading-character-class
1946
+ const INVISIBLE_CHARS_REGEX$LWS = /[\x00\u00AD\u034F\u200B\u200C\u200D\u2060\uFEFF]/g;
1947
+ function normalizeInput$LWS(input$LWS, replacement$LWS = '') {
1948
+ // Replace invisible characters with space (not remove) to preserve token boundaries
1949
+ // This ensures DOCTYPE and the root element name remain separate tokens
1950
+ const lowerCasedInput$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, toSafeStringValue$LWS(input$LWS), []);
1951
+ return ReflectApply$LWS$1(StringProtoReplace$LWS, lowerCasedInput$LWS, [INVISIBLE_CHARS_REGEX$LWS, replacement$LWS]);
1952
+ }
1953
+ // Regex to detect DOCTYPE with internal DTD subset containing entity definitions.
1954
+ // Matches: <!DOCTYPE root [...anything...]>
1955
+ // The internal subset can contain ENTITY, ELEMENT, ATTLIST, NOTATION declarations.
1956
+ // This is an XXE attack vector where entities can contain malicious script content.
1957
+ const DOCTYPE_WITH_INTERNAL_SUBSET_REGEX$LWS = /<!doctype\s+\S+\s*\[/;
1958
+ // Regex to detect DOCTYPE with SYSTEM or PUBLIC external entity references.
1959
+ // Matches: <!DOCTYPE root SYSTEM "..."> or <!DOCTYPE root PUBLIC "..." "...">
1960
+ // External DTDs can define entities that get expanded with malicious content.
1961
+ const DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS = /<!doctype\s+\S+\s+(?:system|public)\s/;
1883
1962
  /* eslint-disable no-underscore-dangle */
1884
1963
  class Validator$LWS {
1885
1964
  constructor(document$LWS, {
@@ -1893,10 +1972,32 @@ class Validator$LWS {
1893
1972
  ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, this._templates.right, [rightString$LWS]);
1894
1973
  return deepIsEqualNode$LWS(this._templates.left, this._templates.right);
1895
1974
  };
1975
+ // Detect XML External Entity (XXE) injection attacks via DOCTYPE declarations.
1976
+ // Attackers can embed malicious script content inside ENTITY definitions that
1977
+ // get expanded when the XML/SVG is rendered, bypassing DOMPurify sanitization.
1978
+ // eslint-disable-next-line class-methods-use-this
1979
+ this.isXMLEntityAttack = input$LWS => {
1980
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS, ' ');
1981
+ // Block DOCTYPE with:
1982
+ // - Internal DTD subset (e.g., <!DOCTYPE svg [<!ENTITY foo "...">]>)
1983
+ // - SYSTEM or PUBLIC external entity references
1984
+ 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]);
1985
+ };
1986
+ // Detect namespaced script elements that execute in XML contexts.
1987
+ // HTML-mode sanitizers treat <prefix:script> as an inert unknown element,
1988
+ // but XML parsers resolve the namespace and create an executable script
1989
+ // when the namespace is XHTML or SVG. The namespace URL itself can be
1990
+ // obfuscated with XML character entities in attribute values, but the
1991
+ // xmlns attribute name cannot, so checking for "xmlns" is reliable.
1992
+ // eslint-disable-next-line class-methods-use-this
1993
+ this.isXMLNamespacedScriptAttack = input$LWS => {
1994
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
1995
+ return hasTag$LWS(normalizedInput$LWS, 'script') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
1996
+ };
1896
1997
  // There is no reason to ever allow any HTML or XML that contains all three of these substrings.
1897
1998
  // 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), []);
1999
+ this.isIframeSrcdocScriptAttack = input$LWS => {
2000
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
1900
2001
  const hasIframe$LWS = hasTag$LWS(normalizedInput$LWS, 'iframe') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['srcdoc']);
1901
2002
  const hasScript$LWS = hasTag$LWS(normalizedInput$LWS, 'script');
1902
2003
  // If neither an iframe or a script was detected, then this input is safe.
@@ -1928,7 +2029,14 @@ class Validator$LWS {
1928
2029
  ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
1929
2030
  // If innerHTML contains "script", but innerText does not, then the string
1930
2031
  // 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');
2032
+ let checkableInnerText$LWS = innerText$LWS;
2033
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
2034
+ // Strip < > : from innerText before checking, because HTML entities like
2035
+ // &lt;script&gt; decode to <script> in text content and would otherwise
2036
+ // trick hasTag into thinking visible text contains a script tag.
2037
+ checkableInnerText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, innerText$LWS, [/[<>:]/g, '']);
2038
+ }
2039
+ return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableInnerText$LWS, 'script');
1932
2040
  };
1933
2041
  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
2042
  this._constructors = {
@@ -1965,10 +2073,13 @@ function deepIsEqualNode$LWS(leftRoot$LWS, rightRoot$LWS) {
1965
2073
  function hasTag$LWS(input$LWS, tag$LWS) {
1966
2074
  let checkableInput$LWS = input$LWS;
1967
2075
  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, ' ']);
2076
+ // Input is already lowercased and invisible chars stripped by caller
2077
+ checkableInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, input$LWS, [/\s+/g, ' ']);
1970
2078
  }
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}>`]);
2079
+ // Match <tag or :tag (namespaced) followed by whitespace, >, /
2080
+ // Also match when directly followed by src or srcdoc (null byte was stripped)
2081
+ const tagPattern$LWS = new RegExpCtor$LWS$1(`[<:]${tag$LWS}(?:[\\s>/]|(?=src))`);
2082
+ return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, tagPattern$LWS, [checkableInput$LWS]);
1972
2083
  }
1973
2084
  const rootValidator$LWS = new Validator$LWS(rootDocument$LWS, rootWindow$LWS$1);
1974
2085
  const documentToValidatorMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1([[rootDocument$LWS, rootValidator$LWS]]));
@@ -1996,60 +2107,13 @@ const {
1996
2107
  } = BlobProto$LWS;
1997
2108
  const BlobProtoSizeGetter$LWS = ObjectLookupOwnGetter$LWS$1(BlobProto$LWS, 'size');
1998
2109
  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
-
2047
- // Used by '@locker/near-membrane-shared-dom'.
2048
- // The DOMException constructor was exposed in Edge 12 but wasn't invocable
2049
- // until Edge 79. As long as this is used for instanceof checks it should be fine.
2050
- // https://developer.mozilla.org/en-US/docs/Web/API/DOMException#browser_compatibility
2051
- const DOMExceptionCtor$LWS$1 = DOMException;
2052
- ObjectLookupOwnGetter$LWS$1(DOMExceptionCtor$LWS$1.prototype, 'code');
2110
+
2111
+ // Used by '@locker/near-membrane-shared-dom'.
2112
+ // The DOMException constructor was exposed in Edge 12 but wasn't invocable
2113
+ // until Edge 79. As long as this is used for instanceof checks it should be fine.
2114
+ // https://developer.mozilla.org/en-US/docs/Web/API/DOMException#browser_compatibility
2115
+ const DOMExceptionCtor$LWS$1 = DOMException;
2116
+ ObjectLookupOwnGetter$LWS$1(DOMExceptionCtor$LWS$1.prototype, 'code');
2053
2117
  const {
2054
2118
  createDocument: DOMImplementationProtoCreateDocument$LWS
2055
2119
  } = DOMImplementation.prototype;
@@ -2087,6 +2151,20 @@ const {
2087
2151
  } = ReflectGetOwnPropertyDescriptor$LWS(HTMLAnchorElementProto$LWS, 'href');
2088
2152
  const HTMLAnchorElementProtoPathnameGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElementProto$LWS, 'pathname');
2089
2153
  const HTMLAnchorElementProtoProtocolGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElementProto$LWS, 'protocol');
2154
+ const {
2155
+ prototype: HTMLButtonElementProto$LWS
2156
+ } = HTMLButtonElement;
2157
+ const {
2158
+ get: HTMLButtonElementProtoFormActionGetter$LWS,
2159
+ set: HTMLButtonElementProtoFormActionSetter$LWS
2160
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLButtonElementProto$LWS, 'formAction');
2161
+ const {
2162
+ prototype: HTMLFormElementProto$LWS
2163
+ } = HTMLFormElement;
2164
+ const {
2165
+ get: HTMLFormElementProtoActionGetter$LWS,
2166
+ set: HTMLFormElementProtoActionSetter$LWS
2167
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLFormElementProto$LWS, 'action');
2090
2168
  const {
2091
2169
  prototype: HTMLIFrameElementProto$LWS
2092
2170
  } = HTMLIFrameElement;
@@ -2096,6 +2174,13 @@ const HTMLIFrameElementProtoSandboxGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTML
2096
2174
  const HTMLIFrameElementProtoSandboxSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'sandbox');
2097
2175
  const HTMLIFrameElementProtoSrcGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLIFrameElementProto$LWS, 'src');
2098
2176
  const HTMLIFrameElementProtoSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'src');
2177
+ const {
2178
+ prototype: HTMLInputElementProto$LWS
2179
+ } = HTMLInputElement;
2180
+ const {
2181
+ get: HTMLInputElementProtoFormActionGetter$LWS,
2182
+ set: HTMLInputElementProtoFormActionSetter$LWS
2183
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLInputElementProto$LWS, 'formAction');
2099
2184
  const HTMLScriptElementCtor$LWS = HTMLScriptElement;
2100
2185
  const {
2101
2186
  prototype: HTMLScriptElementProto$LWS
@@ -2160,7 +2245,7 @@ function defineScriptEvaluatorProperty$LWS(script$LWS, callback$LWS) {
2160
2245
  }, [])
2161
2246
  })) {
2162
2247
  // istanbul ignore next: require a test to get the evaluator in a bad state. Like code that tried to access it in between. This is mostly a "the universe is not as expected error"
2163
- throw new LockerSecurityError$LWS(`Cannot evaluate ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, script$LWS, [])}`);
2248
+ throw new LockerSecurityError$LWS(`Cannot evaluate ${getNodeName$LWS(script$LWS)}`);
2164
2249
  }
2165
2250
  }
2166
2251
  function deleteOriginalScriptProperty$LWS(script$LWS) {
@@ -2175,6 +2260,13 @@ function getOriginalScriptProperty$LWS(script$LWS) {
2175
2260
  function isScriptEvaluated$LWS(script$LWS) {
2176
2261
  return evaluatedScriptElements$LWS.has(script$LWS);
2177
2262
  }
2263
+ function isUnknownScriptElement$LWS(element$LWS, globalObject$LWS) {
2264
+ const {
2265
+ HTMLScriptElement: HTMLScriptElement$LWS,
2266
+ SVGScriptElement: SVGScriptElement$LWS
2267
+ } = globalObject$LWS;
2268
+ return (element$LWS instanceof HTMLScriptElement$LWS || element$LWS instanceof SVGScriptElement$LWS) && !originalScriptPropertyCache$LWS.has(element$LWS) && !evaluatedScriptElements$LWS.has(element$LWS);
2269
+ }
2178
2270
  function isScriptPropertyEvaluatorHookDefined$LWS(script$LWS) {
2179
2271
  return originalScriptPropertyCache$LWS.has(script$LWS);
2180
2272
  }
@@ -2290,7 +2382,7 @@ const {
2290
2382
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
2291
2383
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
2292
2384
  ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
2293
- /*! version: 0.26.4 */
2385
+ /*! version: 0.28.1 */
2294
2386
 
2295
2387
  /*!
2296
2388
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2312,6 +2404,10 @@ function isMIMETypeAllowed$LWS(mimeType$LWS) {
2312
2404
  return false;
2313
2405
  }
2314
2406
  const DISALLOWED_ENDPOINTS_LIST$LWS = ['/aura', '/webruntime'];
2407
+ // Endpoints that should not be used as browsing context targets (window.open, iframe.src)
2408
+ // because they return manipulable content. Unlike fetch/XHR which just return data,
2409
+ // browsing contexts can be manipulated by attackers to inject malicious DOM.
2410
+ const DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS = ['/chatter'];
2315
2411
  const TRUSTED_DOMAINS_REG_EXP$LWS = /\.(force|salesforce|visualforce|documentforce|my\.site|salesforce-sites)\.com$/;
2316
2412
  const URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['about:', 'http:', 'https:']);
2317
2413
  const newlinesAndTabsRegExp$LWS = /[\u2028\u2029\n\r\t]/g;
@@ -2332,9 +2428,21 @@ function isSameOriginURL$LWS(resourceValue$LWS) {
2332
2428
  // then it can be treated as a same-origin URL.
2333
2429
  return resourceUrlOrigin$LWS && resourceUrlOrigin$LWS === rootWindow$LWS$1.location.origin;
2334
2430
  }
2431
+ // Detects exploit patterns that abuse the current page context
2432
+ function isAttemptingToExploitURL$LWS(resourceValue$LWS) {
2433
+ const loweredResourceValue$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, resourceValue$LWS, []);
2434
+ const locationHref$LWS = rootWindow$LWS$1.location.href;
2435
+ 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}?`]);
2436
+ }
2437
+ // Validates that a URL doesn't target disallowed endpoints
2335
2438
  // @TODO: W-7302311 Make paths and domains configurable.
2336
- function isValidURL$LWS(parsedURL$LWS) {
2439
+ function isAllowedEndpointURL$LWS(parsedURL$LWS) {
2337
2440
  const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
2441
+ // This MUST be done inside the function because the gate may not be enabled when the
2442
+ // module code is loaded and evaluated (as would be the case for test environments)
2443
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
2444
+ DISALLOWED_ENDPOINTS_LIST$LWS.push('/_nc_external', '/force', '/setup');
2445
+ }
2338
2446
  for (let i$LWS = 0, {
2339
2447
  length: length$LWS
2340
2448
  } = DISALLOWED_ENDPOINTS_LIST$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -2344,6 +2452,26 @@ function isValidURL$LWS(parsedURL$LWS) {
2344
2452
  }
2345
2453
  return true;
2346
2454
  }
2455
+ // Validates that a URL is safe for browsing context targets (window.open, iframe.src).
2456
+ // Unlike fetch/XHR which just return response data, browsing contexts can be
2457
+ // manipulated by attackers to inject malicious content.
2458
+ // This includes all endpoints blocked by isAllowedEndpointURL plus browsing-context-specific ones.
2459
+ function isValidBrowsingContextURL$LWS(parsedURL$LWS) {
2460
+ // First check against the general disallowed endpoints
2461
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
2462
+ return false;
2463
+ }
2464
+ // Then check against browsing-context-specific disallowed endpoints
2465
+ const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
2466
+ for (let i$LWS = 0, {
2467
+ length: length$LWS
2468
+ } = DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS; i$LWS < length$LWS; i$LWS += 1) {
2469
+ 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]}/`])) {
2470
+ return false;
2471
+ }
2472
+ }
2473
+ return true;
2474
+ }
2347
2475
  function isValidURLScheme$LWS(url$LWS) {
2348
2476
  ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
2349
2477
  return URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
@@ -2365,7 +2493,7 @@ function sanitizeURLForElement$LWS(url$LWS) {
2365
2493
  function sanitizeURLString$LWS(urlString$LWS) {
2366
2494
  return urlString$LWS === '' ? urlString$LWS : ReflectApply$LWS$1(StringProtoReplace$LWS, urlString$LWS, [newlinesAndTabsRegExp$LWS, '']);
2367
2495
  }
2368
- /*! version: 0.26.4 */
2496
+ /*! version: 0.28.1 */
2369
2497
 
2370
2498
  /*! @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
2499
 
@@ -3777,7 +3905,7 @@ try {
3777
3905
  // swallow
3778
3906
  }
3779
3907
  const trusted = createPolicy('trusted', policyOptions);
3780
- /*! version: 0.26.4 */
3908
+ /*! version: 0.28.1 */
3781
3909
 
3782
3910
  /*!
3783
3911
  * Copyright (C) 2019 salesforce.com, inc.
@@ -3838,7 +3966,7 @@ var CONFIG$LWS = /*#__PURE__*/Object.freeze({
3838
3966
  const instancesBySandboxKeyRegistry$LWS = {
3839
3967
  __proto__: null
3840
3968
  };
3841
- const SANITIZE_ATTRIBUTES_LIST$LWS = toSafeArray$LWS$1(['href', 'xlink:href']);
3969
+ const SANITIZE_USE_ELEMENT_ATTRIBUTES_LIST$LWS = toSafeArray$LWS$1(['href', 'xlink:href']);
3842
3970
  const SHARED_SVG_SANITIZER_KEY$LWS = 'SHARED_SVG_SANITIZER_KEY';
3843
3971
  ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
3844
3972
  // Queue for managing pending XHR requests.
@@ -3901,6 +4029,7 @@ function getSanitizerForConfig$LWS(sandboxKey$LWS, configName$LWS) {
3901
4029
  } else if (hookName$LWS === 'uponSanitizeAttribute') {
3902
4030
  configuredDOMPurifyInstance$LWS.addHook('uponSanitizeAttribute', hooksRegistry$LWS[hookName$LWS]);
3903
4031
  } else {
4032
+ // istanbul ignore next: createSantizerHooksRegistry only returns uponSanitizeElement and uponSanitizeAttribute — both handled above, so this fallback is unreachable
3904
4033
  configuredDOMPurifyInstance$LWS.addHook(hookName$LWS, hooksRegistry$LWS[hookName$LWS]);
3905
4034
  }
3906
4035
  }
@@ -4022,9 +4151,20 @@ function uponSanitizeAttribute$LWS(node$LWS, data$LWS, _config$LWS) {
4022
4151
  attrValue: attrValue$LWS,
4023
4152
  attrName: attrName$LWS
4024
4153
  } = 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)) {
4154
+ const nodeName$LWS = ReflectApply$LWS$1(StringProtoToUpperCase$LWS, getNodeName$LWS(node$LWS), []);
4155
+ if (attrValue$LWS && nodeName$LWS === 'USE' && SANITIZE_USE_ELEMENT_ATTRIBUTES_LIST$LWS.includes(attrName$LWS)) {
4026
4156
  data$LWS.attrValue = sanitizeSvgHref$LWS(attrValue$LWS);
4027
4157
  }
4158
+ // Remove action/formaction attributes pointing to disallowed endpoints.
4159
+ // Using keepAttr=false rather than blanking the value so that formaction
4160
+ // removal falls back to the form's own (already validated) action attribute
4161
+ // instead of overriding it with the current page URL.
4162
+ if (isGaterEnabledFeature$LWS('changesSince.262') && attrValue$LWS && (attrName$LWS === 'action' || attrName$LWS === 'formaction') && (nodeName$LWS === 'FORM' || nodeName$LWS === 'BUTTON' || nodeName$LWS === 'INPUT')) {
4163
+ const parsedURL$LWS = parseURL$LWS(attrValue$LWS);
4164
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
4165
+ data$LWS.keepAttr = false;
4166
+ }
4167
+ }
4028
4168
  // To support Lit, we must tell DOMPurify that attributes starting with "@", ".", or "?" are allowed.
4029
4169
  // Ref:
4030
4170
  // https://lit.dev/docs/components/events/
@@ -4042,7 +4182,7 @@ function blobSanitizer$LWS(sandboxKey$LWS) {
4042
4182
  }
4043
4183
  return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
4044
4184
  }
4045
- /*! version: 0.26.4 */
4185
+ /*! version: 0.28.1 */
4046
4186
 
4047
4187
  /*!
4048
4188
  * Copyright (C) 2023 salesforce.com, inc.
@@ -4096,7 +4236,8 @@ var ContentType$LWS;
4096
4236
  (function (ContentType$LWS) {
4097
4237
  ContentType$LWS[ContentType$LWS["HTML"] = 0] = "HTML";
4098
4238
  ContentType$LWS[ContentType$LWS["SVG"] = 1] = "SVG";
4099
- ContentType$LWS[ContentType$LWS["XML"] = 2] = "XML";
4239
+ ContentType$LWS[ContentType$LWS["XHTML"] = 2] = "XHTML";
4240
+ ContentType$LWS[ContentType$LWS["XML"] = 3] = "XML";
4100
4241
  })(ContentType$LWS || (ContentType$LWS = {}));
4101
4242
  const evaluatedScripts$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
4102
4243
  const scriptURLsCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
@@ -4121,11 +4262,22 @@ const policyOptions$LWS = {
4121
4262
  }
4122
4263
  case ContentType$LWS.SVG:
4123
4264
  {
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);
4265
+ let svgWrapper$LWS;
4266
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
4267
+ // Use template element to parse SVG content - template content is inert,
4268
+ // meaning images won't load and event handlers won't fire during parsing.
4269
+ // This prevents TOCTOU attacks where onload fires before sanitization.
4270
+ const tplElement$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
4271
+ // Wrap dirty content in SVG to ensure proper SVG namespace parsing
4272
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, tplElement$LWS, [trusted.createHTML(`<svg xmlns="${NAMESPACE_SVG$LWS}">${dirty$LWS}</svg>`)]);
4273
+ const content$LWS = ReflectApply$LWS$1(HTMLTemplateElementProtoContentGetter$LWS, tplElement$LWS, []);
4274
+ svgWrapper$LWS = ReflectApply$LWS$1(NodeProtoFirstChildGetter$LWS, content$LWS, []);
4275
+ } else {
4276
+ // Original behavior: create live SVG element (vulnerable to TOCTOU)
4277
+ svgWrapper$LWS = ReflectApply$LWS$1(DocumentProtoCreateElementNS$LWS, document, [NAMESPACE_SVG$LWS, 'svg']);
4278
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, svgWrapper$LWS, [trusted.createHTML(dirty$LWS)]);
4279
+ }
4280
+ const sanitized$LWS = getSanitizerForConfig$LWS('SHARED_SVG_SANITIZER_KEY', 'NODE_SVG').sanitize(svgWrapper$LWS);
4129
4281
  const firstChild$LWS = ReflectApply$LWS$1(NodeProtoFirstChildGetter$LWS, sanitized$LWS, []);
4130
4282
  return ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, firstChild$LWS, []);
4131
4283
  }
@@ -4239,13 +4391,12 @@ function createScriptSrcURLSetter$LWS(targetElement$LWS) {
4239
4391
  ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
4240
4392
  };
4241
4393
  }
4242
- /*! version: 0.26.4 */
4394
+ /*! version: 0.28.1 */
4243
4395
 
4244
4396
  /*!
4245
4397
  * Copyright (C) 2019 salesforce.com, inc.
4246
4398
  */
4247
4399
  var _rootWindow$CustomEle$LWS;
4248
- function _extends$LWS() { return _extends$LWS = Object.assign ? Object.assign.bind() : function (n$LWS) { for (var e$LWS = 1; e$LWS < arguments.length; e$LWS++) { var t$LWS = arguments[e$LWS]; for (var r$LWS in t$LWS) ({}).hasOwnProperty.call(t$LWS, r$LWS) && (n$LWS[r$LWS] = t$LWS[r$LWS]); } return n$LWS; }, _extends$LWS.apply(null, arguments); }
4249
4400
  const ERR_ILLEGAL_CONSTRUCTOR$LWS = 'Illegal constructor';
4250
4401
  const ERR_ILLEGAL_INVOCATION$LWS = 'Illegal invocation.';
4251
4402
  const ERR_NO_NEW_OP_HTML_ELEMENT$LWS = "Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.";
@@ -4986,6 +5137,28 @@ function setCustomElementsRegistry$LWS(document$LWS, key$LWS) {
4986
5137
  currentRegistry$LWS = getSandboxCustomElementRegistry$LWS(document$LWS, key$LWS);
4987
5138
  }
4988
5139
  const DataTransferProtoBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
5140
+
5141
+ /**
5142
+ * Blocks read access to the 'nonce' attribute.
5143
+ *
5144
+ * The 'nonce' attribute contains a cryptographic token used by Content Security Policy
5145
+ * to allow specific inline scripts/styles to execute. If malicious code can read this
5146
+ * value, it can bypass CSP by injecting scripts with the stolen nonce.
5147
+ *
5148
+ * This function is intentionally separate from the general attribute distortion registry
5149
+ * (registerAttributeDistortion/getAttributeDistortion) because that registry is designed
5150
+ * for setter distortions that validate/sanitize values being set. Most blocked attributes
5151
+ * (like 'srcdoc' on iframes) only need to block writes while allowing reads. The 'nonce'
5152
+ * attribute is unique in that it must block both reads AND writes.
5153
+ *
5154
+ * By using a dedicated function, we avoid incorrectly applying setter distortions when
5155
+ * reading attributes, which would cause errors for attributes like 'src' and 'href'.
5156
+ */
5157
+ function blockAccessToNonce$LWS(attrName$LWS) {
5158
+ if (attrName$LWS === 'nonce') {
5159
+ throw new LockerSecurityError$LWS("Attribute 'nonce' not accessible");
5160
+ }
5161
+ }
4989
5162
  const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
4990
5163
  const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4991
5164
  function finalizeAttributeDistortions$LWS(record$LWS) {
@@ -5016,11 +5189,7 @@ function finalizeAttributeDistortions$LWS(record$LWS) {
5016
5189
  attributeFactories$LWS[i$LWS](attributeDistortionRegistry$LWS);
5017
5190
  }
5018
5191
  }
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;
5192
+ function lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS) {
5024
5193
  const sandboxAttributeDistortionRegistry$LWS = sandboxAttributeDistortionRegistryCache$LWS.get(document$LWS);
5025
5194
  // istanbul ignore if: currently unreachable via tests
5026
5195
  if (sandboxAttributeDistortionRegistry$LWS === undefined) {
@@ -5052,6 +5221,29 @@ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attri
5052
5221
  }
5053
5222
  return undefined;
5054
5223
  }
5224
+ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS = NAMESPACE_DEFAULT$LWS) {
5225
+ const {
5226
+ document: document$LWS,
5227
+ key: key$LWS
5228
+ } = record$LWS;
5229
+ const result$LWS = lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS);
5230
+ if (result$LWS !== undefined) {
5231
+ return result$LWS;
5232
+ }
5233
+ // When an element is passed to a setAttribute function from a different
5234
+ // realm (e.g. cross-realm setAttribute obtained via a navigated iframe),
5235
+ // the instanceof check fails because the registry's constructors belong
5236
+ // to the function's realm, not the element's. Fall back to the element's
5237
+ // ownerDocument registry where constructors match the element's prototype
5238
+ // chain.
5239
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
5240
+ const elementDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, element$LWS, []);
5241
+ if (elementDocument$LWS && elementDocument$LWS !== document$LWS) {
5242
+ return lookupAttributeDistortion$LWS(elementDocument$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS);
5243
+ }
5244
+ }
5245
+ return undefined;
5246
+ }
5055
5247
  // Utility for normalizing namespaces which default to HTML behavior.
5056
5248
  // script.setAttributeNS(null, 'src', 'foo.js') has the same behavior as
5057
5249
  // script.setAttribute('src', 'foo.js').
@@ -5805,9 +5997,13 @@ function initDistortionDocumentCreateElement$LWS({
5805
5997
  const {
5806
5998
  0: tagName$LWS
5807
5999
  } = args$LWS;
6000
+ const normalizedTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
6001
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isBlockedElement$LWS(normalizedTagName$LWS)) {
6002
+ throw new LockerSecurityError$LWS(`Cannot create '${normalizedTagName$LWS}' element.`);
6003
+ }
5808
6004
  // Slow path for potential custom elements that might be registered
5809
6005
  // in the sandbox's virtual custom element registry.
5810
- if (ReflectApply$LWS$1(StringProtoIncludes$LWS, tagName$LWS, ['-'])) {
6006
+ if (ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedTagName$LWS, ['-'])) {
5811
6007
  // This must be called to signal to the virtual
5812
6008
  // CustomElementRegistry that the next thing created will be
5813
6009
  // a custom element and it must be marked for association to
@@ -5835,9 +6031,13 @@ function initDistortionDocumentCreateElementNS$LWS({
5835
6031
  const {
5836
6032
  1: tagName$LWS
5837
6033
  } = args$LWS;
6034
+ const normalizedTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
6035
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isBlockedElement$LWS(normalizedTagName$LWS)) {
6036
+ throw new LockerSecurityError$LWS(`Cannot create '${normalizedTagName$LWS}' element.`);
6037
+ }
5838
6038
  // Slow path for potential custom elements that might
5839
6039
  // be registered in the sandbox's virtual custom element registry.
5840
- if (ReflectApply$LWS$1(StringProtoIncludes$LWS, tagName$LWS, ['-'])) {
6040
+ if (ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedTagName$LWS, ['-'])) {
5841
6041
  // This must be called to signal to the virtual
5842
6042
  // CustomElementRegistry that the next thing created will be
5843
6043
  // a custom element and it must be marked for association to
@@ -5848,6 +6048,56 @@ function initDistortionDocumentCreateElementNS$LWS({
5848
6048
  }];
5849
6049
  };
5850
6050
  }
6051
+ const {
6052
+ isSharedElement: isSharedElement$E$LWS
6053
+ } = rootValidator$LWS;
6054
+ function initDistortionDocumentCreateNodeIterator$LWS({
6055
+ globalObject: {
6056
+ Document: {
6057
+ prototype: {
6058
+ createNodeIterator: originalCreateNodeIterator$LWS
6059
+ }
6060
+ }
6061
+ }
6062
+ }) {
6063
+ const distortionEntry$LWS = [originalCreateNodeIterator$LWS, function createNodeIterator$LWS(...args$LWS) {
6064
+ const {
6065
+ 0: root$LWS
6066
+ } = args$LWS;
6067
+ if (isGaterEnabledFeature$LWS('changesSince.262') && root$LWS && isSharedElement$E$LWS(root$LWS)) {
6068
+ throw new LockerSecurityError$LWS(`Cannot create NodeIterator rooted at shared element ${getNodeName$LWS(root$LWS)}.`);
6069
+ }
6070
+ return ReflectApply$LWS$1(originalCreateNodeIterator$LWS, this, args$LWS);
6071
+ }];
6072
+ return function distortionDocumentCreateNodeIterator$LWS() {
6073
+ return distortionEntry$LWS;
6074
+ };
6075
+ }
6076
+ const {
6077
+ isSharedElement: isSharedElement$D$LWS
6078
+ } = rootValidator$LWS;
6079
+ function initDistortionDocumentCreateTreeWalker$LWS({
6080
+ globalObject: {
6081
+ Document: {
6082
+ prototype: {
6083
+ createTreeWalker: originalCreateTreeWalker$LWS
6084
+ }
6085
+ }
6086
+ }
6087
+ }) {
6088
+ const distortionEntry$LWS = [originalCreateTreeWalker$LWS, function createTreeWalker$LWS(...args$LWS) {
6089
+ const {
6090
+ 0: root$LWS
6091
+ } = args$LWS;
6092
+ if (isGaterEnabledFeature$LWS('changesSince.262') && root$LWS && isSharedElement$D$LWS(root$LWS)) {
6093
+ throw new LockerSecurityError$LWS(`Cannot create TreeWalker rooted at shared element ${getNodeName$LWS(root$LWS)}.`);
6094
+ }
6095
+ return ReflectApply$LWS$1(originalCreateTreeWalker$LWS, this, args$LWS);
6096
+ }];
6097
+ return function distortionDocumentCreateTreeWalker$LWS() {
6098
+ return distortionEntry$LWS;
6099
+ };
6100
+ }
5851
6101
  function domain$LWS() {
5852
6102
  throw new LockerSecurityError$LWS('Cannot set document.domain.');
5853
6103
  }
@@ -5863,10 +6113,15 @@ function initDistortionDocumentDomainSetter$LWS({
5863
6113
  };
5864
6114
  }
5865
6115
  const {
5866
- isSharedElement: isSharedElement$s$LWS
6116
+ isSharedElement: isSharedElement$C$LWS
5867
6117
  } = rootValidator$LWS;
6118
+ // Regex to strip non-ASCII characters after NFKD normalization.
6119
+ // This handles Unicode normalization attacks like using Turkish "İ" (U+0130)
6120
+ // which Firefox normalizes to "I" in execCommand, bypassing lowercase checks.
6121
+ // eslint-disable-next-line no-control-regex
6122
+ const nonASCIIRegExp$LWS = /[^\x00-\x7F]/g;
5868
6123
  function throwLockerSecurityError$LWS(command$LWS, target$LWS) {
5869
- throw new LockerSecurityError$LWS(`Cannot execute command '${command$LWS}' on ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, target$LWS, [])}.`);
6124
+ throw new LockerSecurityError$LWS(`Cannot execute command '${command$LWS}' on ${getNodeName$LWS(target$LWS)}.`);
5870
6125
  }
5871
6126
  function initDistortionDocumentExecCommand$LWS({
5872
6127
  document: document$LWS,
@@ -5891,7 +6146,20 @@ function initDistortionDocumentExecCommand$LWS({
5891
6146
  } = args$LWS;
5892
6147
  if (length$LWS >= 1) {
5893
6148
  const command$LWS = toSafeStringValue$LWS(args$LWS[0]);
5894
- const loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, command$LWS, []);
6149
+ let loweredCommand$LWS;
6150
+ // istanbul ignore else: ungated else is not reachable in coverage runs
6151
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6152
+ // Normalize the command using NFKD (Compatibility Decomposition)
6153
+ // to handle Unicode normalization attacks. For example, Turkish "İ"
6154
+ // (U+0130) decomposes to "I" + combining dot above, and we then
6155
+ // strip non-ASCII characters to get a clean ASCII string for comparison.
6156
+ // This matches Firefox's internal behavior which normalizes commands.
6157
+ const normalizedCommand$LWS = ReflectApply$LWS$1(StringProtoNormalize$LWS, command$LWS, ['NFKD']);
6158
+ const asciiOnlyCommand$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, normalizedCommand$LWS, [nonASCIIRegExp$LWS, '']);
6159
+ loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, asciiOnlyCommand$LWS, []);
6160
+ } else {
6161
+ loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, command$LWS, []);
6162
+ }
5895
6163
  if (loweredCommand$LWS === 'selectall' && this === rootDocument$LWS) {
5896
6164
  throwLockerSecurityError$LWS(command$LWS, this);
5897
6165
  }
@@ -5909,7 +6177,7 @@ function initDistortionDocumentExecCommand$LWS({
5909
6177
  // istanbul ignore else: external is the default sandbox type for coverage runs
5910
6178
  if (type$LWS === 0 /* SandboxType.External */) {
5911
6179
  const activeElement$LWS = ReflectApply$LWS$1(originalActiveElement$LWS, this, []);
5912
- if (isSharedElement$s$LWS(activeElement$LWS) && ReflectApply$LWS$1(originalIsContentEditable$LWS, activeElement$LWS, [])) {
6180
+ if (isSharedElement$C$LWS(activeElement$LWS) && ReflectApply$LWS$1(originalIsContentEditable$LWS, activeElement$LWS, [])) {
5913
6181
  throwLockerSecurityError$LWS(command$LWS, activeElement$LWS);
5914
6182
  }
5915
6183
  }
@@ -5961,25 +6229,23 @@ function initDistortionDocumentOpen$LWS({
5961
6229
  // for window.open
5962
6230
  // https://developer.mozilla.org/en-US/docs/Web/API/Document/open#three-argument_document.open
5963
6231
  const normalizedArgs$LWS = normalizeWindowOpenArguments$LWS(args$LWS);
5964
- const childWindow$LWS = ReflectApply$LWS$1(originalDocumentOpen$LWS, this, normalizedArgs$LWS);
6232
+ // istanbul ignore next: resourceUrl default is not reachable via tests
5965
6233
  const {
5966
6234
  0: resourceUrl$LWS = ''
5967
6235
  } = 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
6236
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isAttemptingToExploitURL$LWS(resourceUrl$LWS)) {
6237
+ throw new LockerSecurityError$LWS(`Cannot open: ${resourceUrl$LWS}`);
6238
+ }
6239
+ const childWindow$LWS = ReflectApply$LWS$1(originalDocumentOpen$LWS, this, normalizedArgs$LWS);
6240
+ // istanbul ignore next: behavior will not be tested in collection coverage
6241
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
6242
+ if (isGaterEnabledFeature$LWS('changesSince.256')) {
6243
+ if (isSameOriginURL$LWS(resourceUrl$LWS)) {
6244
+ markForUnsafePropertyBlocking$LWS(childWindow$LWS);
6245
+ }
6246
+ } else {
5978
6247
  markForUnsafePropertyBlocking$LWS(childWindow$LWS);
5979
6248
  }
5980
- } else {
5981
- // When the gate is disabled, mark all child windows
5982
- markForUnsafePropertyBlocking$LWS(childWindow$LWS);
5983
6249
  }
5984
6250
  if (childWindow$LWS) {
5985
6251
  initWindowOpenChildWindow$LWS(childWindow$LWS, resourceUrl$LWS);
@@ -6029,7 +6295,9 @@ function initDistortionDOMParserParseFromString$LWS({
6029
6295
  }) {
6030
6296
  return [originalParseFromString$LWS, function parseFromString$LWS(...args$LWS) {
6031
6297
  const {
6032
- isInherentlyUnsecure: isInherentlyUnsecure$LWS
6298
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
6299
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
6300
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
6033
6301
  } = getValidator$LWS(document$LWS, globalObject$LWS);
6034
6302
  // DOMParser.prototype.parseFromString can only be called with
6035
6303
  // exactly two arguments. If it receives one argument, it will fail.
@@ -6045,8 +6313,12 @@ function initDistortionDOMParserParseFromString$LWS({
6045
6313
  let contentType$LWS;
6046
6314
  switch (mimeType$LWS) {
6047
6315
  case 'application/xhtml+xml':
6316
+ // XHTML is HTML in XML syntax - sanitize as HTML
6317
+ contentType$LWS = ContentType$LWS.XHTML;
6318
+ break;
6048
6319
  case 'application/xml':
6049
6320
  case 'text/xml':
6321
+ // Generic XML is not sanitized (may contain non-HTML tags)
6050
6322
  contentType$LWS = ContentType$LWS.XML;
6051
6323
  break;
6052
6324
  case 'image/svg+xml':
@@ -6055,17 +6327,19 @@ function initDistortionDOMParserParseFromString$LWS({
6055
6327
  default:
6056
6328
  contentType$LWS = ContentType$LWS.HTML;
6057
6329
  }
6330
+ // For XML/XHTML types, check for iframe/script attacks BEFORE sanitization.
6331
+ // This ensures we throw on dangerous content rather than silently removing it.
6332
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (contentType$LWS === ContentType$LWS.XML || contentType$LWS === ContentType$LWS.XHTML)) {
6333
+ if (isIframeSrcdocScriptAttack$LWS(string$LWS) || isXMLEntityAttack$LWS(string$LWS) || isXMLNamespacedScriptAttack$LWS(string$LWS)) {
6334
+ throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
6335
+ }
6336
+ }
6058
6337
  // This must be called to signal to the virtual
6059
6338
  // CustomElementRegistry that the next thing created
6060
6339
  // MAY CONTAIN a custom element, which must be marked for
6061
6340
  // association to this sandbox.
6062
6341
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6063
6342
  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
6343
  // Reassign args with sanitized string
6070
6344
  args$LWS[0] = trustedHtml$LWS;
6071
6345
  // Prevent shapeshifting arg from manipulating the
@@ -6077,7 +6351,7 @@ function initDistortionDOMParserParseFromString$LWS({
6077
6351
  };
6078
6352
  }
6079
6353
  const {
6080
- isSharedElement: isSharedElement$r$LWS,
6354
+ isSharedElement: isSharedElement$B$LWS,
6081
6355
  isAllowedSharedElementChild: isAllowedSharedElementChild$6$LWS
6082
6356
  } = rootValidator$LWS;
6083
6357
  function initDistortionElementAfter$LWS({
@@ -6092,14 +6366,14 @@ function initDistortionElementAfter$LWS({
6092
6366
  }) {
6093
6367
  const distortionEntry$LWS = [originalAfter$LWS, function after$LWS(...args$LWS) {
6094
6368
  // istanbul ignore else: needs default platform behavior test
6095
- if (isSharedElement$r$LWS(this)) {
6369
+ if (isSharedElement$B$LWS(this)) {
6096
6370
  for (let i$LWS = 0, {
6097
6371
  length: length$LWS
6098
6372
  } = args$LWS; i$LWS < length$LWS; i$LWS += 1) {
6099
6373
  const argValue$LWS = args$LWS[i$LWS];
6100
6374
  if (!isAllowedSharedElementChild$6$LWS(argValue$LWS)) {
6101
- const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, argValue$LWS, []) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6102
- throw new LockerSecurityError$LWS(`Cannot insert ${nodeNameOrString$LWS} after ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6375
+ const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? getNodeName$LWS(argValue$LWS) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6376
+ throw new LockerSecurityError$LWS(`Cannot insert ${nodeNameOrString$LWS} after ${getNodeName$LWS(this)}.`);
6103
6377
  }
6104
6378
  }
6105
6379
  }
@@ -6110,7 +6384,7 @@ function initDistortionElementAfter$LWS({
6110
6384
  };
6111
6385
  }
6112
6386
  const {
6113
- isSharedElement: isSharedElement$q$LWS,
6387
+ isSharedElement: isSharedElement$A$LWS,
6114
6388
  isAllowedSharedElementChild: isAllowedSharedElementChild$5$LWS
6115
6389
  } = rootValidator$LWS;
6116
6390
  function initDistortionElementAppend$LWS({
@@ -6125,7 +6399,7 @@ function initDistortionElementAppend$LWS({
6125
6399
  }) {
6126
6400
  const distortionEntry$LWS = [originalAppend$LWS, function append$LWS(...args$LWS) {
6127
6401
  // istanbul ignore else: needs default platform behavior test
6128
- if (isSharedElement$q$LWS(this)) {
6402
+ if (isSharedElement$A$LWS(this)) {
6129
6403
  // Element.prototype.append(...args) accepts an arbitrary number
6130
6404
  // of arguments which can be comprised of Nodes and DOMStrings.
6131
6405
  for (let i$LWS = 0, {
@@ -6136,8 +6410,8 @@ function initDistortionElementAppend$LWS({
6136
6410
  // element child which is limited to script and link, an
6137
6411
  // exception is thrown.
6138
6412
  if (!isAllowedSharedElementChild$5$LWS(argValue$LWS)) {
6139
- const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, argValue$LWS, []) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6140
- throw new LockerSecurityError$LWS(`Cannot append ${nodeNameOrString$LWS} to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6413
+ const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? getNodeName$LWS(argValue$LWS) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6414
+ throw new LockerSecurityError$LWS(`Cannot append ${nodeNameOrString$LWS} to ${getNodeName$LWS(this)}.`);
6141
6415
  }
6142
6416
  }
6143
6417
  }
@@ -6222,7 +6496,7 @@ function initDistortionElementAttributesGetter$LWS({
6222
6496
  };
6223
6497
  }
6224
6498
  const {
6225
- isSharedElement: isSharedElement$p$LWS,
6499
+ isSharedElement: isSharedElement$z$LWS,
6226
6500
  isAllowedSharedElementChild: isAllowedSharedElementChild$4$LWS
6227
6501
  } = rootValidator$LWS;
6228
6502
  function initDistortionElementBefore$LWS({
@@ -6237,15 +6511,15 @@ function initDistortionElementBefore$LWS({
6237
6511
  }) {
6238
6512
  const distortionEntry$LWS = [originalBefore$LWS, function before$LWS(...args$LWS) {
6239
6513
  // istanbul ignore else: needs default platform behavior test
6240
- if (isSharedElement$p$LWS(this)) {
6514
+ if (isSharedElement$z$LWS(this)) {
6241
6515
  for (let i$LWS = 0, {
6242
6516
  length: length$LWS
6243
6517
  } = args$LWS; i$LWS < length$LWS; i$LWS += 1) {
6244
6518
  const argValue$LWS = args$LWS[i$LWS];
6245
6519
  // istanbul ignore else: needs default platform behavior test
6246
6520
  if (!isAllowedSharedElementChild$4$LWS(argValue$LWS)) {
6247
- const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, argValue$LWS, []) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6248
- throw new LockerSecurityError$LWS(`Cannot insert ${nodeNameOrString$LWS} before ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6521
+ const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? getNodeName$LWS(argValue$LWS) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6522
+ throw new LockerSecurityError$LWS(`Cannot insert ${nodeNameOrString$LWS} before ${getNodeName$LWS(this)}.`);
6249
6523
  }
6250
6524
  }
6251
6525
  }
@@ -6255,6 +6529,90 @@ function initDistortionElementBefore$LWS({
6255
6529
  return distortionEntry$LWS;
6256
6530
  };
6257
6531
  }
6532
+ function initDistortionElementGetAttribute$LWS({
6533
+ globalObject: {
6534
+ Element: {
6535
+ prototype: {
6536
+ getAttribute: originalGetAttribute$LWS
6537
+ }
6538
+ }
6539
+ }
6540
+ }) {
6541
+ return function distortionElementGetAttribute$LWS() {
6542
+ return [originalGetAttribute$LWS, function getAttribute$LWS(...args$LWS) {
6543
+ const {
6544
+ length: length$LWS
6545
+ } = args$LWS;
6546
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS > 0) {
6547
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[0])));
6548
+ }
6549
+ return ReflectApply$LWS$1(originalGetAttribute$LWS, this, args$LWS);
6550
+ }];
6551
+ };
6552
+ }
6553
+ function initDistortionElementGetAttributeNode$LWS({
6554
+ globalObject: {
6555
+ Element: {
6556
+ prototype: {
6557
+ getAttributeNode: originalGetAttributeNode$LWS
6558
+ }
6559
+ }
6560
+ }
6561
+ }) {
6562
+ return function distortionElementGetAttributeNode$LWS() {
6563
+ return [originalGetAttributeNode$LWS, function getAttributeNode$LWS(...args$LWS) {
6564
+ const {
6565
+ length: length$LWS
6566
+ } = args$LWS;
6567
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS > 0) {
6568
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[0])));
6569
+ }
6570
+ return ReflectApply$LWS$1(originalGetAttributeNode$LWS, this, args$LWS);
6571
+ }];
6572
+ };
6573
+ }
6574
+ function initDistortionElementGetAttributeNodeNS$LWS({
6575
+ globalObject: {
6576
+ Element: {
6577
+ prototype: {
6578
+ getAttributeNodeNS: originalGetAttributeNodeNS$LWS
6579
+ }
6580
+ }
6581
+ }
6582
+ }) {
6583
+ return function distortionElementGetAttributeNodeNS$LWS() {
6584
+ return [originalGetAttributeNodeNS$LWS, function getAttributeNodeNS$LWS(...args$LWS) {
6585
+ const {
6586
+ length: length$LWS
6587
+ } = args$LWS;
6588
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS >= 2) {
6589
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[1])));
6590
+ }
6591
+ return ReflectApply$LWS$1(originalGetAttributeNodeNS$LWS, this, args$LWS);
6592
+ }];
6593
+ };
6594
+ }
6595
+ function initDistortionElementGetAttributeNS$LWS({
6596
+ globalObject: {
6597
+ Element: {
6598
+ prototype: {
6599
+ getAttributeNS: originalGetAttributeNS$LWS
6600
+ }
6601
+ }
6602
+ }
6603
+ }) {
6604
+ return function distortionElementGetAttributeNS$LWS() {
6605
+ return [originalGetAttributeNS$LWS, function getAttributeNS$LWS(...args$LWS) {
6606
+ const {
6607
+ length: length$LWS
6608
+ } = args$LWS;
6609
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS >= 2) {
6610
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[1])));
6611
+ }
6612
+ return ReflectApply$LWS$1(originalGetAttributeNS$LWS, this, args$LWS);
6613
+ }];
6614
+ };
6615
+ }
6258
6616
 
6259
6617
  // TODO: this has been deprecated and is no longer implemented in any browser
6260
6618
  function initDistortionElementGetInnerHTML$LWS({
@@ -6301,6 +6659,29 @@ function initDistortionElementGetInnerHTML$LWS({
6301
6659
  return distortionEntry$LWS;
6302
6660
  };
6303
6661
  }
6662
+ function initDistortionElementInnerHTMLGetter$LWS({
6663
+ globalObject: globalObject$LWS
6664
+ }) {
6665
+ const {
6666
+ Element: Element$LWS
6667
+ } = globalObject$LWS;
6668
+ const originalInnerHTMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Element$LWS.prototype, 'innerHTML');
6669
+ const distortionEntry$LWS = [originalInnerHTMLGetter$LWS, function innerHTML$LWS() {
6670
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6671
+ var _getOriginalScriptPro$LWS;
6672
+ if (isUnknownScriptElement$LWS(this, globalObject$LWS)) {
6673
+ return '';
6674
+ }
6675
+ // istanbul ignore next: the getOriginalScriptProperty branch is unreachable in integration tests because (1) setting innerHTML on a <script> passes TrustedScript to the native innerHTML setter which rejects it under Trusted Types, and (2) setting a different property then reading innerHTML receives a membrane proxy as `this`, failing the WeakMap identity check in originalScriptPropertyCache
6676
+ return (_getOriginalScriptPro$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro$LWS : removeNoncePatterns$LWS(ReflectApply$LWS$1(originalInnerHTMLGetter$LWS, this, []));
6677
+ }
6678
+ // istanbul ignore next: ungated return is not reachable in coverage runs
6679
+ return ReflectApply$LWS$1(originalInnerHTMLGetter$LWS, this, []);
6680
+ }];
6681
+ return function distortionElementInnerHTMLGetter$LWS() {
6682
+ return distortionEntry$LWS;
6683
+ };
6684
+ }
6304
6685
  function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTrustedString$LWS, originalScriptPropertyGetter$LWS, originalScriptPropertySetter$LWS, distortions$LWS, sandboxEvaluator$LWS, signedScriptHookSourceText$LWS) {
6305
6686
  const valueAsString$LWS = toSafeStringValue$LWS(valueAsTrustedString$LWS);
6306
6687
  if (!isScriptPropertyEvaluatorHookDefined$LWS(incomingThis$LWS)) {
@@ -6332,8 +6713,8 @@ function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTruste
6332
6713
  return false;
6333
6714
  }
6334
6715
  const {
6335
- isInherentlyUnsecure: isInherentlyUnsecure$4$LWS,
6336
- isSharedElement: isSharedElement$o$LWS
6716
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$6$LWS,
6717
+ isSharedElement: isSharedElement$y$LWS
6337
6718
  } = rootValidator$LWS;
6338
6719
  function initDistortionElementInnerHTMLSetter$LWS({
6339
6720
  document: document$LWS,
@@ -6357,10 +6738,16 @@ function initDistortionElementInnerHTMLSetter$LWS({
6357
6738
  }) {
6358
6739
  return [originalInnerHTMLSetter$LWS, function innerHTML$LWS(value$LWS) {
6359
6740
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6360
- if (!isOwnerXMLDocument$LWS) {
6741
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
6742
+ // even when inside an XMLDocument, so they must always be sanitized.
6743
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
6744
+ // Sanitize if:
6745
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
6746
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
6747
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6361
6748
  // istanbul ignore else: needs default platform behavior test
6362
- if (isSharedElement$o$LWS(this)) {
6363
- throw new LockerSecurityError$LWS(`Cannot set innerHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6749
+ if (isSharedElement$y$LWS(this)) {
6750
+ throw new LockerSecurityError$LWS(`Cannot set innerHTML of ${getNodeName$LWS(this)}.`);
6364
6751
  }
6365
6752
  if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement) {
6366
6753
  const scriptWasNotEvaluatedInScriptPropertySetter$LWS = scriptPropertySetters$LWS(this, 'innerHTML', trusted.createScript(value$LWS), originalInnerHTMLGetter$LWS, originalInnerHTMLSetter$LWS, distortions$LWS, sandboxEvaluator$LWS, trusted.createScript(SCRIPT_HOOK_SOURCE_TEXT$LWS));
@@ -6373,10 +6760,15 @@ function initDistortionElementInnerHTMLSetter$LWS({
6373
6760
  // MAY CONTAIN a custom element, which must be marked for
6374
6761
  // association to this sandbox.
6375
6762
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6376
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6763
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6377
6764
  value$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, contentType$LWS);
6765
+ } else {
6766
+ // XMLDocument-owned elements skip createHTML above. Coerce once before checks and
6767
+ // the native setter so a mutating toString cannot present '' to our guards and
6768
+ // malicious markup on a later engine coercion (see toSafeStringValue() docs).
6769
+ value$LWS = toSafeStringValue$LWS(value$LWS);
6378
6770
  }
6379
- if (isInherentlyUnsecure$4$LWS(value$LWS)) {
6771
+ if (isIframeSrcdocScriptAttack$6$LWS(value$LWS)) {
6380
6772
  throw new LockerSecurityError$LWS(`Cannot set 'innerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6381
6773
  }
6382
6774
  ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [value$LWS]);
@@ -6384,7 +6776,7 @@ function initDistortionElementInnerHTMLSetter$LWS({
6384
6776
  };
6385
6777
  }
6386
6778
  const {
6387
- isSharedElement: isSharedElement$n$LWS,
6779
+ isSharedElement: isSharedElement$x$LWS,
6388
6780
  isAllowedSharedElementChild: isAllowedSharedElementChild$3$LWS
6389
6781
  } = rootValidator$LWS;
6390
6782
  function initDistortionElementInsertAdjacentElement$LWS({
@@ -6403,8 +6795,8 @@ function initDistortionElementInsertAdjacentElement$LWS({
6403
6795
  1: element$LWS
6404
6796
  } = args$LWS;
6405
6797
  // istanbul ignore else: needs default platform behavior test
6406
- if (isSharedElement$n$LWS(this) && !isAllowedSharedElementChild$3$LWS(element$LWS)) {
6407
- throw new LockerSecurityError$LWS(`Cannot insert ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, element$LWS, [])} adjacent to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6798
+ if (isSharedElement$x$LWS(this) && !isAllowedSharedElementChild$3$LWS(element$LWS)) {
6799
+ throw new LockerSecurityError$LWS(`Cannot insert ${getNodeName$LWS(element$LWS)} adjacent to ${getNodeName$LWS(this)}.`);
6408
6800
  }
6409
6801
  }
6410
6802
  return ReflectApply$LWS$1(originalInsertAdjacentElement$LWS, this, args$LWS);
@@ -6414,8 +6806,8 @@ function initDistortionElementInsertAdjacentElement$LWS({
6414
6806
  };
6415
6807
  }
6416
6808
  const {
6417
- isInherentlyUnsecure: isInherentlyUnsecure$3$LWS,
6418
- isSharedElement: isSharedElement$m$LWS
6809
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$5$LWS,
6810
+ isSharedElement: isSharedElement$w$LWS
6419
6811
  } = rootValidator$LWS;
6420
6812
  const allowedElementHTMLRegExp$LWS = /^\s*<(link|script|style)/i;
6421
6813
  function initDistortionElementInsertAdjacentHTML$LWS({
@@ -6435,8 +6827,8 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6435
6827
  // istanbul ignore else: needs default platform behavior test
6436
6828
  if (args$LWS.length > 1) {
6437
6829
  const match$LWS = ReflectApply$LWS$1(StringProtoMatch$LWS, args$LWS[1], [allowedElementHTMLRegExp$LWS]);
6438
- if (isSharedElement$m$LWS(this) && match$LWS === null) {
6439
- throw new LockerSecurityError$LWS(`Cannot insert adjacent HTML to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}`);
6830
+ if (isSharedElement$w$LWS(this) && match$LWS === null) {
6831
+ throw new LockerSecurityError$LWS(`Cannot insert adjacent HTML to ${getNodeName$LWS(this)}`);
6440
6832
  }
6441
6833
  // This must be called to signal to the virtual
6442
6834
  // CustomElementRegistry that the next thing created
@@ -6446,7 +6838,7 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6446
6838
  const contentType$LWS = this instanceof SVGElement ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6447
6839
  args$LWS[1] = lwsInternalPolicy$LWS.createHTML(args$LWS[1], key$LWS, contentType$LWS);
6448
6840
  // If the sanitized string is still insecure, throw an exception
6449
- if (isInherentlyUnsecure$3$LWS(args$LWS[1])) {
6841
+ if (isIframeSrcdocScriptAttack$5$LWS(args$LWS[1])) {
6450
6842
  throw new LockerSecurityError$LWS(`Cannot set 'insertAdjacentHTML' using an unsecure ${toSafeTemplateStringValue$LWS(args$LWS[1])}.`);
6451
6843
  }
6452
6844
  }
@@ -6454,9 +6846,27 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6454
6846
  }];
6455
6847
  };
6456
6848
  }
6849
+ function initDistortionElementOuterHTMLGetter$LWS({
6850
+ globalObject: {
6851
+ Element: Element$LWS
6852
+ }
6853
+ }) {
6854
+ const originalOuterHTMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Element$LWS.prototype, 'outerHTML');
6855
+ const distortionEntry$LWS = [originalOuterHTMLGetter$LWS, function outerHTML$LWS() {
6856
+ const html$LWS = ReflectApply$LWS$1(originalOuterHTMLGetter$LWS, this, []);
6857
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6858
+ return removeNoncePatterns$LWS(html$LWS);
6859
+ }
6860
+ // istanbul ignore next: ungated return is not reachable in coverage runs
6861
+ return html$LWS;
6862
+ }];
6863
+ return function distortionElementOuterHTMLGetter$LWS() {
6864
+ return distortionEntry$LWS;
6865
+ };
6866
+ }
6457
6867
  const {
6458
- isInherentlyUnsecure: isInherentlyUnsecure$2$LWS,
6459
- isSharedElement: isSharedElement$l$LWS
6868
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$4$LWS,
6869
+ isSharedElement: isSharedElement$v$LWS
6460
6870
  } = rootValidator$LWS;
6461
6871
  function initDistortionElementOuterHTMLSetter$LWS({
6462
6872
  document: document$LWS,
@@ -6470,8 +6880,8 @@ function initDistortionElementOuterHTMLSetter$LWS({
6470
6880
  }) {
6471
6881
  return [originalOuterHTMLSetter$LWS, function outerHTML$LWS(value$LWS) {
6472
6882
  // istanbul ignore else: needs default platform behavior test
6473
- if (isSharedElement$l$LWS(this)) {
6474
- throw new LockerSecurityError$LWS(`Cannot set outerHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6883
+ if (isSharedElement$v$LWS(this)) {
6884
+ throw new LockerSecurityError$LWS(`Cannot set outerHTML of ${getNodeName$LWS(this)}.`);
6475
6885
  }
6476
6886
  // This must be called to signal to the virtual
6477
6887
  // CustomElementRegistry that the next thing created
@@ -6481,7 +6891,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6481
6891
  const html$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML);
6482
6892
  // Ensure that the created html snippet is secure (no mXSS)
6483
6893
  if (isGaterEnabledFeature$LWS('changesSince.260')) {
6484
- if (isInherentlyUnsecure$2$LWS(html$LWS)) {
6894
+ if (isIframeSrcdocScriptAttack$4$LWS(html$LWS)) {
6485
6895
  throw new LockerSecurityError$LWS(`Cannot set 'outerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6486
6896
  }
6487
6897
  }
@@ -6490,7 +6900,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6490
6900
  };
6491
6901
  }
6492
6902
  const {
6493
- isSharedElement: isSharedElement$k$LWS,
6903
+ isSharedElement: isSharedElement$u$LWS,
6494
6904
  isAllowedSharedElementChild: isAllowedSharedElementChild$2$LWS
6495
6905
  } = rootValidator$LWS;
6496
6906
  function initDistortionElementPrepend$LWS({
@@ -6505,7 +6915,7 @@ function initDistortionElementPrepend$LWS({
6505
6915
  }) {
6506
6916
  const distortionEntry$LWS = [originalPrepend$LWS, function prepend$LWS(...args$LWS) {
6507
6917
  // istanbul ignore else: needs default platform behavior test
6508
- if (isSharedElement$k$LWS(this)) {
6918
+ if (isSharedElement$u$LWS(this)) {
6509
6919
  // Element.prototype.prepend(...args) accepts an arbitrary
6510
6920
  // number of arguments which can be comprised of Nodes and
6511
6921
  // DOMStrings.
@@ -6517,8 +6927,8 @@ function initDistortionElementPrepend$LWS({
6517
6927
  // element child, which is limited to script and link, an
6518
6928
  // exception is thrown.
6519
6929
  if (!isAllowedSharedElementChild$2$LWS(argValue$LWS)) {
6520
- const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, argValue$LWS, []) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6521
- throw new LockerSecurityError$LWS(`Cannot prepend ${nodeNameOrString$LWS} to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6930
+ const nodeNameOrString$LWS = argValue$LWS instanceof Node$LWS ? getNodeName$LWS(argValue$LWS) : /* istanbul ignore next: currently unreachable via tests */toSafeStringValue$LWS(argValue$LWS);
6931
+ throw new LockerSecurityError$LWS(`Cannot prepend ${nodeNameOrString$LWS} to ${getNodeName$LWS(this)}.`);
6522
6932
  }
6523
6933
  }
6524
6934
  }
@@ -6529,7 +6939,7 @@ function initDistortionElementPrepend$LWS({
6529
6939
  };
6530
6940
  }
6531
6941
  const {
6532
- isSharedElement: isSharedElement$j$LWS
6942
+ isSharedElement: isSharedElement$t$LWS
6533
6943
  } = rootValidator$LWS;
6534
6944
  function initDistortionElementRemove$LWS({
6535
6945
  globalObject: {
@@ -6542,8 +6952,8 @@ function initDistortionElementRemove$LWS({
6542
6952
  }) {
6543
6953
  const distortionEntry$LWS = [originalRemove$LWS, function remove$LWS() {
6544
6954
  // istanbul ignore else: needs default platform behavior test
6545
- if (isSharedElement$j$LWS(this)) {
6546
- throw new LockerSecurityError$LWS(`Cannot remove ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6955
+ if (isSharedElement$t$LWS(this)) {
6956
+ throw new LockerSecurityError$LWS(`Cannot remove ${getNodeName$LWS(this)}.`);
6547
6957
  }
6548
6958
  ReflectApply$LWS$1(originalRemove$LWS, this, []);
6549
6959
  }];
@@ -6552,7 +6962,7 @@ function initDistortionElementRemove$LWS({
6552
6962
  };
6553
6963
  }
6554
6964
  const {
6555
- isSharedElement: isSharedElement$i$LWS
6965
+ isSharedElement: isSharedElement$s$LWS
6556
6966
  } = rootValidator$LWS;
6557
6967
  function initDistortionElementReplaceChildren$LWS({
6558
6968
  globalObject: {
@@ -6565,8 +6975,8 @@ function initDistortionElementReplaceChildren$LWS({
6565
6975
  }) {
6566
6976
  const distortionEntry$LWS = [originalReplaceChildren$LWS, function replaceChildren$LWS(...args$LWS) {
6567
6977
  // istanbul ignore else: needs default platform behavior test
6568
- if (isSharedElement$i$LWS(this)) {
6569
- throw new LockerSecurityError$LWS(`Cannot replace children of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6978
+ if (isSharedElement$s$LWS(this)) {
6979
+ throw new LockerSecurityError$LWS(`Cannot replace children of ${getNodeName$LWS(this)}.`);
6570
6980
  }
6571
6981
  return ReflectApply$LWS$1(originalReplaceChildren$LWS, this, args$LWS);
6572
6982
  }];
@@ -6575,7 +6985,7 @@ function initDistortionElementReplaceChildren$LWS({
6575
6985
  };
6576
6986
  }
6577
6987
  const {
6578
- isSharedElement: isSharedElement$h$LWS
6988
+ isSharedElement: isSharedElement$r$LWS
6579
6989
  } = rootValidator$LWS;
6580
6990
  function initDistortionElementReplaceWith$LWS({
6581
6991
  globalObject: {
@@ -6588,8 +6998,8 @@ function initDistortionElementReplaceWith$LWS({
6588
6998
  }) {
6589
6999
  const distortionEntry$LWS = [originalReplaceWith$LWS, function replaceWith$LWS(...args$LWS) {
6590
7000
  // istanbul ignore else: needs default platform behavior test
6591
- if (isSharedElement$h$LWS(this)) {
6592
- throw new LockerSecurityError$LWS(`Cannot replace ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7001
+ if (isSharedElement$r$LWS(this)) {
7002
+ throw new LockerSecurityError$LWS(`Cannot replace ${getNodeName$LWS(this)}.`);
6593
7003
  }
6594
7004
  return ReflectApply$LWS$1(originalReplaceWith$LWS, this, args$LWS);
6595
7005
  }];
@@ -6794,8 +7204,8 @@ function initDistortionElementSetAttributeNS$LWS({
6794
7204
  };
6795
7205
  }
6796
7206
  const {
6797
- isInherentlyUnsecure: isInherentlyUnsecure$1$LWS,
6798
- isSharedElement: isSharedElement$g$LWS
7207
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$3$LWS,
7208
+ isSharedElement: isSharedElement$q$LWS
6799
7209
  } = rootValidator$LWS;
6800
7210
  function initDistortionElementSetHTML$LWS({
6801
7211
  document: document$LWS,
@@ -6809,21 +7219,26 @@ function initDistortionElementSetHTML$LWS({
6809
7219
  XMLDocument: XMLDocument$LWS
6810
7220
  }
6811
7221
  }) {
7222
+ // istanbul ignore if: setHTML is always available in coverage environments
6812
7223
  if (typeof originalSetHTML$LWS !== 'function') {
6813
- // istanbul ignore next: only runs in browsers without property
6814
7224
  return noop$LWS$1;
6815
7225
  }
6816
- // istanbul ignore next: Element.prototype.setHTML is not supported in any browser yet
6817
7226
  return function distortionElementSetHTML$LWS({
6818
7227
  key: key$LWS
6819
7228
  }) {
6820
7229
  return [originalSetHTML$LWS, function setHTML$LWS(...args$LWS) {
6821
7230
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6822
- if (!isOwnerXMLDocument$LWS) {
7231
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
7232
+ // even when inside an XMLDocument, so they must always be sanitized.
7233
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
7234
+ // Sanitize if:
7235
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
7236
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
7237
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6823
7238
  const normalizedValue$LWS = toSafeStringValue$LWS(args$LWS[0]);
6824
7239
  // istanbul ignore else: needs default platform behavior test
6825
- if (isSharedElement$g$LWS(this)) {
6826
- throw new LockerSecurityError$LWS(`Cannot setHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7240
+ if (isSharedElement$q$LWS(this)) {
7241
+ throw new LockerSecurityError$LWS(`Cannot setHTML of ${getNodeName$LWS(this)}.`);
6827
7242
  }
6828
7243
  // This must be called to signal to the virtual
6829
7244
  // CustomElementRegistry that the next thing created
@@ -6832,9 +7247,9 @@ function initDistortionElementSetHTML$LWS({
6832
7247
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6833
7248
  // If options not specified, the default Sanitizer object is used.
6834
7249
  // This will be in addition to the sanitization we have.
6835
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7250
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6836
7251
  args$LWS[0] = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
6837
- if (isInherentlyUnsecure$1$LWS(args$LWS[0])) {
7252
+ if (isIframeSrcdocScriptAttack$3$LWS(args$LWS[0])) {
6838
7253
  throw new LockerSecurityError$LWS(`Cannot 'setHTML' using an unsecure ${toSafeTemplateStringValue$LWS(args$LWS[0])}.`);
6839
7254
  }
6840
7255
  }
@@ -6843,8 +7258,8 @@ function initDistortionElementSetHTML$LWS({
6843
7258
  };
6844
7259
  }
6845
7260
  const {
6846
- isInherentlyUnsecure: isInherentlyUnsecure$LWS,
6847
- isSharedElement: isSharedElement$f$LWS
7261
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$2$LWS,
7262
+ isSharedElement: isSharedElement$p$LWS
6848
7263
  } = rootValidator$LWS;
6849
7264
  function initDistortionElementSetHTMLUnsafe$LWS({
6850
7265
  document: document$LWS,
@@ -6863,7 +7278,7 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6863
7278
  distortions: distortions$LWS
6864
7279
  }
6865
7280
  }) {
6866
- // istanbul ignore if: currently unreachable via tests
7281
+ // istanbul ignore if: setHTMLUnsafe is always available in coverage environments
6867
7282
  if (typeof originalSetHTMLUnsafe$LWS !== 'function') {
6868
7283
  return noop$LWS$1;
6869
7284
  }
@@ -6878,10 +7293,16 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6878
7293
  return [originalSetHTMLUnsafe$LWS, function setHTMLUnsafe$LWS(value$LWS) {
6879
7294
  let normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
6880
7295
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6881
- if (!isOwnerXMLDocument$LWS) {
7296
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
7297
+ // even when inside an XMLDocument, so they must always be sanitized.
7298
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
7299
+ // Sanitize if:
7300
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
7301
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
7302
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6882
7303
  // istanbul ignore else: needs default platform behavior test
6883
- if (isSharedElement$f$LWS(this)) {
6884
- throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7304
+ if (isSharedElement$p$LWS(this)) {
7305
+ throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' of ${getNodeName$LWS(this)}.`);
6885
7306
  }
6886
7307
  // This is necessary to support script.setHTMLUnsafe(...)
6887
7308
  if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement) {
@@ -6895,10 +7316,10 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6895
7316
  // MAY CONTAIN a custom element, which must be marked for
6896
7317
  // association to this sandbox.
6897
7318
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6898
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7319
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6899
7320
  normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
6900
7321
  }
6901
- if (isInherentlyUnsecure$LWS(normalizedValue$LWS)) {
7322
+ if (isIframeSrcdocScriptAttack$2$LWS(normalizedValue$LWS)) {
6902
7323
  throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
6903
7324
  }
6904
7325
  ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
@@ -6976,7 +7397,10 @@ function initDistortionEval$LWS({
6976
7397
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
6977
7398
  }) {
6978
7399
  return [originalEval$LWS, function (sourceText$LWS) {
6979
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'eval');
7400
+ // istanbul ignore next: behavior will not be tested in collection coverage
7401
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
7402
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'eval');
7403
+ }
6980
7404
  return sandboxEvaluator$LWS(transformSourceText$LWS(toSafeStringValue$LWS(sourceText$LWS)), UNCOMPILED_CONTEXT$LWS);
6981
7405
  }];
6982
7406
  };
@@ -7084,7 +7508,10 @@ function initDistortionFunction$LWS({
7084
7508
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
7085
7509
  }) {
7086
7510
  return [originalFunction$LWS, function Function$LWS(...args$LWS) {
7087
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'Function');
7511
+ // istanbul ignore next: behavior will not be tested in collection coverage
7512
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
7513
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'Function');
7514
+ }
7088
7515
  // The `arguments` object has `Symbol.iterator` as an own
7089
7516
  // property, not inherited, so it avoids prototype pollution
7090
7517
  // attacks.
@@ -7168,6 +7595,53 @@ function initDistortionHistoryReplaceState$LWS({
7168
7595
  return distortionEntry$LWS;
7169
7596
  };
7170
7597
  }
7598
+
7599
+ // Anchor elements allow blob: URLs in addition to standard schemes for download links
7600
+ const ANCHOR_URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['about:', 'blob:', 'http:', 'https:']);
7601
+ function isValidAnchorURLScheme$LWS(url$LWS) {
7602
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
7603
+ return ANCHOR_URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
7604
+ }
7605
+ function initDistortionHTMLAnchorElementHrefSetter$LWS({
7606
+ globalObject: {
7607
+ HTMLAnchorElement: HTMLAnchorElement$LWS
7608
+ }
7609
+ }) {
7610
+ const originalHrefSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLAnchorElement$LWS.prototype, 'href');
7611
+ function href$LWS(value$LWS) {
7612
+ const urlString$LWS = sanitizeURLForElement$LWS(value$LWS);
7613
+ if (isGaterEnabledFeature$LWS('changesSince.262') && !isValidAnchorURLScheme$LWS(urlString$LWS)) {
7614
+ throw new LockerSecurityError$LWS('HTMLAnchorElement.href supports http://, https://, blob: schemes, relative urls and about:blank.');
7615
+ }
7616
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, this, [urlString$LWS]);
7617
+ }
7618
+ const distortionEntry$LWS = [originalHrefSetter$LWS, href$LWS];
7619
+ return function distortionHTMLAnchorElementHrefSetter$LWS(record$LWS) {
7620
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7621
+ registerAttributeDistortion$LWS(record$LWS, HTMLAnchorElement$LWS, 'href', NAMESPACE_DEFAULT$LWS, href$LWS);
7622
+ }
7623
+ // This will fall back to the original href setter if the gate is not enabled
7624
+ return distortionEntry$LWS;
7625
+ };
7626
+ }
7627
+ function initDistortionHTMLBaseElementHrefSetter$LWS({
7628
+ globalObject: {
7629
+ HTMLBaseElement: HTMLBaseElement$LWS
7630
+ }
7631
+ }) {
7632
+ const originalHrefSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLBaseElement$LWS.prototype, 'href');
7633
+ function href$LWS(...args$LWS) {
7634
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7635
+ throw new LockerSecurityError$LWS('Cannot set HTMLBaseElement.href.');
7636
+ }
7637
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7638
+ return ReflectApply$LWS$1(originalHrefSetter$LWS, this, args$LWS);
7639
+ }
7640
+ const distortionEntry$LWS = [originalHrefSetter$LWS, href$LWS];
7641
+ return function distortionHTMLBaseElementHrefSetter$LWS() {
7642
+ return distortionEntry$LWS;
7643
+ };
7644
+ }
7171
7645
  function initDistortionHTMLBodyElementOnrejectionhandled$LWS({
7172
7646
  globalObject: {
7173
7647
  HTMLBodyElement: HTMLBodyElement$LWS
@@ -7189,6 +7663,36 @@ function initDistortionHTMLBodyElementOnunhandledrejection$LWS({
7189
7663
  }) {
7190
7664
  return createEventDistortionFactory$LWS(HTMLBodyElement$LWS.prototype, HTMLBodyElement$LWS, 'unhandledrejection');
7191
7665
  }
7666
+ function initDistortionHTMLButtonElementFormActionSetter$LWS({
7667
+ globalObject: {
7668
+ HTMLButtonElement: HTMLButtonElement$LWS
7669
+ }
7670
+ }) {
7671
+ const originalFormActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLButtonElement$LWS.prototype, 'formAction');
7672
+ return function distortionHTMLButtonElementFormActionSetter$LWS(record$LWS) {
7673
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7674
+ function formAction$LWS(value$LWS) {
7675
+ const normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
7676
+ let urlString$LWS = '';
7677
+ if (normalizedValue$LWS !== '') {
7678
+ const parsedURL$LWS = parseURL$LWS(normalizedValue$LWS);
7679
+ const {
7680
+ normalizedURL: normalizedURL$LWS
7681
+ } = parsedURL$LWS;
7682
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7683
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
7684
+ }
7685
+ urlString$LWS = normalizedURL$LWS;
7686
+ }
7687
+ ReflectApply$LWS$1(HTMLButtonElementProtoFormActionSetter$LWS, this, [urlString$LWS]);
7688
+ }
7689
+ registerAttributeDistortion$LWS(record$LWS, HTMLButtonElement$LWS, 'formaction', NAMESPACE_DEFAULT$LWS, formAction$LWS);
7690
+ return [originalFormActionSetter$LWS, formAction$LWS];
7691
+ }
7692
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7693
+ return [originalFormActionSetter$LWS, originalFormActionSetter$LWS];
7694
+ };
7695
+ }
7192
7696
  function initDistortionHTMLElementCtor$LWS({
7193
7697
  document: document$LWS,
7194
7698
  globalObject: {
@@ -7228,28 +7732,65 @@ function initDistortionHTMLElementDatasetGetter$LWS({
7228
7732
  return distortionEntry$LWS;
7229
7733
  };
7230
7734
  }
7231
- const {
7232
- isSharedElement: isSharedElement$e$LWS
7233
- } = rootValidator$LWS;
7234
- function initDistortionHTMLElementInnerTextSetter$LWS({
7235
- globalObject: {
7735
+ function initDistortionHTMLElementInnerTextGetter$LWS({
7736
+ globalObject: globalObject$LWS
7737
+ }) {
7738
+ const {
7236
7739
  HTMLElement: HTMLElement$LWS
7740
+ } = globalObject$LWS;
7741
+ const originalInnerTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLElement$LWS.prototype, 'innerText');
7742
+ // istanbul ignore if: currently unreachable via tests
7743
+ if (typeof originalInnerTextGetter$LWS !== 'function') {
7744
+ return noop$LWS$1;
7745
+ }
7746
+ const distortionEntry$LWS = [originalInnerTextGetter$LWS, function innerText$LWS() {
7747
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
7748
+ return '';
7749
+ }
7750
+ return ReflectApply$LWS$1(originalInnerTextGetter$LWS, this, []);
7751
+ }];
7752
+ return function distortionHTMLElementInnerTextGetter$LWS() {
7753
+ return distortionEntry$LWS;
7754
+ };
7755
+ }
7756
+ const {
7757
+ isSharedElement: isSharedElement$o$LWS
7758
+ } = rootValidator$LWS;
7759
+ function initDistortionHTMLElementInnerTextSetter$LWS({
7760
+ globalObject: globalObject$LWS,
7761
+ root: {
7762
+ distortions: distortions$LWS
7237
7763
  }
7238
7764
  }) {
7765
+ const {
7766
+ HTMLElement: HTMLElement$LWS,
7767
+ HTMLScriptElement: HTMLScriptElement$LWS
7768
+ } = globalObject$LWS;
7769
+ const originalInnerTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLElement$LWS.prototype, 'innerText');
7239
7770
  const originalInnerTextSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLElement$LWS.prototype, 'innerText');
7240
7771
  // istanbul ignore if: currently unreachable via tests
7241
7772
  if (typeof originalInnerTextSetter$LWS !== 'function') {
7242
7773
  return noop$LWS$1;
7243
7774
  }
7244
- const distortionEntry$LWS = [originalInnerTextSetter$LWS, function innerText$LWS(value$LWS) {
7245
- // istanbul ignore else: needs default platform behavior test
7246
- if (isSharedElement$e$LWS(this)) {
7247
- throw new LockerSecurityError$LWS(`Cannot set innerText of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7248
- }
7249
- ReflectApply$LWS$1(originalInnerTextSetter$LWS, this, [value$LWS]);
7250
- }];
7251
- return function distortionHTMLElementInnerTextSetter$LWS() {
7252
- return distortionEntry$LWS;
7775
+ return function distortionHTMLElementInnerTextSetter$LWS(record$LWS) {
7776
+ const {
7777
+ sandboxEvaluator: sandboxEvaluator$LWS
7778
+ } = record$LWS;
7779
+ return [originalInnerTextSetter$LWS, function innerText$LWS(value$LWS) {
7780
+ if (isSharedElement$o$LWS(this)) {
7781
+ throw new LockerSecurityError$LWS(`Cannot set innerText of ${getNodeName$LWS(this)}.`);
7782
+ }
7783
+ if (isGaterEnabledFeature$LWS('changesSince.264') && this instanceof HTMLScriptElement$LWS) {
7784
+ const valueAsString$LWS = trusted.createScript(value$LWS);
7785
+ const scriptWasNotEvaluatedInScriptPropertySetter$LWS = scriptPropertySetters$LWS(this, 'innerText', valueAsString$LWS, originalInnerTextGetter$LWS, originalInnerTextSetter$LWS, distortions$LWS, sandboxEvaluator$LWS, trusted.createScript(SCRIPT_HOOK_SOURCE_TEXT$LWS));
7786
+ if (scriptWasNotEvaluatedInScriptPropertySetter$LWS) {
7787
+ return;
7788
+ }
7789
+ ReflectApply$LWS$1(originalInnerTextSetter$LWS, this, [valueAsString$LWS]);
7790
+ return;
7791
+ }
7792
+ ReflectApply$LWS$1(originalInnerTextSetter$LWS, this, [value$LWS]);
7793
+ }];
7253
7794
  };
7254
7795
  }
7255
7796
  function initDistortionHTMLElementOnsecuritypolicyviolation$LWS({
@@ -7263,7 +7804,7 @@ function initDistortionHTMLElementOnsecuritypolicyviolation$LWS({
7263
7804
  return createEventDistortionFactory$LWS(HTMLElementProto$LWS, HTMLElement$LWS, 'securitypolicyviolation');
7264
7805
  }
7265
7806
  const {
7266
- isSharedElement: isSharedElement$d$LWS
7807
+ isSharedElement: isSharedElement$n$LWS
7267
7808
  } = rootValidator$LWS;
7268
7809
  // The outerText property is non-standard, so the descriptor could be undefined,
7269
7810
  // like in the case of Firefox.
@@ -7279,9 +7820,8 @@ function initDistortionHTMLElementOuterTextSetter$LWS({
7279
7820
  return noop$LWS$1;
7280
7821
  }
7281
7822
  const distortionEntry$LWS = [originalOuterTextSetter$LWS, function outerText$LWS(value$LWS) {
7282
- // istanbul ignore else: needs default platform behavior test
7283
- if (isSharedElement$d$LWS(this)) {
7284
- throw new LockerSecurityError$LWS(`Cannot set outerText of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7823
+ if (isSharedElement$n$LWS(this)) {
7824
+ throw new LockerSecurityError$LWS(`Cannot set outerText of ${getNodeName$LWS(this)}.`);
7285
7825
  }
7286
7826
  ReflectApply$LWS$1(originalOuterTextSetter$LWS, this, [value$LWS]);
7287
7827
  }];
@@ -7302,6 +7842,36 @@ function initDistortionHTMLElementStyleGetter$LWS({
7302
7842
  return distortionEntry$LWS;
7303
7843
  };
7304
7844
  }
7845
+ function initDistortionHTMLFormElementActionSetter$LWS({
7846
+ globalObject: {
7847
+ HTMLFormElement: HTMLFormElement$LWS
7848
+ }
7849
+ }) {
7850
+ const originalActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLFormElement$LWS.prototype, 'action');
7851
+ return function distortionHTMLFormElementActionSetter$LWS(record$LWS) {
7852
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7853
+ function action$LWS(value$LWS) {
7854
+ const normalizedActionValue$LWS = toSafeStringValue$LWS(value$LWS);
7855
+ let urlString$LWS = '';
7856
+ if (normalizedActionValue$LWS !== '') {
7857
+ const parsedURL$LWS = parseURL$LWS(normalizedActionValue$LWS);
7858
+ const {
7859
+ normalizedURL: normalizedURL$LWS
7860
+ } = parsedURL$LWS;
7861
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7862
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
7863
+ }
7864
+ urlString$LWS = normalizedURL$LWS;
7865
+ }
7866
+ ReflectApply$LWS$1(HTMLFormElementProtoActionSetter$LWS, this, [urlString$LWS]);
7867
+ }
7868
+ registerAttributeDistortion$LWS(record$LWS, HTMLFormElement$LWS, 'action', NAMESPACE_DEFAULT$LWS, action$LWS);
7869
+ return [originalActionSetter$LWS, action$LWS];
7870
+ }
7871
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7872
+ return [originalActionSetter$LWS, originalActionSetter$LWS];
7873
+ };
7874
+ }
7305
7875
  function initDistortionHTMLFrameSetElementOnrejectionhandled$LWS({
7306
7876
  globalObject: {
7307
7877
  HTMLFrameSetElement: HTMLFrameSetElement$LWS
@@ -7431,6 +8001,13 @@ function initDistortionHTMLIFrameElementSrcSetter$LWS({
7431
8001
  return function distortionHTMLIFrameElementSrcSetter$LWS(record$LWS) {
7432
8002
  function src$LWS(value$LWS) {
7433
8003
  const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
8004
+ // This must be done on the raw value before sanitization, because sanitization can
8005
+ // remove the exploit pattern.
8006
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8007
+ if (isAttemptingToExploitURL$LWS(normalizedSrcValue$LWS)) {
8008
+ throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(normalizedSrcValue$LWS)}"`);
8009
+ }
8010
+ }
7434
8011
  // If the string being set to iframe.src is not an empty string, sanitize it for assignment
7435
8012
  // to iframe.src. If it is an empty string, let it be and proceed.
7436
8013
  // Otherwise, take no action.
@@ -7440,7 +8017,7 @@ function initDistortionHTMLIFrameElementSrcSetter$LWS({
7440
8017
  }
7441
8018
  if (isGaterEnabledFeature$LWS('changesSince.258')) {
7442
8019
  const parsedURL$LWS = parseURL$LWS(urlString$LWS);
7443
- if (!isValidURL$LWS(parsedURL$LWS)) {
8020
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7444
8021
  const {
7445
8022
  normalizedURL: normalizedURL$LWS
7446
8023
  } = parsedURL$LWS;
@@ -7473,6 +8050,36 @@ function initDistortionHTMLIFrameElementSandboxSetter$LWS({
7473
8050
  return [originalSandboxSetter$LWS, sandbox$LWS];
7474
8051
  };
7475
8052
  }
8053
+ function initDistortionHTMLInputElementFormActionSetter$LWS({
8054
+ globalObject: {
8055
+ HTMLInputElement: HTMLInputElement$LWS
8056
+ }
8057
+ }) {
8058
+ const originalFormActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLInputElement$LWS.prototype, 'formAction');
8059
+ return function distortionHTMLInputElementFormActionSetter$LWS(record$LWS) {
8060
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8061
+ function formAction$LWS(value$LWS) {
8062
+ const normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
8063
+ let urlString$LWS = '';
8064
+ if (normalizedValue$LWS !== '') {
8065
+ const parsedURL$LWS = parseURL$LWS(normalizedValue$LWS);
8066
+ const {
8067
+ normalizedURL: normalizedURL$LWS
8068
+ } = parsedURL$LWS;
8069
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
8070
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
8071
+ }
8072
+ urlString$LWS = normalizedURL$LWS;
8073
+ }
8074
+ ReflectApply$LWS$1(HTMLInputElementProtoFormActionSetter$LWS, this, [urlString$LWS]);
8075
+ }
8076
+ registerAttributeDistortion$LWS(record$LWS, HTMLInputElement$LWS, 'formaction', NAMESPACE_DEFAULT$LWS, formAction$LWS);
8077
+ return [originalFormActionSetter$LWS, formAction$LWS];
8078
+ }
8079
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8080
+ return [originalFormActionSetter$LWS, originalFormActionSetter$LWS];
8081
+ };
8082
+ }
7476
8083
  const importRegExp$LWS = /import/i;
7477
8084
  const WARN_MESSAGE$LWS = 'Lightning Web Security: HTMLLinkElement does not allow setting "rel" property to "import" value.';
7478
8085
  function isValidRelValue$LWS(value$LWS) {
@@ -7517,6 +8124,24 @@ function initDistortionHTMLLinkElementRelListSetter$LWS({
7517
8124
  return distortionEntry$LWS;
7518
8125
  };
7519
8126
  }
8127
+ function initDistortionHTMLMetaElementContentGetter$LWS({
8128
+ globalObject: {
8129
+ HTMLMetaElement: HTMLMetaElement$LWS
8130
+ }
8131
+ }) {
8132
+ const originalContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLMetaElement$LWS.prototype, 'content');
8133
+ const distortionEntry$LWS = [originalContentGetter$LWS, function content$LWS() {
8134
+ const originalContent$LWS = ReflectApply$LWS$1(originalContentGetter$LWS, this, []);
8135
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8136
+ return removeNoncePatterns$LWS(originalContent$LWS);
8137
+ }
8138
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8139
+ return originalContent$LWS;
8140
+ }];
8141
+ return function distortionHTMLMetaElementContentGetter$LWS() {
8142
+ return distortionEntry$LWS;
8143
+ };
8144
+ }
7520
8145
  function initDistortionHTMLObjectElementDataSetter$LWS({
7521
8146
  globalObject: {
7522
8147
  HTMLObjectElement: HTMLObjectElement$LWS
@@ -7529,7 +8154,7 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
7529
8154
  throw new LockerSecurityError$LWS('HTMLObjectElement.data supports http://, https:// schemes, relative urls and about:blank.');
7530
8155
  }
7531
8156
  const parsedURL$LWS = parseURL$LWS(urlString$LWS);
7532
- if (!isValidURL$LWS(parsedURL$LWS)) {
8157
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7533
8158
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
7534
8159
  }
7535
8160
  ReflectApply$LWS$1(originalDataSetter$LWS, this, [trusted.createScriptURL(urlString$LWS)]);
@@ -7540,6 +8165,70 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
7540
8165
  return distortionEntry$LWS;
7541
8166
  };
7542
8167
  }
8168
+ function initDistortionHTMLScriptElementInnerTextGetter$LWS({
8169
+ globalObject: globalObject$LWS
8170
+ }) {
8171
+ const {
8172
+ HTMLScriptElement: HTMLScriptElement$LWS
8173
+ } = globalObject$LWS;
8174
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'innerText');
8175
+ // This may not be implemented in all browsers.
8176
+ // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
8177
+ // istanbul ignore next: behavior will not be tested in collection coverage
8178
+ if (!isGaterEnabledFeature$LWS('changesSince.264') || !descriptor$LWS) {
8179
+ return noop$LWS$1;
8180
+ }
8181
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8182
+ const {
8183
+ get: originalInnerTextGetter$LWS
8184
+ } = descriptor$LWS;
8185
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8186
+ const distortionEntry$LWS = [originalInnerTextGetter$LWS, function innerText$LWS() {
8187
+ var _getOriginalScriptPro2$LWS;
8188
+ if (isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8189
+ return '';
8190
+ }
8191
+ return (_getOriginalScriptPro2$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro2$LWS : ReflectApply$LWS$1(originalInnerTextGetter$LWS, this, []);
8192
+ }];
8193
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8194
+ return function distortionHTMLScriptElementInnerTextGetter$LWS() {
8195
+ return distortionEntry$LWS;
8196
+ };
8197
+ }
8198
+ function initDistortionHTMLScriptElementInnerTextSetter$LWS({
8199
+ globalObject: {
8200
+ HTMLScriptElement: HTMLScriptElement$LWS
8201
+ },
8202
+ root: {
8203
+ distortions: distortions$LWS
8204
+ }
8205
+ }) {
8206
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'innerText');
8207
+ // This may not be implemented in all browsers.
8208
+ // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
8209
+ if (!isGaterEnabledFeature$LWS('changesSince.262') || !descriptor$LWS) {
8210
+ return noop$LWS$1;
8211
+ }
8212
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8213
+ const {
8214
+ get: originalInnerTextGetter$LWS,
8215
+ set: originalInnerTextSetter$LWS
8216
+ } = descriptor$LWS;
8217
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8218
+ return function distortionHTMLScriptElementInnerTextSetter$LWS(record$LWS) {
8219
+ const {
8220
+ sandboxEvaluator: sandboxEvaluator$LWS
8221
+ } = record$LWS;
8222
+ return [originalInnerTextSetter$LWS, function innerText$LWS(value$LWS) {
8223
+ const valueAsString$LWS = trusted.createScript(value$LWS);
8224
+ const scriptWasNotEvaluatedInScriptPropertySetter$LWS = scriptPropertySetters$LWS(this, 'innerText', valueAsString$LWS, originalInnerTextGetter$LWS, originalInnerTextSetter$LWS, distortions$LWS, sandboxEvaluator$LWS, trusted.createScript(SCRIPT_HOOK_SOURCE_TEXT$LWS));
8225
+ if (scriptWasNotEvaluatedInScriptPropertySetter$LWS) {
8226
+ return;
8227
+ }
8228
+ ReflectApply$LWS$1(originalInnerTextSetter$LWS, this, [valueAsString$LWS]);
8229
+ }];
8230
+ };
8231
+ }
7543
8232
  const descriptorCaches$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
7544
8233
  function createBlockedAttributeDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS) {
7545
8234
  return function initDistortionBlockedAttribute$LWS() {
@@ -7672,6 +8361,16 @@ function addBlockedPropertyDistortionFactoryInitializers$LWS({
7672
8361
  }
7673
8362
  }
7674
8363
  }
8364
+ // Sandbox eval is not identity-equal to the host eval (near-membrane unlinks it); only
8365
+ // reject the intrinsic Function constructor when passed as a callback.
8366
+ // @ts-ignore value and Function have different type defs, but that's ok for identity comparison
8367
+ function throwIfUnsafeCallbackReference$LWS(value$LWS) {
8368
+ if (typeof value$LWS === 'function' &&
8369
+ // @ts-ignore
8370
+ value$LWS === Function) {
8371
+ throw new LockerSecurityError$LWS('Cannot pass unsafe Function reference.');
8372
+ }
8373
+ }
7675
8374
  const scriptURLs$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
7676
8375
  function trackScriptURL$LWS(targetElement$LWS, url$LWS) {
7677
8376
  scriptURLs$LWS.set(targetElement$LWS, url$LWS);
@@ -7679,6 +8378,13 @@ function trackScriptURL$LWS(targetElement$LWS, url$LWS) {
7679
8378
  function getScriptURL$LWS(targetElement$LWS) {
7680
8379
  return scriptURLs$LWS.get(targetElement$LWS);
7681
8380
  }
8381
+ const svgAnimatedStringOwners$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8382
+ function trackSVGAnimatedStringOwner$LWS(animatedString$LWS, owner$LWS) {
8383
+ svgAnimatedStringOwners$LWS.set(animatedString$LWS, owner$LWS);
8384
+ }
8385
+ function getSVGAnimatedStringOwner$LWS(animatedString$LWS) {
8386
+ return svgAnimatedStringOwners$LWS.get(animatedString$LWS);
8387
+ }
7682
8388
  function createScriptDistortion$LWS({
7683
8389
  sandboxEvaluator: sandboxEvaluator$LWS
7684
8390
  }, attributeName$LWS) {
@@ -7735,6 +8441,25 @@ function initDistortionHTMLScriptElementSrcSetter$LWS({
7735
8441
  return [originalSrcSetter$LWS, src$LWS];
7736
8442
  };
7737
8443
  }
8444
+ function initDistortionHTMLScriptElementTextGetter$LWS({
8445
+ globalObject: globalObject$LWS
8446
+ }) {
8447
+ const {
8448
+ HTMLScriptElement: HTMLScriptElement$LWS
8449
+ } = globalObject$LWS;
8450
+ const originalTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLScriptElement$LWS.prototype, 'text');
8451
+ const distortionEntry$LWS = [originalTextGetter$LWS, function text$LWS() {
8452
+ var _getOriginalScriptPro3$LWS;
8453
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8454
+ return '';
8455
+ }
8456
+ // istanbul ignore next: the getOriginalScriptProperty branch is unreachable in integration tests because (1) setting innerHTML on a <script> passes TrustedScript to the native innerHTML setter which rejects it under Trusted Types, and (2) setting a different property then reading text receives a membrane proxy as `this`, failing the WeakMap identity check in originalScriptPropertyCache
8457
+ return (_getOriginalScriptPro3$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro3$LWS : ReflectApply$LWS$1(originalTextGetter$LWS, this, []);
8458
+ }];
8459
+ return function distortionHTMLScriptElementTextGetter$LWS() {
8460
+ return distortionEntry$LWS;
8461
+ };
8462
+ }
7738
8463
  function initDistortionHTMLScriptElementTextSetter$LWS({
7739
8464
  globalObject: {
7740
8465
  HTMLScriptElement: HTMLScriptElement$LWS
@@ -7765,10 +8490,11 @@ function initDistortionHTMLScriptElementTextSetter$LWS({
7765
8490
  };
7766
8491
  }
7767
8492
  function initDistortionHTMLScriptElementTextContentGetter$LWS({
7768
- globalObject: {
7769
- HTMLScriptElement: HTMLScriptElement$LWS
7770
- }
8493
+ globalObject: globalObject$LWS
7771
8494
  }) {
8495
+ const {
8496
+ HTMLScriptElement: HTMLScriptElement$LWS
8497
+ } = globalObject$LWS;
7772
8498
  const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'textContent');
7773
8499
  // This may not be implemented in all browsers.
7774
8500
  // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
@@ -7781,8 +8507,11 @@ function initDistortionHTMLScriptElementTextContentGetter$LWS({
7781
8507
  } = descriptor$LWS;
7782
8508
  // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
7783
8509
  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, []);
8510
+ var _getOriginalScriptPro4$LWS;
8511
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8512
+ return '';
8513
+ }
8514
+ return (_getOriginalScriptPro4$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro4$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
7786
8515
  }];
7787
8516
  // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
7788
8517
  return function distortionHTMLScriptElementSrcGetter$LWS() {
@@ -7823,6 +8552,95 @@ function initDistortionHTMLScriptElementTextContentSetter$LWS({
7823
8552
  }];
7824
8553
  };
7825
8554
  }
8555
+ function initDistortionIDBFactoryDatabases$LWS({
8556
+ globalObject: {
8557
+ IDBFactory: IDBFactory$LWS
8558
+ }
8559
+ }) {
8560
+ var _IDBFactory$prototype$LWS;
8561
+ // 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
8562
+ const originalDatabases$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype$LWS.databases;
8563
+ // istanbul ignore if: IDBFactory is always available in coverage environments
8564
+ if (typeof originalDatabases$LWS !== 'function') {
8565
+ return noop$LWS$1;
8566
+ }
8567
+ return function distortionIDBFactoryDatabases$LWS({
8568
+ key: key$LWS
8569
+ }) {
8570
+ return [originalDatabases$LWS, function databases$LWS() {
8571
+ const databasesResultPromise$LWS = ReflectApply$LWS$1(originalDatabases$LWS, this, []);
8572
+ // istanbul ignore next: behavior will not be tested in collection coverage
8573
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
8574
+ return databasesResultPromise$LWS;
8575
+ }
8576
+ return ReflectApply$LWS$1(PromiseProtoThen$LWS, databasesResultPromise$LWS, [result$LWS => {
8577
+ const sandboxedDatabases$LWS = [];
8578
+ let sandboxedDatabasesOffset$LWS = 0;
8579
+ for (let i$LWS = 0, {
8580
+ length: length$LWS
8581
+ } = result$LWS; i$LWS < length$LWS; i$LWS += 1) {
8582
+ const dbInfo$LWS = result$LWS[i$LWS];
8583
+ const {
8584
+ name: name$LWS
8585
+ } = dbInfo$LWS;
8586
+ if (name$LWS !== undefined && startsWithNamespaceMarker$LWS(name$LWS, key$LWS)) {
8587
+ sandboxedDatabases$LWS[sandboxedDatabasesOffset$LWS++] = {
8588
+ name: removeNamespaceMarker$LWS(name$LWS, key$LWS),
8589
+ version: dbInfo$LWS.version
8590
+ };
8591
+ }
8592
+ }
8593
+ return sandboxedDatabases$LWS;
8594
+ }]);
8595
+ }];
8596
+ };
8597
+ }
8598
+ function initDistortionIDBFactoryDeleteDatabase$LWS({
8599
+ globalObject: {
8600
+ IDBFactory: IDBFactory$LWS
8601
+ }
8602
+ }) {
8603
+ var _IDBFactory$prototype2$LWS;
8604
+ // 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
8605
+ const originalDeleteDatabase$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype2$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype2$LWS.deleteDatabase;
8606
+ // istanbul ignore if: IDBFactory is always available in coverage environments
8607
+ if (typeof originalDeleteDatabase$LWS !== 'function') {
8608
+ return noop$LWS$1;
8609
+ }
8610
+ return function distortionIDBFactoryDeleteDatabase$LWS({
8611
+ key: key$LWS
8612
+ }) {
8613
+ return [originalDeleteDatabase$LWS, function deleteDatabase$LWS(...args$LWS) {
8614
+ if (args$LWS.length && isGaterEnabledFeature$LWS('changesSince.262')) {
8615
+ args$LWS[0] = prependNamespaceMarker$LWS(args$LWS[0], key$LWS);
8616
+ }
8617
+ return ReflectApply$LWS$1(originalDeleteDatabase$LWS, this, args$LWS);
8618
+ }];
8619
+ };
8620
+ }
8621
+ function initDistortionIDBFactoryOpen$LWS({
8622
+ globalObject: {
8623
+ IDBFactory: IDBFactory$LWS
8624
+ }
8625
+ }) {
8626
+ var _IDBFactory$prototype3$LWS;
8627
+ // 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
8628
+ const originalOpen$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype3$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype3$LWS.open;
8629
+ // istanbul ignore if: IDBFactory is always available in coverage environments
8630
+ if (typeof originalOpen$LWS !== 'function') {
8631
+ return noop$LWS$1;
8632
+ }
8633
+ return function distortionIDBFactoryOpen$LWS({
8634
+ key: key$LWS
8635
+ }) {
8636
+ return [originalOpen$LWS, function open$LWS(...args$LWS) {
8637
+ if (args$LWS.length && isGaterEnabledFeature$LWS('changesSince.262')) {
8638
+ args$LWS[0] = prependNamespaceMarker$LWS(args$LWS[0], key$LWS);
8639
+ }
8640
+ return ReflectApply$LWS$1(originalOpen$LWS, this, args$LWS);
8641
+ }];
8642
+ };
8643
+ }
7826
8644
  function initDistortionIDBObjectStoreAdd$LWS({
7827
8645
  globalObject: {
7828
8646
  DOMException: DOMException$LWS,
@@ -7879,6 +8697,41 @@ function initDistortionIDBObjectStorePut$LWS({
7879
8697
  return distortionEntry$LWS;
7880
8698
  };
7881
8699
  }
8700
+ const {
8701
+ isSharedElement: isSharedElement$m$LWS
8702
+ } = rootValidator$LWS;
8703
+ function initDistortionIntersectionObserverObserve$LWS({
8704
+ globalObject: {
8705
+ Element: ElementCtor$LWS,
8706
+ IntersectionObserver: IntersectionObserverCtor$LWS
8707
+ }
8708
+ }) {
8709
+ // istanbul ignore if: IntersectionObserver is always available in coverage environments
8710
+ if (typeof IntersectionObserverCtor$LWS !== 'function' || !IntersectionObserverCtor$LWS.prototype.observe) {
8711
+ return noop$LWS$1;
8712
+ }
8713
+ const {
8714
+ observe: originalObserve$LWS
8715
+ } = IntersectionObserverCtor$LWS.prototype;
8716
+ const originalRootGetter$LWS = ObjectLookupOwnGetter$LWS$1(IntersectionObserverCtor$LWS.prototype, 'root');
8717
+ const distortionEntry$LWS = [originalObserve$LWS, function observe$LWS(target$LWS) {
8718
+ if (isGaterEnabledFeature$LWS('changesSince.264')) {
8719
+ if (target$LWS && isSharedElement$m$LWS(target$LWS)) {
8720
+ throw new LockerSecurityError$LWS(`Cannot observe intersection on shared element ${getNodeName$LWS(target$LWS)}.`);
8721
+ }
8722
+ if (originalRootGetter$LWS) {
8723
+ const root$LWS = ReflectApply$LWS$1(originalRootGetter$LWS, this, []);
8724
+ if (root$LWS instanceof ElementCtor$LWS && isSharedElement$m$LWS(root$LWS)) {
8725
+ throw new LockerSecurityError$LWS(`Cannot observe intersection with shared element ${getNodeName$LWS(root$LWS)} as root.`);
8726
+ }
8727
+ }
8728
+ }
8729
+ ReflectApply$LWS$1(originalObserve$LWS, this, [target$LWS]);
8730
+ }];
8731
+ return function distortionIntersectionObserverObserve$LWS() {
8732
+ return distortionEntry$LWS;
8733
+ };
8734
+ }
7882
8735
  function initDistortionMathMLElementOnsecuritypolicyviolation$LWS({
7883
8736
  globalObject: {
7884
8737
  MathMLElement: MathMLElement$LWS
@@ -7930,6 +8783,31 @@ function initDistortionMessagePortPostMessage$LWS({
7930
8783
  return distortionEntry$LWS;
7931
8784
  };
7932
8785
  }
8786
+ const {
8787
+ isSharedElement: isSharedElement$l$LWS
8788
+ } = rootValidator$LWS;
8789
+ function initDistortionMutationObserverObserve$LWS({
8790
+ globalObject: {
8791
+ MutationObserver: {
8792
+ prototype: {
8793
+ observe: originalObserve$LWS
8794
+ }
8795
+ }
8796
+ }
8797
+ }) {
8798
+ const distortionEntry$LWS = [originalObserve$LWS, function observe$LWS(...args$LWS) {
8799
+ const {
8800
+ 0: target$LWS
8801
+ } = args$LWS;
8802
+ if (isGaterEnabledFeature$LWS('changesSince.262') && target$LWS && isSharedElement$l$LWS(target$LWS)) {
8803
+ throw new LockerSecurityError$LWS(`Cannot observe mutations on shared element ${getNodeName$LWS(target$LWS)}.`);
8804
+ }
8805
+ return ReflectApply$LWS$1(originalObserve$LWS, this, args$LWS);
8806
+ }];
8807
+ return function distortionMutationObserverObserve$LWS() {
8808
+ return distortionEntry$LWS;
8809
+ };
8810
+ }
7933
8811
  function initDistortionNamedNodeMapSetNamedItem$LWS({
7934
8812
  globalObject: {
7935
8813
  Attr: Attr$LWS,
@@ -7982,7 +8860,7 @@ function initDistortionNavigatorSendBeacon$LWS({
7982
8860
  const distortionEntry$LWS = [originalSendBeacon$LWS, function sendBeacon$LWS(...args$LWS) {
7983
8861
  if (args$LWS.length) {
7984
8862
  const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(args$LWS[0]));
7985
- if (!isValidURL$LWS(parsedURL$LWS)) {
8863
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7986
8864
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
7987
8865
  }
7988
8866
  args$LWS[0] = parsedURL$LWS.normalizedURL;
@@ -8009,7 +8887,7 @@ function initDistortionNavigatorServiceWorkerGetter$LWS({
8009
8887
  };
8010
8888
  }
8011
8889
  const {
8012
- isSharedElement: isSharedElement$c$LWS,
8890
+ isSharedElement: isSharedElement$k$LWS,
8013
8891
  isAllowedSharedElementChild: isAllowedSharedElementChild$1$LWS
8014
8892
  } = rootValidator$LWS;
8015
8893
  function initDistortionNodeInsertBefore$LWS({
@@ -8032,8 +8910,8 @@ function initDistortionNodeInsertBefore$LWS({
8032
8910
  0: node$LWS
8033
8911
  } = args$LWS;
8034
8912
  // istanbul ignore else: needs default platform behavior test
8035
- if (isSharedElement$c$LWS(this) && !isAllowedSharedElementChild$1$LWS(node$LWS)) {
8036
- throw new LockerSecurityError$LWS(`Cannot insert child ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])} into ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])},`);
8913
+ if (isSharedElement$k$LWS(this) && !isAllowedSharedElementChild$1$LWS(node$LWS)) {
8914
+ throw new LockerSecurityError$LWS(`Cannot insert child ${getNodeName$LWS(node$LWS)} into ${getNodeName$LWS(this)},`);
8037
8915
  }
8038
8916
  }
8039
8917
  return ReflectApply$LWS$1(originalInsertBefore$LWS, this, args$LWS);
@@ -8077,7 +8955,7 @@ function initDistortionNodeValueSetter$LWS({
8077
8955
  };
8078
8956
  }
8079
8957
  const {
8080
- isSharedElement: isSharedElement$b$LWS
8958
+ isSharedElement: isSharedElement$j$LWS
8081
8959
  } = rootValidator$LWS;
8082
8960
  function initDistortionNodeRemoveChild$LWS({
8083
8961
  globalObject: {
@@ -8098,8 +8976,8 @@ function initDistortionNodeRemoveChild$LWS({
8098
8976
  0: child$LWS
8099
8977
  } = args$LWS;
8100
8978
  // istanbul ignore else: needs default platform behavior test
8101
- if (isSharedElement$b$LWS(child$LWS)) {
8102
- throw new LockerSecurityError$LWS(`Cannot remove ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, child$LWS, [])}.`);
8979
+ if (isSharedElement$j$LWS(child$LWS)) {
8980
+ throw new LockerSecurityError$LWS(`Cannot remove ${getNodeName$LWS(child$LWS)}.`);
8103
8981
  }
8104
8982
  }
8105
8983
  // istanbul ignore next: needs default platform behavior test
@@ -8110,7 +8988,7 @@ function initDistortionNodeRemoveChild$LWS({
8110
8988
  };
8111
8989
  }
8112
8990
  const {
8113
- isSharedElement: isSharedElement$a$LWS
8991
+ isSharedElement: isSharedElement$i$LWS
8114
8992
  } = rootValidator$LWS;
8115
8993
  function initDistortionNodeReplaceChild$LWS({
8116
8994
  globalObject: {
@@ -8134,8 +9012,8 @@ function initDistortionNodeReplaceChild$LWS({
8134
9012
  1: child$LWS
8135
9013
  } = args$LWS;
8136
9014
  // istanbul ignore else: needs default platform behavior test
8137
- if (isSharedElement$a$LWS(child$LWS)) {
8138
- throw new LockerSecurityError$LWS(`Cannot replace ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, child$LWS, [])}.`);
9015
+ if (isSharedElement$i$LWS(child$LWS)) {
9016
+ throw new LockerSecurityError$LWS(`Cannot replace ${getNodeName$LWS(child$LWS)}.`);
8139
9017
  }
8140
9018
  }
8141
9019
  // istanbul ignore next: needs default platform behavior test
@@ -8146,19 +9024,19 @@ function initDistortionNodeReplaceChild$LWS({
8146
9024
  };
8147
9025
  }
8148
9026
  function initDistortionNodeTextContentGetter$LWS({
9027
+ globalObject: globalObject$LWS,
8149
9028
  globalObject: {
8150
- HTMLScriptElement: HTMLScriptElement$LWS,
8151
- Node: Node$LWS,
8152
- SVGScriptElement: SVGScriptElement$LWS
9029
+ Node: Node$LWS
8153
9030
  }
8154
9031
  }) {
8155
9032
  const originalTextContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(Node$LWS.prototype, 'textContent');
8156
9033
  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, []);
9034
+ var _getOriginalScriptPro5$LWS;
9035
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
9036
+ return '';
8160
9037
  }
8161
- return ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
9038
+ // istanbul ignore next: the getOriginalScriptProperty branch is unreachable in integration tests because (1) setting innerHTML on a <script> passes TrustedScript to the native innerHTML setter which rejects it under Trusted Types, and (2) setting a different property then reading textContent receives a membrane proxy as `this`, failing the WeakMap identity check in originalScriptPropertyCache
9039
+ return (_getOriginalScriptPro5$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro5$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
8162
9040
  }];
8163
9041
  return function distortionHTMLScriptElementSrcGetter$LWS() {
8164
9042
  return distortionEntry$LWS;
@@ -8173,7 +9051,7 @@ function initDistortionNodeTextContentGetter$LWS({
8173
9051
  // magenta global object, which would erroneously prevent code from interacting
8174
9052
  // with that document's <html>, <head> and <body>.
8175
9053
  const {
8176
- isSharedElement: isSharedElement$9$LWS
9054
+ isSharedElement: isSharedElement$h$LWS
8177
9055
  } = rootValidator$LWS;
8178
9056
  function initDistortionNodeTextContentSetter$LWS({
8179
9057
  globalObject: {
@@ -8228,8 +9106,8 @@ function initDistortionNodeTextContentSetter$LWS({
8228
9106
  }
8229
9107
  }
8230
9108
  // istanbul ignore else: needs default platform behavior test
8231
- else if (isSharedElement$9$LWS(this)) {
8232
- throw new LockerSecurityError$LWS(`Cannot set textContent of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])} elements.`);
9109
+ else if (isSharedElement$h$LWS(this)) {
9110
+ throw new LockerSecurityError$LWS(`Cannot set textContent of ${getNodeName$LWS(this)} elements.`);
8233
9111
  }
8234
9112
  ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
8235
9113
  }];
@@ -8274,27 +9152,95 @@ function initDistortionNotificationCtor$LWS({
8274
9152
  return distortionEntry$LWS;
8275
9153
  };
8276
9154
  }
8277
- function initDistortionPerformanceMark$LWS({
9155
+ function initDistortionObservableForEach$LWS({
8278
9156
  globalObject: {
8279
- Performance: {
8280
- prototype: {
8281
- mark: originalMark$LWS
8282
- }
8283
- }
9157
+ Observable: OriginalObservable$LWS
8284
9158
  }
8285
9159
  }) {
8286
- const distortionEntry$LWS = [originalMark$LWS, function mark$LWS(...args$LWS) {
8287
- try {
8288
- return ReflectApply$LWS$1(originalMark$LWS, this, args$LWS);
8289
- } catch (error) {
8290
- if (args$LWS.length > 1 && error instanceof DOMException) {
8291
- const providedOptions$LWS = args$LWS[1];
8292
- if (isObject$LWS$1(providedOptions$LWS)) {
8293
- args$LWS[1] = partialStructuredClone$LWS(providedOptions$LWS);
8294
- return ReflectApply$LWS$1(originalMark$LWS, this, args$LWS);
8295
- }
8296
- }
8297
- throw error;
9160
+ var _OriginalObservable$p$LWS;
9161
+ // 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
9162
+ const originalForEach$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p$LWS.forEach;
9163
+ // istanbul ignore if: Observable is always available in coverage environments
9164
+ if (typeof originalForEach$LWS !== 'function') {
9165
+ return noop$LWS$1;
9166
+ }
9167
+ const distortionEntry$LWS = [originalForEach$LWS, function forEach$LWS(...args$LWS) {
9168
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9169
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9170
+ }
9171
+ return ReflectApply$LWS$1(originalForEach$LWS, this, args$LWS);
9172
+ }];
9173
+ return function distortionObservableForEach$LWS() {
9174
+ return distortionEntry$LWS;
9175
+ };
9176
+ }
9177
+ function initDistortionObservableSubscribe$LWS({
9178
+ globalObject: {
9179
+ Observable: OriginalObservable$LWS
9180
+ }
9181
+ }) {
9182
+ var _OriginalObservable$p2$LWS;
9183
+ // 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
9184
+ const originalSubscribe$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p2$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p2$LWS.subscribe;
9185
+ // istanbul ignore if: Observable is always available in coverage environments
9186
+ if (typeof originalSubscribe$LWS !== 'function') {
9187
+ return noop$LWS$1;
9188
+ }
9189
+ const distortionEntry$LWS = [originalSubscribe$LWS, function subscribe$LWS(...args$LWS) {
9190
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9191
+ const {
9192
+ 0: observerOrNext$LWS
9193
+ } = args$LWS;
9194
+ if (observerOrNext$LWS !== null && observerOrNext$LWS !== undefined) {
9195
+ if (typeof observerOrNext$LWS === 'function') {
9196
+ throwIfUnsafeCallbackReference$LWS(observerOrNext$LWS);
9197
+ } else if (typeof observerOrNext$LWS === 'object') {
9198
+ // Snapshot properties to prevent TOCTOU: attacker-controlled
9199
+ // getters could return a safe value during the check but
9200
+ // return eval when Observable reads them internally.
9201
+ const {
9202
+ next: next$LWS,
9203
+ error,
9204
+ complete: complete$LWS
9205
+ } = observerOrNext$LWS;
9206
+ throwIfUnsafeCallbackReference$LWS(next$LWS);
9207
+ throwIfUnsafeCallbackReference$LWS(error);
9208
+ throwIfUnsafeCallbackReference$LWS(complete$LWS);
9209
+ args$LWS[0] = {
9210
+ next: next$LWS,
9211
+ error,
9212
+ complete: complete$LWS
9213
+ };
9214
+ }
9215
+ }
9216
+ }
9217
+ return ReflectApply$LWS$1(originalSubscribe$LWS, this, args$LWS);
9218
+ }];
9219
+ return function distortionObservableSubscribe$LWS() {
9220
+ return distortionEntry$LWS;
9221
+ };
9222
+ }
9223
+ function initDistortionPerformanceMark$LWS({
9224
+ globalObject: {
9225
+ Performance: {
9226
+ prototype: {
9227
+ mark: originalMark$LWS
9228
+ }
9229
+ }
9230
+ }
9231
+ }) {
9232
+ const distortionEntry$LWS = [originalMark$LWS, function mark$LWS(...args$LWS) {
9233
+ try {
9234
+ return ReflectApply$LWS$1(originalMark$LWS, this, args$LWS);
9235
+ } catch (error) {
9236
+ if (args$LWS.length > 1 && error instanceof DOMException) {
9237
+ const providedOptions$LWS = args$LWS[1];
9238
+ if (isObject$LWS$1(providedOptions$LWS)) {
9239
+ args$LWS[1] = partialStructuredClone$LWS(providedOptions$LWS);
9240
+ return ReflectApply$LWS$1(originalMark$LWS, this, args$LWS);
9241
+ }
9242
+ }
9243
+ throw error;
8298
9244
  }
8299
9245
  }];
8300
9246
  return function distortionPerformanceMark$LWS() {
@@ -8356,32 +9302,433 @@ function initDistortionPerformanceMarkCtor$LWS({
8356
9302
  return distortionEntry$LWS;
8357
9303
  };
8358
9304
  }
9305
+ const BLOCKED_PERFORMANCE_ENTRY_TYPES$LWS = new Set(['resource', 'navigation', 'longtask', 'element', 'layout-shift', 'largest-contentful-paint', 'first-input', 'event']);
9306
+ function pinPerformanceObserverInit$LWS(init$LWS) {
9307
+ if (!init$LWS || !isObject$LWS$1(init$LWS)) {
9308
+ return undefined;
9309
+ }
9310
+ const {
9311
+ entryTypes: rawEntryTypes$LWS,
9312
+ type: type$LWS,
9313
+ buffered: buffered$LWS
9314
+ } = init$LWS;
9315
+ const entryTypes$LWS = [];
9316
+ if (ArrayIsArray$LWS$1(rawEntryTypes$LWS)) {
9317
+ for (let i$LWS = 0, {
9318
+ length: length$LWS
9319
+ } = rawEntryTypes$LWS; i$LWS < length$LWS; i$LWS += 1) {
9320
+ const entryType$LWS = rawEntryTypes$LWS[i$LWS];
9321
+ if (typeof entryType$LWS === 'string') {
9322
+ entryTypes$LWS[entryTypes$LWS.length] = entryType$LWS;
9323
+ }
9324
+ }
9325
+ }
9326
+ return {
9327
+ entryTypes: entryTypes$LWS,
9328
+ type: typeof type$LWS === 'string' ? type$LWS : undefined,
9329
+ buffered: typeof buffered$LWS === 'boolean' ? buffered$LWS : undefined
9330
+ };
9331
+ }
9332
+ function initDistortionPerformanceObserverObserve$LWS({
9333
+ globalObject: {
9334
+ PerformanceObserver: PerformanceObserverCtor$LWS
9335
+ }
9336
+ }) {
9337
+ // istanbul ignore if: PerformanceObserver is always available in coverage environments
9338
+ if (typeof PerformanceObserverCtor$LWS !== 'function' || !PerformanceObserverCtor$LWS.prototype.observe) {
9339
+ return noop$LWS$1;
9340
+ }
9341
+ const {
9342
+ observe: originalObserve$LWS
9343
+ } = PerformanceObserverCtor$LWS.prototype;
9344
+ const distortionEntry$LWS = [originalObserve$LWS, function observe$LWS(options$LWS) {
9345
+ if (isGaterEnabledFeature$LWS('changesSince.264')) {
9346
+ const pinned$LWS = pinPerformanceObserverInit$LWS(options$LWS);
9347
+ if (pinned$LWS) {
9348
+ const {
9349
+ entryTypes: entryTypes$LWS,
9350
+ type: type$LWS
9351
+ } = pinned$LWS;
9352
+ for (let i$LWS = 0, {
9353
+ length: length$LWS
9354
+ } = entryTypes$LWS; i$LWS < length$LWS; i$LWS += 1) {
9355
+ if (BLOCKED_PERFORMANCE_ENTRY_TYPES$LWS.has(entryTypes$LWS[i$LWS])) {
9356
+ throw new LockerSecurityError$LWS(`Cannot observe performance entries of type "${entryTypes$LWS[i$LWS]}".`);
9357
+ }
9358
+ }
9359
+ if (type$LWS && BLOCKED_PERFORMANCE_ENTRY_TYPES$LWS.has(type$LWS)) {
9360
+ throw new LockerSecurityError$LWS(`Cannot observe performance entries of type "${type$LWS}".`);
9361
+ }
9362
+ const safeInit$LWS = {};
9363
+ const {
9364
+ buffered: buffered$LWS
9365
+ } = pinned$LWS;
9366
+ if (entryTypes$LWS.length) {
9367
+ safeInit$LWS.entryTypes = entryTypes$LWS;
9368
+ }
9369
+ if (type$LWS !== undefined) {
9370
+ safeInit$LWS.type = type$LWS;
9371
+ }
9372
+ if (buffered$LWS !== undefined) {
9373
+ safeInit$LWS.buffered = buffered$LWS;
9374
+ }
9375
+ ReflectApply$LWS$1(originalObserve$LWS, this, [safeInit$LWS]);
9376
+ return;
9377
+ }
9378
+ }
9379
+ ReflectApply$LWS$1(originalObserve$LWS, this, [options$LWS]);
9380
+ }];
9381
+ return function distortionPerformanceObserverObserve$LWS() {
9382
+ return distortionEntry$LWS;
9383
+ };
9384
+ }
9385
+ function initDistortionPromiseAll$LWS({
9386
+ globalObject: {
9387
+ Promise: Promise$LWS
9388
+ }
9389
+ }) {
9390
+ // 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
9391
+ const originalPromiseAll$LWS = Promise$LWS == null ? void 0 : Promise$LWS.all;
9392
+ // istanbul ignore if: Promise.all is always available in coverage environments
9393
+ if (typeof originalPromiseAll$LWS !== 'function') {
9394
+ return noop$LWS$1;
9395
+ }
9396
+ const distortionEntry$LWS = [originalPromiseAll$LWS, function (...args$LWS) {
9397
+ // Always use the real Promise constructor as `this` to prevent
9398
+ // malicious constructors from being passed via Promise.all.call()
9399
+ // that could inject eval as resolve/reject callbacks.
9400
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9401
+ return ReflectApply$LWS$1(originalPromiseAll$LWS, Promise$LWS, args$LWS);
9402
+ }
9403
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9404
+ return ReflectApply$LWS$1(originalPromiseAll$LWS, this, args$LWS);
9405
+ }];
9406
+ return function distortionPromiseAll$LWS() {
9407
+ return distortionEntry$LWS;
9408
+ };
9409
+ }
9410
+ function initDistortionPromiseAllSettled$LWS({
9411
+ globalObject: {
9412
+ Promise: Promise$LWS
9413
+ }
9414
+ }) {
9415
+ // 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
9416
+ const originalPromiseAllSettled$LWS = Promise$LWS == null ? void 0 : Promise$LWS.allSettled;
9417
+ // istanbul ignore if: Promise.allSettled is always available in coverage environments
9418
+ if (typeof originalPromiseAllSettled$LWS !== 'function') {
9419
+ return noop$LWS$1;
9420
+ }
9421
+ const distortionEntry$LWS = [originalPromiseAllSettled$LWS, function (...args$LWS) {
9422
+ // Always use the real Promise constructor as `this` to prevent
9423
+ // malicious constructors from being passed via Promise.allSettled.call()
9424
+ // that could inject eval as resolve/reject callbacks.
9425
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9426
+ return ReflectApply$LWS$1(originalPromiseAllSettled$LWS, Promise$LWS, args$LWS);
9427
+ }
9428
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9429
+ return ReflectApply$LWS$1(originalPromiseAllSettled$LWS, this, args$LWS);
9430
+ }];
9431
+ return function distortionPromiseAllSettled$LWS() {
9432
+ return distortionEntry$LWS;
9433
+ };
9434
+ }
9435
+ function initDistortionPromiseAny$LWS({
9436
+ globalObject: {
9437
+ Promise: Promise$LWS
9438
+ }
9439
+ }) {
9440
+ // 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
9441
+ const originalPromiseAny$LWS = Promise$LWS == null ? void 0 : Promise$LWS.any;
9442
+ // istanbul ignore if: Promise.any is always available in coverage environments
9443
+ if (typeof originalPromiseAny$LWS !== 'function') {
9444
+ return noop$LWS$1;
9445
+ }
9446
+ const distortionEntry$LWS = [originalPromiseAny$LWS, function (...args$LWS) {
9447
+ // Always use the real Promise constructor as `this` to prevent
9448
+ // malicious constructors from being passed via Promise.any.call()
9449
+ // that could inject eval as resolve/reject callbacks.
9450
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9451
+ return ReflectApply$LWS$1(originalPromiseAny$LWS, Promise$LWS, args$LWS);
9452
+ }
9453
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9454
+ return ReflectApply$LWS$1(originalPromiseAny$LWS, this, args$LWS);
9455
+ }];
9456
+ return function distortionPromiseAny$LWS() {
9457
+ return distortionEntry$LWS;
9458
+ };
9459
+ }
9460
+ function initDistortionPromiseCatch$LWS({
9461
+ globalObject: {
9462
+ Promise: {
9463
+ prototype: PromiseProto$LWS
9464
+ }
9465
+ }
9466
+ }) {
9467
+ // 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
9468
+ const originalPromiseCatch$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.catch;
9469
+ // istanbul ignore if: Promise.prototype.catch is always available in coverage environments
9470
+ if (typeof originalPromiseCatch$LWS !== 'function') {
9471
+ return noop$LWS$1;
9472
+ }
9473
+ const distortionEntry$LWS = [originalPromiseCatch$LWS, function (...args$LWS) {
9474
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9475
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9476
+ }
9477
+ return ReflectApply$LWS$1(originalPromiseCatch$LWS, this, args$LWS);
9478
+ }];
9479
+ return function distortionPromiseCatch$LWS() {
9480
+ return distortionEntry$LWS;
9481
+ };
9482
+ }
9483
+ function initDistortionPromiseFinally$LWS({
9484
+ globalObject: {
9485
+ Promise: {
9486
+ prototype: PromiseProto$LWS
9487
+ }
9488
+ }
9489
+ }) {
9490
+ // 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
9491
+ const originalPromiseFinally$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.finally;
9492
+ // istanbul ignore if: Promise.prototype.finally is always available in coverage environments
9493
+ if (typeof originalPromiseFinally$LWS !== 'function') {
9494
+ return noop$LWS$1;
9495
+ }
9496
+ const distortionEntry$LWS = [originalPromiseFinally$LWS, function (...args$LWS) {
9497
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9498
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9499
+ }
9500
+ return ReflectApply$LWS$1(originalPromiseFinally$LWS, this, args$LWS);
9501
+ }];
9502
+ return function distortionPromiseFinally$LWS() {
9503
+ return distortionEntry$LWS;
9504
+ };
9505
+ }
9506
+ function initDistortionPromiseRace$LWS({
9507
+ globalObject: {
9508
+ Promise: Promise$LWS
9509
+ }
9510
+ }) {
9511
+ // 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
9512
+ const originalPromiseRace$LWS = Promise$LWS == null ? void 0 : Promise$LWS.race;
9513
+ // istanbul ignore if: Promise.race is always available in coverage environments
9514
+ if (typeof originalPromiseRace$LWS !== 'function') {
9515
+ return noop$LWS$1;
9516
+ }
9517
+ const distortionEntry$LWS = [originalPromiseRace$LWS, function (...args$LWS) {
9518
+ // Always use the real Promise constructor as `this` to prevent
9519
+ // malicious constructors from being passed via Promise.race.call()
9520
+ // that could inject eval as resolve/reject callbacks.
9521
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9522
+ return ReflectApply$LWS$1(originalPromiseRace$LWS, Promise$LWS, args$LWS);
9523
+ }
9524
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9525
+ return ReflectApply$LWS$1(originalPromiseRace$LWS, this, args$LWS);
9526
+ }];
9527
+ return function distortionPromiseRace$LWS() {
9528
+ return distortionEntry$LWS;
9529
+ };
9530
+ }
9531
+ function initDistortionPromiseReject$LWS({
9532
+ globalObject: {
9533
+ Promise: Promise$LWS
9534
+ }
9535
+ }) {
9536
+ // 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
9537
+ const originalPromiseReject$LWS = Promise$LWS == null ? void 0 : Promise$LWS.reject;
9538
+ // istanbul ignore if: Promise.reject is always available in coverage environments
9539
+ if (typeof originalPromiseReject$LWS !== 'function') {
9540
+ return noop$LWS$1;
9541
+ }
9542
+ const distortionEntry$LWS = [originalPromiseReject$LWS, function (...args$LWS) {
9543
+ // Always use the real Promise constructor as `this` to prevent
9544
+ // malicious constructors from being passed via Promise.reject.call()
9545
+ // that could inject eval as resolve/reject callbacks.
9546
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9547
+ return ReflectApply$LWS$1(originalPromiseReject$LWS, Promise$LWS, args$LWS);
9548
+ }
9549
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9550
+ return ReflectApply$LWS$1(originalPromiseReject$LWS, this, args$LWS);
9551
+ }];
9552
+ return function distortionPromiseReject$LWS() {
9553
+ return distortionEntry$LWS;
9554
+ };
9555
+ }
9556
+ function initDistortionPromiseResolve$LWS({
9557
+ globalObject: {
9558
+ Promise: Promise$LWS
9559
+ }
9560
+ }) {
9561
+ // 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
9562
+ const originalPromiseResolve$LWS = Promise$LWS == null ? void 0 : Promise$LWS.resolve;
9563
+ // istanbul ignore if: Promise.resolve is always available in coverage environments
9564
+ if (typeof originalPromiseResolve$LWS !== 'function') {
9565
+ return noop$LWS$1;
9566
+ }
9567
+ const distortionEntry$LWS = [originalPromiseResolve$LWS, function (...args$LWS) {
9568
+ // Always use the real Promise constructor as `this` to prevent
9569
+ // malicious constructors from being passed via Promise.resolve.call()
9570
+ // that could inject eval as resolve/reject callbacks.
9571
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9572
+ return ReflectApply$LWS$1(originalPromiseResolve$LWS, Promise$LWS, args$LWS);
9573
+ }
9574
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9575
+ return ReflectApply$LWS$1(originalPromiseResolve$LWS, this, args$LWS);
9576
+ }];
9577
+ return function distortionPromiseResolve$LWS() {
9578
+ return distortionEntry$LWS;
9579
+ };
9580
+ }
9581
+ function initDistortionPromiseThen$LWS({
9582
+ globalObject: {
9583
+ Promise: {
9584
+ prototype: PromiseProto$LWS
9585
+ }
9586
+ }
9587
+ }) {
9588
+ // 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
9589
+ const originalPromiseThen$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.then;
9590
+ // istanbul ignore if: Promise.prototype.then is always available in coverage environments
9591
+ if (typeof originalPromiseThen$LWS !== 'function') {
9592
+ return noop$LWS$1;
9593
+ }
9594
+ const distortionEntry$LWS = [originalPromiseThen$LWS, function then$LWS(...args$LWS) {
9595
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9596
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9597
+ throwIfUnsafeCallbackReference$LWS(args$LWS[1]);
9598
+ }
9599
+ return ReflectApply$LWS$1(originalPromiseThen$LWS, this, args$LWS);
9600
+ }];
9601
+ return function distortionPromiseThen$LWS() {
9602
+ return distortionEntry$LWS;
9603
+ };
9604
+ }
8359
9605
  function initDistortionPromiseTry$LWS({
8360
9606
  globalObject: {
8361
9607
  Promise: Promise$LWS
8362
9608
  }
8363
9609
  }) {
9610
+ // 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
8364
9611
  const originalPromiseTry$LWS = Promise$LWS == null ? void 0 : Promise$LWS.try;
9612
+ // istanbul ignore if: Promise.try may not be available in all coverage environments
8365
9613
  if (typeof originalPromiseTry$LWS !== 'function') {
8366
9614
  return noop$LWS$1;
8367
9615
  }
8368
9616
  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.');
8377
- }
9617
+ if (isGaterEnabledFeature$LWS('changesSince.260')) {
9618
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
8378
9619
  }
9620
+ // Always use the real Promise constructor as `this` to prevent
9621
+ // malicious constructors from being passed via Promise.try.call()
9622
+ // that could inject eval as resolve/reject callbacks.
9623
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9624
+ return ReflectApply$LWS$1(originalPromiseTry$LWS, Promise$LWS, args$LWS);
9625
+ }
9626
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8379
9627
  return ReflectApply$LWS$1(originalPromiseTry$LWS, this, args$LWS);
8380
9628
  }];
8381
9629
  return function distortionPromiseTry$LWS() {
8382
9630
  return distortionEntry$LWS;
8383
9631
  };
8384
9632
  }
9633
+ function initDistortionPromiseWithResolvers$LWS({
9634
+ globalObject: {
9635
+ Promise: Promise$LWS
9636
+ }
9637
+ }) {
9638
+ // 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
9639
+ const originalPromiseWithResolvers$LWS = Promise$LWS == null ? void 0 : Promise$LWS.withResolvers;
9640
+ // istanbul ignore if: Promise.withResolvers may not be available in all coverage environments
9641
+ if (typeof originalPromiseWithResolvers$LWS !== 'function') {
9642
+ return noop$LWS$1;
9643
+ }
9644
+ const distortionEntry$LWS = [originalPromiseWithResolvers$LWS, function () {
9645
+ // Always use the real Promise constructor as `this` to prevent
9646
+ // malicious constructors from being passed via Promise.withResolvers.call()
9647
+ // that could leak eval as resolve/reject references.
9648
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9649
+ return ReflectApply$LWS$1(originalPromiseWithResolvers$LWS, Promise$LWS, []);
9650
+ }
9651
+ // istanbul ignore next: ungated return is not reachable in coverage runs
9652
+ return ReflectApply$LWS$1(originalPromiseWithResolvers$LWS, this, []);
9653
+ }];
9654
+ return function distortionPromiseWithResolvers$LWS() {
9655
+ return distortionEntry$LWS;
9656
+ };
9657
+ }
9658
+ const {
9659
+ isSharedElement: isSharedElement$g$LWS
9660
+ } = rootValidator$LWS;
9661
+ function initDistortionRangeCloneContents$LWS({
9662
+ globalObject: {
9663
+ AbstractRange: AbstractRange$LWS,
9664
+ Range: {
9665
+ prototype: {
9666
+ cloneContents: originalCloneContents$LWS
9667
+ }
9668
+ }
9669
+ }
9670
+ }) {
9671
+ // 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.
9672
+ const {
9673
+ prototype: AbstractRangeProto$LWS
9674
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9675
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9676
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9677
+ const distortionEntry$LWS = [originalCloneContents$LWS, function cloneContents$LWS(...args$LWS) {
9678
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9679
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9680
+ for (let i$LWS = 0, {
9681
+ length: length$LWS
9682
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9683
+ const container$LWS = containers$LWS[i$LWS];
9684
+ if (isSharedElement$g$LWS(container$LWS)) {
9685
+ throw new LockerSecurityError$LWS(`Cannot clone contents of ${getNodeName$LWS(container$LWS)}.`);
9686
+ }
9687
+ }
9688
+ }
9689
+ return ReflectApply$LWS$1(originalCloneContents$LWS, this, args$LWS);
9690
+ }];
9691
+ return function distortionRangeCloneContents$LWS() {
9692
+ return distortionEntry$LWS;
9693
+ };
9694
+ }
9695
+ const {
9696
+ isSharedElement: isSharedElement$f$LWS
9697
+ } = rootValidator$LWS;
9698
+ function initDistortionRangeCloneRange$LWS({
9699
+ globalObject: {
9700
+ AbstractRange: AbstractRange$LWS,
9701
+ Range: {
9702
+ prototype: {
9703
+ cloneRange: originalCloneRange$LWS
9704
+ }
9705
+ }
9706
+ }
9707
+ }) {
9708
+ // 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.
9709
+ const {
9710
+ prototype: AbstractRangeProto$LWS
9711
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9712
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9713
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9714
+ const distortionEntry$LWS = [originalCloneRange$LWS, function cloneRange$LWS(...args$LWS) {
9715
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9716
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9717
+ for (let i$LWS = 0, {
9718
+ length: length$LWS
9719
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9720
+ const container$LWS = containers$LWS[i$LWS];
9721
+ if (isSharedElement$f$LWS(container$LWS)) {
9722
+ throw new LockerSecurityError$LWS(`Cannot clone range of ${getNodeName$LWS(container$LWS)}.`);
9723
+ }
9724
+ }
9725
+ }
9726
+ return ReflectApply$LWS$1(originalCloneRange$LWS, this, args$LWS);
9727
+ }];
9728
+ return function distortionRangeCloneRange$LWS() {
9729
+ return distortionEntry$LWS;
9730
+ };
9731
+ }
8385
9732
  function initDistortionRangeCreateContextualFragment$LWS({
8386
9733
  document: document$LWS,
8387
9734
  globalObject: {
@@ -8414,7 +9761,7 @@ function initDistortionRangeCreateContextualFragment$LWS({
8414
9761
  };
8415
9762
  }
8416
9763
  const {
8417
- isSharedElement: isSharedElement$8$LWS
9764
+ isSharedElement: isSharedElement$e$LWS
8418
9765
  } = rootValidator$LWS;
8419
9766
  function initDistortionRangeDeleteContents$LWS({
8420
9767
  globalObject: {
@@ -8443,8 +9790,8 @@ function initDistortionRangeDeleteContents$LWS({
8443
9790
  length: length$LWS
8444
9791
  } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
8445
9792
  const container$LWS = containers$LWS[i$LWS];
8446
- if (isSharedElement$8$LWS(container$LWS)) {
8447
- throw new LockerSecurityError$LWS(`Cannot delete contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9793
+ if (isSharedElement$e$LWS(container$LWS)) {
9794
+ throw new LockerSecurityError$LWS(`Cannot delete contents of ${getNodeName$LWS(container$LWS)}.`);
8448
9795
  }
8449
9796
  }
8450
9797
  return ReflectApply$LWS$1(originalDeleteContents$LWS, this, args$LWS);
@@ -8454,7 +9801,7 @@ function initDistortionRangeDeleteContents$LWS({
8454
9801
  };
8455
9802
  }
8456
9803
  const {
8457
- isSharedElement: isSharedElement$7$LWS
9804
+ isSharedElement: isSharedElement$d$LWS
8458
9805
  } = rootValidator$LWS;
8459
9806
  function initDistortionRangeExtractContents$LWS({
8460
9807
  globalObject: {
@@ -8483,8 +9830,8 @@ function initDistortionRangeExtractContents$LWS({
8483
9830
  length: length$LWS
8484
9831
  } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
8485
9832
  const container$LWS = containers$LWS[i$LWS];
8486
- if (isSharedElement$7$LWS(container$LWS)) {
8487
- throw new LockerSecurityError$LWS(`Cannot extract contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9833
+ if (isSharedElement$d$LWS(container$LWS)) {
9834
+ throw new LockerSecurityError$LWS(`Cannot extract contents of ${getNodeName$LWS(container$LWS)}.`);
8488
9835
  }
8489
9836
  }
8490
9837
  return ReflectApply$LWS$1(originalExtractContents$LWS, this, args$LWS);
@@ -8494,7 +9841,44 @@ function initDistortionRangeExtractContents$LWS({
8494
9841
  };
8495
9842
  }
8496
9843
  const {
8497
- isSharedElement: isSharedElement$6$LWS,
9844
+ isSharedElement: isSharedElement$c$LWS
9845
+ } = rootValidator$LWS;
9846
+ function initDistortionRangeGetBoundingClientRect$LWS({
9847
+ globalObject: {
9848
+ AbstractRange: AbstractRange$LWS,
9849
+ Range: {
9850
+ prototype: {
9851
+ getBoundingClientRect: originalGetBoundingClientRect$LWS
9852
+ }
9853
+ }
9854
+ }
9855
+ }) {
9856
+ // 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.
9857
+ const {
9858
+ prototype: AbstractRangeProto$LWS
9859
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9860
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9861
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9862
+ const distortionEntry$LWS = [originalGetBoundingClientRect$LWS, function getBoundingClientRect$LWS(...args$LWS) {
9863
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9864
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9865
+ for (let i$LWS = 0, {
9866
+ length: length$LWS
9867
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9868
+ const container$LWS = containers$LWS[i$LWS];
9869
+ if (isSharedElement$c$LWS(container$LWS)) {
9870
+ throw new LockerSecurityError$LWS(`Cannot get bounding client rect of ${getNodeName$LWS(container$LWS)}.`);
9871
+ }
9872
+ }
9873
+ }
9874
+ return ReflectApply$LWS$1(originalGetBoundingClientRect$LWS, this, args$LWS);
9875
+ }];
9876
+ return function distortionRangeGetBoundingClientRect$LWS() {
9877
+ return distortionEntry$LWS;
9878
+ };
9879
+ }
9880
+ const {
9881
+ isSharedElement: isSharedElement$b$LWS,
8498
9882
  isAllowedSharedElementChild: isAllowedSharedElementChild$LWS
8499
9883
  } = rootValidator$LWS;
8500
9884
  function initDistortionRangeInsertNode$LWS({
@@ -8514,66 +9898,190 @@ function initDistortionRangeInsertNode$LWS({
8514
9898
  // istanbul ignore else: needs default platform behavior test
8515
9899
  if (args$LWS.length) {
8516
9900
  const commonAncestorContainer$LWS = ReflectApply$LWS$1(originalCommonAncestorContainerGetter$LWS, this, []);
8517
- if (commonAncestorContainer$LWS && isSharedElement$6$LWS(commonAncestorContainer$LWS) && !isAllowedSharedElementChild$LWS(args$LWS[0])) {
8518
- throw new LockerSecurityError$LWS(`Cannot insert a new child node of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, commonAncestorContainer$LWS, [])}.`);
9901
+ if (commonAncestorContainer$LWS && isSharedElement$b$LWS(commonAncestorContainer$LWS) && !isAllowedSharedElementChild$LWS(args$LWS[0])) {
9902
+ throw new LockerSecurityError$LWS(`Cannot insert a new child node of ${getNodeName$LWS(commonAncestorContainer$LWS)}.`);
9903
+ }
9904
+ }
9905
+ return ReflectApply$LWS$1(originalInsertNode$LWS, this, args$LWS);
9906
+ }];
9907
+ return function distortionRangeInsertNode$LWS() {
9908
+ return distortionEntry$LWS;
9909
+ };
9910
+ }
9911
+ const {
9912
+ isSharedElement: isSharedElement$a$LWS
9913
+ } = rootValidator$LWS;
9914
+ function createRangeProtoMethodDistortionFactoryInitializer$LWS(methodName$LWS) {
9915
+ return function initDistortionRangeProtoMethod$LWS({
9916
+ globalObject: {
9917
+ Range: {
9918
+ // @ts-ignore: Prevent index type error.
9919
+ prototype: {
9920
+ [methodName$LWS]: originalMethod$LWS
9921
+ }
8519
9922
  }
8520
9923
  }
8521
- return ReflectApply$LWS$1(originalInsertNode$LWS, this, args$LWS);
9924
+ }) {
9925
+ // Use a computed property to dynamically set the distortion function
9926
+ // name without using `Reflect.defineProperty()`.
9927
+ const {
9928
+ [methodName$LWS]: distortion$LWS
9929
+ } = {
9930
+ [methodName$LWS](...args$LWS) {
9931
+ // istanbul ignore else: needs default platform behavior test
9932
+ if (args$LWS.length) {
9933
+ const {
9934
+ 0: node$LWS
9935
+ } = args$LWS;
9936
+ // istanbul ignore else: needs default platform behavior test
9937
+ if (isSharedElement$a$LWS(node$LWS)) {
9938
+ throw new LockerSecurityError$LWS(`Cannot call ${methodName$LWS} with ${getNodeName$LWS(node$LWS)}.`);
9939
+ }
9940
+ }
9941
+ return ReflectApply$LWS$1(originalMethod$LWS, this, args$LWS);
9942
+ }
9943
+ };
9944
+ const distortionEntry$LWS = [originalMethod$LWS, distortion$LWS];
9945
+ return function distortionRangeProtoMethod$LWS() {
9946
+ return distortionEntry$LWS;
9947
+ };
9948
+ };
9949
+ }
9950
+ const initDistortionRangeSetEnd$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setEnd');
9951
+ const initDistortionRangeSelectNode$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('selectNode');
9952
+ const initDistortionRangeSelectNodeContents$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('selectNodeContents');
9953
+ const initDistortionRangeSetEndAfter$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setEndAfter');
9954
+ const initDistortionRangeSetEndBefore$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setEndBefore');
9955
+ const initDistortionRangeSetStart$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStart');
9956
+ const initDistortionRangeSetStartAfter$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStartAfter');
9957
+ const initDistortionRangeSetStartBefore$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStartBefore');
9958
+ const initDistortionRangeSurroundContents$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('surroundContents');
9959
+ const {
9960
+ isSharedElement: isSharedElement$9$LWS
9961
+ } = rootValidator$LWS;
9962
+ function initDistortionRangeToString$LWS({
9963
+ globalObject: {
9964
+ AbstractRange: AbstractRange$LWS,
9965
+ Range: {
9966
+ prototype: {
9967
+ toString: originalRangeToString$LWS
9968
+ }
9969
+ }
9970
+ }
9971
+ }) {
9972
+ // 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.
9973
+ const {
9974
+ prototype: AbstractRangeProto$LWS
9975
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9976
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9977
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9978
+ const distortionEntry$LWS = [originalRangeToString$LWS, function toString$LWS(...args$LWS) {
9979
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9980
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9981
+ for (let i$LWS = 0, {
9982
+ length: length$LWS
9983
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9984
+ const container$LWS = containers$LWS[i$LWS];
9985
+ if (isSharedElement$9$LWS(container$LWS)) {
9986
+ throw new LockerSecurityError$LWS(`Cannot read contents of ${getNodeName$LWS(container$LWS)}.`);
9987
+ }
9988
+ }
9989
+ }
9990
+ return ReflectApply$LWS$1(originalRangeToString$LWS, this, args$LWS);
9991
+ }];
9992
+ return function distortionRangeToString$LWS() {
9993
+ return distortionEntry$LWS;
9994
+ };
9995
+ }
9996
+ function initDistortionReportingObserverCtor$LWS({
9997
+ globalObject: {
9998
+ ReportingObserver: originalReportingObserverCtor$LWS
9999
+ }
10000
+ }) {
10001
+ // istanbul ignore if: ReportingObserver is always available in coverage environments
10002
+ if (typeof originalReportingObserverCtor$LWS !== 'function') {
10003
+ return noop$LWS$1;
10004
+ }
10005
+ function ReportingObserver$LWS(...args$LWS) {
10006
+ if (isGaterEnabledFeature$LWS('changesSince.264')) {
10007
+ throw new LockerSecurityError$LWS('Cannot create ReportingObserver: reporting API is disabled.');
10008
+ }
10009
+ return ReflectConstruct$LWS(originalReportingObserverCtor$LWS, args$LWS);
10010
+ }
10011
+ const distortionEntry$LWS = [originalReportingObserverCtor$LWS, ReportingObserver$LWS];
10012
+ return function distortionReportingObserverCtor$LWS() {
10013
+ return distortionEntry$LWS;
10014
+ };
10015
+ }
10016
+ function initDistortionReportingObserverProto$LWS({
10017
+ globalObject: {
10018
+ ReportingObserver: ReportingObserver$LWS
10019
+ }
10020
+ }) {
10021
+ // istanbul ignore if: ReportingObserver is always available in coverage environments
10022
+ if (typeof ReportingObserver$LWS !== 'function') {
10023
+ return noop$LWS$1;
10024
+ }
10025
+ const {
10026
+ prototype: originalPrototype$LWS
10027
+ } = ReportingObserver$LWS;
10028
+ const distortionEntry$LWS = [originalPrototype$LWS, isGaterEnabledFeature$LWS('changesSince.264') ? createRevokedProxy$LWS(originalPrototype$LWS) : originalPrototype$LWS];
10029
+ return function distortionReportingObserverProto$LWS() {
10030
+ return distortionEntry$LWS;
10031
+ };
10032
+ }
10033
+ const {
10034
+ isSharedElement: isSharedElement$8$LWS
10035
+ } = rootValidator$LWS;
10036
+ function initDistortionResizeObserverObserve$LWS({
10037
+ globalObject: {
10038
+ ResizeObserver: ResizeObserverCtor$LWS
10039
+ }
10040
+ }) {
10041
+ // istanbul ignore if: ResizeObserver is always available in coverage environments
10042
+ if (typeof ResizeObserverCtor$LWS !== 'function' || !ResizeObserverCtor$LWS.prototype.observe) {
10043
+ return noop$LWS$1;
10044
+ }
10045
+ const {
10046
+ observe: originalObserve$LWS
10047
+ } = ResizeObserverCtor$LWS.prototype;
10048
+ const distortionEntry$LWS = [originalObserve$LWS, function observe$LWS(...args$LWS) {
10049
+ const {
10050
+ 0: target$LWS
10051
+ } = args$LWS;
10052
+ if (isGaterEnabledFeature$LWS('changesSince.264') && target$LWS && isSharedElement$8$LWS(target$LWS)) {
10053
+ throw new LockerSecurityError$LWS(`Cannot observe resize on shared element ${getNodeName$LWS(target$LWS)}.`);
10054
+ }
10055
+ return ReflectApply$LWS$1(originalObserve$LWS, this, args$LWS);
8522
10056
  }];
8523
- return function distortionRangeInsertNode$LWS() {
10057
+ return function distortionResizeObserverObserve$LWS() {
8524
10058
  return distortionEntry$LWS;
8525
10059
  };
8526
10060
  }
8527
10061
  const {
8528
- isSharedElement: isSharedElement$5$LWS
10062
+ isSharedElement: isSharedElement$7$LWS
8529
10063
  } = rootValidator$LWS;
8530
- function createRangeProtoMethodDistortionFactoryInitializer$LWS(methodName$LWS) {
8531
- return function initDistortionRangeProtoMethod$LWS({
8532
- globalObject: {
8533
- Range: {
8534
- // @ts-ignore: Prevent index type error.
8535
- prototype: {
8536
- [methodName$LWS]: originalMethod$LWS
8537
- }
10064
+ function initDistortionSelectionAnchorNodeGetter$LWS({
10065
+ globalObject: {
10066
+ Selection: Selection$LWS
10067
+ }
10068
+ }) {
10069
+ const originalAnchorNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection$LWS.prototype, 'anchorNode');
10070
+ const distortionEntry$LWS = [originalAnchorNodeGetter$LWS, function anchorNode$LWS() {
10071
+ const node$LWS = ReflectApply$LWS$1(originalAnchorNodeGetter$LWS, this, []);
10072
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10073
+ if (node$LWS && isSharedElement$7$LWS(node$LWS)) {
10074
+ return null;
8538
10075
  }
8539
10076
  }
8540
- }) {
8541
- // Use a computed property to dynamically set the distortion function
8542
- // name without using `Reflect.defineProperty()`.
8543
- const {
8544
- [methodName$LWS]: distortion$LWS
8545
- } = {
8546
- [methodName$LWS](...args$LWS) {
8547
- // istanbul ignore else: needs default platform behavior test
8548
- if (args$LWS.length) {
8549
- const {
8550
- 0: node$LWS
8551
- } = args$LWS;
8552
- // istanbul ignore else: needs default platform behavior test
8553
- if (isSharedElement$5$LWS(node$LWS)) {
8554
- throw new LockerSecurityError$LWS(`Cannot call ${methodName$LWS} with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}.`);
8555
- }
8556
- }
8557
- return ReflectApply$LWS$1(originalMethod$LWS, this, args$LWS);
8558
- }
8559
- };
8560
- const distortionEntry$LWS = [originalMethod$LWS, distortion$LWS];
8561
- return function distortionRangeProtoMethod$LWS() {
8562
- return distortionEntry$LWS;
8563
- };
10077
+ return node$LWS;
10078
+ }];
10079
+ return function distortionSelectionAnchorNodeGetter$LWS() {
10080
+ return distortionEntry$LWS;
8564
10081
  };
8565
10082
  }
8566
- const initDistortionRangeSetEnd$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setEnd');
8567
- const initDistortionRangeSelectNode$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('selectNode');
8568
- const initDistortionRangeSelectNodeContents$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('selectNodeContents');
8569
- const initDistortionRangeSetEndAfter$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setEndAfter');
8570
- const initDistortionRangeSetEndBefore$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setEndBefore');
8571
- const initDistortionRangeSetStart$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStart');
8572
- const initDistortionRangeSetStartAfter$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStartAfter');
8573
- const initDistortionRangeSetStartBefore$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStartBefore');
8574
- const initDistortionRangeSurroundContents$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('surroundContents');
8575
10083
  const {
8576
- isSharedElement: isSharedElement$4$LWS
10084
+ isSharedElement: isSharedElement$6$LWS
8577
10085
  } = rootValidator$LWS;
8578
10086
  function initDistortionSelectionCollapse$LWS({
8579
10087
  globalObject: {
@@ -8590,8 +10098,8 @@ function initDistortionSelectionCollapse$LWS({
8590
10098
  0: node$LWS
8591
10099
  } = args$LWS;
8592
10100
  // The first arg to Selection.prototype.collapse is "Node | null"
8593
- if (node$LWS && isSharedElement$4$LWS(node$LWS)) {
8594
- throw new LockerSecurityError$LWS(`Cannot collapse selection to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
10101
+ if (node$LWS && isSharedElement$6$LWS(node$LWS)) {
10102
+ throw new LockerSecurityError$LWS(`Cannot collapse selection to ${getNodeName$LWS(node$LWS)}`);
8595
10103
  }
8596
10104
  }
8597
10105
  return ReflectApply$LWS$1(originalSelectionCollapse$LWS, this, args$LWS);
@@ -8601,7 +10109,7 @@ function initDistortionSelectionCollapse$LWS({
8601
10109
  };
8602
10110
  }
8603
10111
  const {
8604
- isSharedElement: isSharedElement$3$LWS
10112
+ isSharedElement: isSharedElement$5$LWS
8605
10113
  } = rootValidator$LWS;
8606
10114
  function initDistortionSelectionExtend$LWS({
8607
10115
  globalObject: {
@@ -8617,8 +10125,8 @@ function initDistortionSelectionExtend$LWS({
8617
10125
  const {
8618
10126
  0: node$LWS
8619
10127
  } = args$LWS;
8620
- if (isSharedElement$3$LWS(node$LWS)) {
8621
- throw new LockerSecurityError$LWS(`Cannot extend selection to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
10128
+ if (isSharedElement$5$LWS(node$LWS)) {
10129
+ throw new LockerSecurityError$LWS(`Cannot extend selection to ${getNodeName$LWS(node$LWS)}`);
8622
10130
  }
8623
10131
  }
8624
10132
  return ReflectApply$LWS$1(originalSelectionExtend$LWS, this, args$LWS);
@@ -8628,7 +10136,29 @@ function initDistortionSelectionExtend$LWS({
8628
10136
  };
8629
10137
  }
8630
10138
  const {
8631
- isSharedElement: isSharedElement$2$LWS
10139
+ isSharedElement: isSharedElement$4$LWS
10140
+ } = rootValidator$LWS;
10141
+ function initDistortionSelectionFocusNodeGetter$LWS({
10142
+ globalObject: {
10143
+ Selection: Selection$LWS
10144
+ }
10145
+ }) {
10146
+ const originalFocusNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection$LWS.prototype, 'focusNode');
10147
+ const distortionEntry$LWS = [originalFocusNodeGetter$LWS, function focusNode$LWS() {
10148
+ const node$LWS = ReflectApply$LWS$1(originalFocusNodeGetter$LWS, this, []);
10149
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10150
+ if (node$LWS && isSharedElement$4$LWS(node$LWS)) {
10151
+ return null;
10152
+ }
10153
+ }
10154
+ return node$LWS;
10155
+ }];
10156
+ return function distortionSelectionFocusNodeGetter$LWS() {
10157
+ return distortionEntry$LWS;
10158
+ };
10159
+ }
10160
+ const {
10161
+ isSharedElement: isSharedElement$3$LWS
8632
10162
  } = rootValidator$LWS;
8633
10163
  function initDistortionSelectionSelectAllChildren$LWS({
8634
10164
  globalObject: {
@@ -8644,8 +10174,8 @@ function initDistortionSelectionSelectAllChildren$LWS({
8644
10174
  const {
8645
10175
  0: node$LWS
8646
10176
  } = args$LWS;
8647
- if (isSharedElement$2$LWS(node$LWS)) {
8648
- throw new LockerSecurityError$LWS(`Cannot select all children of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
10177
+ if (isSharedElement$3$LWS(node$LWS)) {
10178
+ throw new LockerSecurityError$LWS(`Cannot select all children of ${getNodeName$LWS(node$LWS)}`);
8649
10179
  }
8650
10180
  }
8651
10181
  return ReflectApply$LWS$1(originalSelectionSelectAllChildren$LWS, this, args$LWS);
@@ -8655,7 +10185,7 @@ function initDistortionSelectionSelectAllChildren$LWS({
8655
10185
  };
8656
10186
  }
8657
10187
  const {
8658
- isSharedElement: isSharedElement$1$LWS
10188
+ isSharedElement: isSharedElement$2$LWS
8659
10189
  } = rootValidator$LWS;
8660
10190
  function initDistortionSelectionSetBaseAndExtent$LWS({
8661
10191
  globalObject: {
@@ -8674,11 +10204,11 @@ function initDistortionSelectionSetBaseAndExtent$LWS({
8674
10204
  0: anchorNode$LWS,
8675
10205
  2: focusNode$LWS
8676
10206
  } = args$LWS;
8677
- const anchorNodeIsShared$LWS = isSharedElement$1$LWS(anchorNode$LWS);
8678
- const focusNodeIsShared$LWS = isSharedElement$1$LWS(focusNode$LWS);
10207
+ const anchorNodeIsShared$LWS = isSharedElement$2$LWS(anchorNode$LWS);
10208
+ const focusNodeIsShared$LWS = isSharedElement$2$LWS(focusNode$LWS);
8679
10209
  if (anchorNodeIsShared$LWS || focusNodeIsShared$LWS) {
8680
10210
  const subject$LWS = anchorNodeIsShared$LWS ? anchorNode$LWS : focusNode$LWS;
8681
- throw new LockerSecurityError$LWS(`Cannot set selection with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, subject$LWS, [])}`);
10211
+ throw new LockerSecurityError$LWS(`Cannot set selection with ${getNodeName$LWS(subject$LWS)}`);
8682
10212
  }
8683
10213
  }
8684
10214
  return ReflectApply$LWS$1(originalSelectionSetBaseAndExtent$LWS, this, args$LWS);
@@ -8688,7 +10218,7 @@ function initDistortionSelectionSetBaseAndExtent$LWS({
8688
10218
  };
8689
10219
  }
8690
10220
  const {
8691
- isSharedElement: isSharedElement$LWS
10221
+ isSharedElement: isSharedElement$1$LWS
8692
10222
  } = rootValidator$LWS;
8693
10223
  function initDistortionSelectionSetPosition$LWS({
8694
10224
  globalObject: {
@@ -8705,7 +10235,7 @@ function initDistortionSelectionSetPosition$LWS({
8705
10235
  0: node$LWS
8706
10236
  } = args$LWS;
8707
10237
  // The first arg to Selection.prototype.setPosition is "Node | null"
8708
- if (node$LWS && isSharedElement$LWS(node$LWS)) {
10238
+ if (node$LWS && isSharedElement$1$LWS(node$LWS)) {
8709
10239
  throw new LockerSecurityError$LWS(`Cannot set position with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8710
10240
  }
8711
10241
  }
@@ -8715,6 +10245,38 @@ function initDistortionSelectionSetPosition$LWS({
8715
10245
  return distortionEntry$LWS;
8716
10246
  };
8717
10247
  }
10248
+ const {
10249
+ isSharedElement: isSharedElement$LWS
10250
+ } = rootValidator$LWS;
10251
+ function initDistortionSelectionToString$LWS({
10252
+ globalObject: {
10253
+ Selection: {
10254
+ prototype: {
10255
+ toString: originalSelectionToString$LWS
10256
+ }
10257
+ }
10258
+ }
10259
+ }) {
10260
+ const originalAnchorNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection.prototype, 'anchorNode');
10261
+ const originalFocusNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection.prototype, 'focusNode');
10262
+ const distortionEntry$LWS = [originalSelectionToString$LWS, function toString$LWS(...args$LWS) {
10263
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10264
+ const nodes$LWS = [ReflectApply$LWS$1(originalAnchorNodeGetter$LWS, this, []), ReflectApply$LWS$1(originalFocusNodeGetter$LWS, this, [])];
10265
+ for (let i$LWS = 0, {
10266
+ length: length$LWS
10267
+ } = nodes$LWS; i$LWS < length$LWS; i$LWS += 1) {
10268
+ const node$LWS = nodes$LWS[i$LWS];
10269
+ if (node$LWS && isSharedElement$LWS(node$LWS)) {
10270
+ throw new LockerSecurityError$LWS(`Cannot read selection content of ${getNodeName$LWS(node$LWS)}.`);
10271
+ }
10272
+ }
10273
+ }
10274
+ return ReflectApply$LWS$1(originalSelectionToString$LWS, this, args$LWS);
10275
+ }];
10276
+ return function distortionSelectionToString$LWS() {
10277
+ return distortionEntry$LWS;
10278
+ };
10279
+ }
8718
10280
  function initDistortionServiceWorkerContainerProto$LWS({
8719
10281
  globalObject: {
8720
10282
  ServiceWorkerContainer: ServiceWorkerContainer$LWS
@@ -8732,6 +10294,9 @@ function initDistortionServiceWorkerContainerProto$LWS({
8732
10294
  return distortionEntry$LWS;
8733
10295
  };
8734
10296
  }
10297
+ const {
10298
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$1$LWS
10299
+ } = rootValidator$LWS;
8735
10300
  function initDistortionShadowRootInnerHTMLSetter$LWS({
8736
10301
  document: document$LWS,
8737
10302
  globalObject: {
@@ -8748,10 +10313,19 @@ function initDistortionShadowRootInnerHTMLSetter$LWS({
8748
10313
  // MAY CONTAIN a custom element, which must be marked for
8749
10314
  // association to this sandbox.
8750
10315
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
8751
- ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML)]);
10316
+ value$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML);
10317
+ if (isGaterEnabledFeature$LWS('changesSince.264')) {
10318
+ if (isIframeSrcdocScriptAttack$1$LWS(value$LWS)) {
10319
+ throw new LockerSecurityError$LWS(`Cannot set 'innerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
10320
+ }
10321
+ }
10322
+ ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [value$LWS]);
8752
10323
  }];
8753
10324
  };
8754
10325
  }
10326
+ const {
10327
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS
10328
+ } = rootValidator$LWS;
8755
10329
  function initDistortionShadowRootSetHTMLUnsafe$LWS({
8756
10330
  document: document$LWS,
8757
10331
  globalObject: {
@@ -8770,12 +10344,17 @@ function initDistortionShadowRootSetHTMLUnsafe$LWS({
8770
10344
  key: key$LWS
8771
10345
  }) {
8772
10346
  return [originalSetHTMLUnsafe$LWS, function setHTMLUnsafe$LWS(value$LWS) {
10347
+ const normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(toSafeStringValue$LWS(value$LWS), key$LWS, ContentType$LWS.HTML);
10348
+ // istanbul ignore if: defense-in-depth - createHTML sanitizes srcdoc before this check runs, so the throw is unreachable in coverage environments
10349
+ if (isIframeSrcdocScriptAttack$LWS(normalizedValue$LWS)) {
10350
+ throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
10351
+ }
8773
10352
  // This must be called to signal to the virtual
8774
10353
  // CustomElementRegistry that the next thing created
8775
10354
  // MAY CONTAIN a custom element, which must be marked for
8776
10355
  // association to this sandbox.
8777
10356
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
8778
- ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML)]);
10357
+ ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
8779
10358
  }];
8780
10359
  };
8781
10360
  }
@@ -9166,6 +10745,27 @@ function initDistortionStorage$LWS({
9166
10745
  }
9167
10746
  const initDistortionLocalStorage$LWS = createDistortionStorageFactoryInitializer$LWS('localStorage');
9168
10747
  const initDistortionSessionStorage$LWS = createDistortionStorageFactoryInitializer$LWS('sessionStorage');
10748
+ function initDistortionSVGAnimatedStringBaseValSetter$LWS({
10749
+ globalObject: {
10750
+ SVGAnimatedString: SVGAnimatedString$LWS
10751
+ }
10752
+ }) {
10753
+ const originalBaseValSetter$LWS = ObjectLookupOwnSetter$LWS(SVGAnimatedString$LWS.prototype, 'baseVal');
10754
+ return function distortionSVGAnimatedStringBaseValSetter$LWS(record$LWS) {
10755
+ const scriptHrefDistortion$LWS = createScriptDistortion$LWS(record$LWS, 'href');
10756
+ const distortionEntry$LWS = [originalBaseValSetter$LWS, function baseVal$LWS(value$LWS) {
10757
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10758
+ const ownerElement$LWS = getSVGAnimatedStringOwner$LWS(this);
10759
+ if (ownerElement$LWS) {
10760
+ ReflectApply$LWS$1(scriptHrefDistortion$LWS, ownerElement$LWS, [value$LWS]);
10761
+ return;
10762
+ }
10763
+ }
10764
+ ReflectApply$LWS$1(originalBaseValSetter$LWS, this, [value$LWS]);
10765
+ }];
10766
+ return distortionEntry$LWS;
10767
+ };
10768
+ }
9169
10769
  function initDistortionSVGAnimateElementAttributeNameAttribute$LWS({
9170
10770
  globalObject: {
9171
10771
  Element: {
@@ -9318,13 +10918,18 @@ function initDistortionSVGScriptElementHrefGetter$LWS({
9318
10918
  const originalHrefGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGScriptElement$LWS.prototype, 'href');
9319
10919
  const distortionEntry$LWS = [originalHrefGetter$LWS, function href$LWS() {
9320
10920
  const url$LWS = getScriptURL$LWS(this);
10921
+ let result$LWS;
9321
10922
  // istanbul ignore else: needs default platform behavior test
9322
10923
  if (typeof url$LWS === 'string') {
9323
10924
  ReflectApply$LWS$1(originalSetAttribute$LWS, script$LWS, ['href', trusted.createScriptURL(url$LWS)]);
9324
- return ReflectApply$LWS$1(originalHrefGetter$LWS, script$LWS, []);
10925
+ result$LWS = ReflectApply$LWS$1(originalHrefGetter$LWS, script$LWS, []);
10926
+ } else {
10927
+ result$LWS = ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
9325
10928
  }
9326
- // istanbul ignore next: needs default platform behavior test
9327
- return ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
10929
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10930
+ trackSVGAnimatedStringOwner$LWS(result$LWS, this);
10931
+ }
10932
+ return result$LWS;
9328
10933
  }];
9329
10934
  return function distortionSVGScriptElementHrefGetter$LWS() {
9330
10935
  return distortionEntry$LWS;
@@ -9479,7 +11084,9 @@ function initDistortionURLCreateObjectURL$LWS({
9479
11084
  // user-code created global objects).
9480
11085
  const {
9481
11086
  isEqualDomString: isEqualDomString$LWS,
9482
- isInherentlyUnsecure: isInherentlyUnsecure$LWS
11087
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
11088
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11089
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
9483
11090
  } = getValidator$LWS(document$LWS, globalObject$LWS);
9484
11091
  return function distortionURLCreateObjectURL$LWS({
9485
11092
  key: key$LWS
@@ -9526,7 +11133,11 @@ function initDistortionURLCreateObjectURL$LWS({
9526
11133
  }
9527
11134
  const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
9528
11135
  const sanitized$LWS = sanitizer$LWS.sanitize(responseText$LWS);
9529
- if (!isEqualDomString$LWS(trusted.createHTML(responseText$LWS), trusted.createHTML(sanitized$LWS)) || isInherentlyUnsecure$LWS(responseText$LWS)) {
11136
+ if (!isEqualDomString$LWS(trusted.createHTML(responseText$LWS), trusted.createHTML(sanitized$LWS)) || isIframeSrcdocScriptAttack$LWS(responseText$LWS)) {
11137
+ URLRevokeObjectURL$LWS(outURL$LWS);
11138
+ throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
11139
+ }
11140
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(responseText$LWS) || isXMLNamespacedScriptAttack$LWS(responseText$LWS))) {
9530
11141
  URLRevokeObjectURL$LWS(outURL$LWS);
9531
11142
  throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
9532
11143
  }
@@ -9540,126 +11151,6 @@ function initDistortionURLCreateObjectURL$LWS({
9540
11151
  }];
9541
11152
  };
9542
11153
  }
9543
-
9544
- /**
9545
- * Recursively checks if an object contains a reference to the eval function
9546
- * @param obj - The object to check
9547
- * @param originalEval - The original eval function reference
9548
- * @returns true if eval is found, false otherwise
9549
- */
9550
- function containsEval$LWS(obj$LWS, originalEval$LWS) {
9551
- if (obj$LWS === originalEval$LWS) {
9552
- return true;
9553
- }
9554
- if (typeof obj$LWS === 'object' && obj$LWS !== null) {
9555
- for (const key$LWS in obj$LWS) {
9556
- if (ObjectHasOwn$LWS$1(obj$LWS, key$LWS)) {
9557
- if (containsEval$LWS(obj$LWS[key$LWS], originalEval$LWS)) {
9558
- return true;
9559
- }
9560
- }
9561
- }
9562
- }
9563
- return false;
9564
- }
9565
- function initDistortionWebAssemblyInstanceExportsGetter$LWS({
9566
- globalObject: {
9567
- WebAssembly: {
9568
- Instance: WebAssemblyInstance$LWS
9569
- },
9570
- eval: originalEval$LWS
9571
- }
9572
- }) {
9573
- const originalExportsGetter$LWS = ObjectLookupOwnGetter$LWS$1(WebAssemblyInstance$LWS.prototype, 'exports');
9574
- const distortionEntry$LWS = [originalExportsGetter$LWS, function exportsGetter$LWS() {
9575
- const exportsGetterThis$LWS = this;
9576
- const actualExportsDescriptors$LWS = ObjectGetOwnPropertyDescriptors$LWS(ReflectApply$LWS$1(originalExportsGetter$LWS, this, []));
9577
- const actualExportsKeys$LWS = ObjectKeys$LWS$1(actualExportsDescriptors$LWS);
9578
- const wrappedExports$LWS = {
9579
- __proto__: null
9580
- };
9581
- for (const key$LWS of actualExportsKeys$LWS) {
9582
- const descriptor$LWS = actualExportsDescriptors$LWS[key$LWS];
9583
- const {
9584
- value: originalValue$LWS
9585
- } = descriptor$LWS;
9586
- if (typeof originalValue$LWS === 'function') {
9587
- // These descriptors are writable: false, configurable: false, so we need to
9588
- // create a new descriptor for the safely wrapped function.
9589
- const safeDescriptor$LWS = _extends$LWS({
9590
- __proto__: null
9591
- }, descriptor$LWS);
9592
- safeDescriptor$LWS.value = function (...args$LWS) {
9593
- if (isGaterEnabledFeature$LWS('changesSince.260') && containsEval$LWS(args$LWS, originalEval$LWS)) {
9594
- throw new LockerSecurityError$LWS(`Cannot call WebAssembly.Instance exported function with eval.`);
9595
- }
9596
- return ReflectApply$LWS$1(originalValue$LWS, exportsGetterThis$LWS, args$LWS);
9597
- };
9598
- ReflectDefineProperty$LWS$1(wrappedExports$LWS, key$LWS, safeDescriptor$LWS);
9599
- } else {
9600
- ReflectDefineProperty$LWS$1(wrappedExports$LWS, key$LWS, descriptor$LWS);
9601
- }
9602
- }
9603
- return wrappedExports$LWS;
9604
- }];
9605
- return function distortionWebAssemblyInstanceExportsGetter$LWS() {
9606
- return distortionEntry$LWS;
9607
- };
9608
- }
9609
- function initDistortionWebAssemblyInstantiate$LWS({
9610
- globalObject: {
9611
- WebAssembly: {
9612
- instantiate: originalInstantiate$LWS
9613
- },
9614
- eval: originalEval$LWS
9615
- }
9616
- }) {
9617
- return function distortionWebAssemblyInstantiate$LWS() {
9618
- return [originalInstantiate$LWS, function instantiate$LWS(...args$LWS) {
9619
- const {
9620
- length: length$LWS
9621
- } = args$LWS;
9622
- if (length$LWS > 1) {
9623
- const {
9624
- 1: importObject$LWS
9625
- } = args$LWS;
9626
- if (importObject$LWS !== undefined && importObject$LWS !== null) {
9627
- if (isGaterEnabledFeature$LWS('changesSince.260') && containsEval$LWS(importObject$LWS, originalEval$LWS)) {
9628
- throw new LockerSecurityError$LWS('WebAssembly.instantiate: Import object contains eval, which is not allowed.');
9629
- }
9630
- }
9631
- }
9632
- return ReflectApply$LWS$1(originalInstantiate$LWS, this, args$LWS);
9633
- }];
9634
- };
9635
- }
9636
- function initDistortionWebAssemblyInstantiateStreaming$LWS({
9637
- globalObject: {
9638
- WebAssembly: {
9639
- instantiateStreaming: originalInstantiateStreaming$LWS
9640
- },
9641
- eval: originalEval$LWS
9642
- }
9643
- }) {
9644
- return function distortionWebAssemblyInstantiateStreaming$LWS() {
9645
- return [originalInstantiateStreaming$LWS, function instantiateStreaming$LWS(...args$LWS) {
9646
- const {
9647
- length: length$LWS
9648
- } = args$LWS;
9649
- if (length$LWS > 1) {
9650
- const {
9651
- 1: importObject$LWS
9652
- } = args$LWS;
9653
- if (importObject$LWS !== undefined && importObject$LWS !== null) {
9654
- if (isGaterEnabledFeature$LWS('changesSince.260') && containsEval$LWS(importObject$LWS, originalEval$LWS)) {
9655
- throw new LockerSecurityError$LWS('WebAssembly.instantiateStreaming: Import object contains eval, which is not allowed.');
9656
- }
9657
- }
9658
- }
9659
- return ReflectApply$LWS$1(originalInstantiateStreaming$LWS, this, args$LWS);
9660
- }];
9661
- };
9662
- }
9663
11154
  function initDistortionWindowFetch$LWS({
9664
11155
  globalObject: {
9665
11156
  fetch: originalFetch$LWS
@@ -9681,7 +11172,7 @@ function initDistortionWindowFetch$LWS({
9681
11172
  url$LWS = parsedURL$LWS.normalizedURL;
9682
11173
  args$LWS[0] = url$LWS;
9683
11174
  }
9684
- if (!isValidURL$LWS(parsedURL$LWS)) {
11175
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
9685
11176
  const {
9686
11177
  normalizedURL: normalizedURL$LWS
9687
11178
  } = parsedURL$LWS;
@@ -9723,7 +11214,7 @@ function initDistortionWindowFetchLater$LWS({
9723
11214
  url$LWS = parsedURL$LWS.normalizedURL;
9724
11215
  args$LWS[0] = url$LWS;
9725
11216
  }
9726
- if (!isValidURL$LWS(parsedURL$LWS)) {
11217
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
9727
11218
  const {
9728
11219
  normalizedURL: normalizedURL$LWS
9729
11220
  } = parsedURL$LWS;
@@ -9963,6 +11454,42 @@ function initDistortionWindowLengthGetter$LWS({
9963
11454
  return distortionEntry$LWS;
9964
11455
  };
9965
11456
  }
11457
+ function initDistortionWindowNameGetter$LWS({
11458
+ globalObject: globalObject$LWS
11459
+ }) {
11460
+ const originalNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(globalObject$LWS, 'name');
11461
+ // istanbul ignore if: currently unreachable via tests
11462
+ if (typeof originalNameGetter$LWS !== 'function') {
11463
+ return noop$LWS$1;
11464
+ }
11465
+ const distortionEntry$LWS = [originalNameGetter$LWS, function name$LWS() {
11466
+ if (this === rootWindow$LWS$1) {
11467
+ return '';
11468
+ }
11469
+ return ReflectApply$LWS$1(originalNameGetter$LWS, this, []);
11470
+ }];
11471
+ return function distortionWindowNameGetter$LWS() {
11472
+ return distortionEntry$LWS;
11473
+ };
11474
+ }
11475
+ function initDistortionWindowNameSetter$LWS({
11476
+ globalObject: globalObject$LWS
11477
+ }) {
11478
+ const originalNameSetter$LWS = ObjectLookupOwnSetter$LWS(globalObject$LWS, 'name');
11479
+ // istanbul ignore if: currently unreachable via tests
11480
+ if (typeof originalNameSetter$LWS !== 'function') {
11481
+ return noop$LWS$1;
11482
+ }
11483
+ const distortionEntry$LWS = [originalNameSetter$LWS, function name$LWS(value$LWS) {
11484
+ if (this === rootWindow$LWS$1) {
11485
+ return;
11486
+ }
11487
+ ReflectApply$LWS$1(originalNameSetter$LWS, this, [value$LWS]);
11488
+ }];
11489
+ return function distortionWindowNameSetter$LWS() {
11490
+ return distortionEntry$LWS;
11491
+ };
11492
+ }
9966
11493
  function initDistortionWindowOnrejectionhandled$LWS({
9967
11494
  globalObject: globalObject$LWS,
9968
11495
  globalObject: {
@@ -10002,25 +11529,32 @@ function initDistortionWindowOpen$LWS({
10002
11529
  }) {
10003
11530
  const distortionEntry$LWS = [originalWindowOpen$LWS, function open$LWS(...args$LWS) {
10004
11531
  const normalizedArgs$LWS = normalizeWindowOpenArguments$LWS(args$LWS);
10005
- const childWindow$LWS = ReflectApply$LWS$1(originalWindowOpen$LWS, this, normalizedArgs$LWS);
11532
+ // istanbul ignore next: resourceUrl default is not reachable via tests
10006
11533
  const {
10007
11534
  0: resourceUrl$LWS = ''
10008
11535
  } = 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
11536
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isAttemptingToExploitURL$LWS(resourceUrl$LWS)) {
11537
+ throw new LockerSecurityError$LWS(`Cannot open: ${resourceUrl$LWS}`);
11538
+ }
11539
+ // Validate that same-origin URLs don't target endpoints that could be exploited
11540
+ // via browsing contexts. Unlike fetch/XHR, browsing contexts (window.open, iframe)
11541
+ // can be manipulated by attackers to inject malicious content.
11542
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isSameOriginURL$LWS(resourceUrl$LWS)) {
11543
+ const parsedURL$LWS = parseURL$LWS(resourceUrl$LWS);
11544
+ if (!isValidBrowsingContextURL$LWS(parsedURL$LWS)) {
11545
+ throw new LockerSecurityError$LWS(`Cannot open disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
11546
+ }
11547
+ }
11548
+ const childWindow$LWS = ReflectApply$LWS$1(originalWindowOpen$LWS, this, normalizedArgs$LWS);
11549
+ // istanbul ignore next: behavior will not be tested in collection coverage
11550
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11551
+ if (isGaterEnabledFeature$LWS('changesSince.256')) {
11552
+ if (isSameOriginURL$LWS(resourceUrl$LWS)) {
11553
+ markForUnsafePropertyBlocking$LWS(childWindow$LWS);
11554
+ }
11555
+ } else {
10019
11556
  markForUnsafePropertyBlocking$LWS(childWindow$LWS);
10020
11557
  }
10021
- } else {
10022
- // When the gate is disabled, mark all child windows
10023
- markForUnsafePropertyBlocking$LWS(childWindow$LWS);
10024
11558
  }
10025
11559
  // W-14218118
10026
11560
  // If the target is '_self', '_parent', or '_top', only makes one request
@@ -10093,7 +11627,10 @@ function initDistortionWindowSetInterval$LWS({
10093
11627
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
10094
11628
  }) {
10095
11629
  return [originalSetInterval$LWS, function setInterval$LWS(...args$LWS) {
10096
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setInterval');
11630
+ // istanbul ignore next: behavior will not be tested in collection coverage
11631
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11632
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setInterval');
11633
+ }
10097
11634
  if (args$LWS.length) {
10098
11635
  const {
10099
11636
  0: callback$LWS
@@ -10107,12 +11644,8 @@ function initDistortionWindowSetInterval$LWS({
10107
11644
  // Defer transforming source text asynchronously.
10108
11645
  sandboxEvaluator$LWS(transformSourceText$LWS(sourceText$LWS), UNCOMPILED_CONTEXT$LWS);
10109
11646
  };
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
- }
11647
+ } else if (isGaterEnabledFeature$LWS('changesSince.256')) {
11648
+ throwIfUnsafeCallbackReference$LWS(callback$LWS);
10116
11649
  }
10117
11650
  }
10118
11651
  }
@@ -10131,7 +11664,10 @@ function initDistortionWindowSetTimeout$LWS({
10131
11664
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
10132
11665
  }) {
10133
11666
  return [originalSetTimeout$LWS, function setTimeout$LWS(...args$LWS) {
10134
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setTimeout');
11667
+ // istanbul ignore next: behavior will not be tested in collection coverage
11668
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11669
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setTimeout');
11670
+ }
10135
11671
  if (args$LWS.length) {
10136
11672
  const {
10137
11673
  0: callback$LWS
@@ -10145,12 +11681,8 @@ function initDistortionWindowSetTimeout$LWS({
10145
11681
  // Defer transforming source text asynchronously.
10146
11682
  sandboxEvaluator$LWS(transformSourceText$LWS(sourceText$LWS), UNCOMPILED_CONTEXT$LWS);
10147
11683
  };
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
- }
11684
+ } else if (isGaterEnabledFeature$LWS('changesSince.256')) {
11685
+ throwIfUnsafeCallbackReference$LWS(callback$LWS);
10154
11686
  }
10155
11687
  }
10156
11688
  }
@@ -10246,7 +11778,7 @@ function initDistortionXMLHttpRequestOpen$LWS({
10246
11778
  const url$LWS = args$LWS.length > 1 ? args$LWS[1] : undefined;
10247
11779
  if (url$LWS !== null && url$LWS !== undefined) {
10248
11780
  const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(url$LWS));
10249
- if (!isValidURL$LWS(parsedURL$LWS)) {
11781
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
10250
11782
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
10251
11783
  }
10252
11784
  args$LWS[1] = parsedURL$LWS.normalizedURL;
@@ -10266,12 +11798,17 @@ function replaceDocumentContent$LWS(doc$LWS, content$LWS) {
10266
11798
  }
10267
11799
  function initDistortionXMLHttpRequestResponseGetter$LWS({
10268
11800
  document: document$LWS,
11801
+ globalObject: globalObject$LWS,
10269
11802
  globalObject: {
10270
11803
  Document: Document$LWS,
10271
11804
  XMLHttpRequest: XMLHttpRequest$LWS
10272
11805
  }
10273
11806
  }) {
10274
11807
  const originalResponseGetter$LWS = ObjectLookupOwnGetter$LWS$1(XMLHttpRequest$LWS.prototype, 'response');
11808
+ const {
11809
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11810
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
11811
+ } = getValidator$LWS(document$LWS, globalObject$LWS);
10275
11812
  return function distortionXMLHttpRequestResponseGetter$LWS({
10276
11813
  key: key$LWS
10277
11814
  }) {
@@ -10285,6 +11822,9 @@ function initDistortionXMLHttpRequestResponseGetter$LWS({
10285
11822
  if (rawResponse$LWS instanceof Document$LWS) {
10286
11823
  const docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
10287
11824
  const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
11825
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
11826
+ throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest response using an unsecure ${toSafeTemplateStringValue$LWS(rawResponse$LWS)}.`);
11827
+ }
10288
11828
  return replaceDocumentContent$LWS(rawResponse$LWS, lwsInternalPolicy$LWS.createHTML(content$LWS, key$LWS, ContentType$LWS.HTML));
10289
11829
  }
10290
11830
  return rawResponse$LWS;
@@ -10293,11 +11833,16 @@ function initDistortionXMLHttpRequestResponseGetter$LWS({
10293
11833
  }
10294
11834
  function initDistortionXMLHttpRequestResponseXMLGetter$LWS({
10295
11835
  document: document$LWS,
11836
+ globalObject: globalObject$LWS,
10296
11837
  globalObject: {
10297
11838
  XMLHttpRequest: XMLHttpRequest$LWS
10298
11839
  }
10299
11840
  }) {
10300
11841
  const originalResponseXMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(XMLHttpRequest$LWS.prototype, 'responseXML');
11842
+ const {
11843
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11844
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
11845
+ } = getValidator$LWS(document$LWS, globalObject$LWS);
10301
11846
  return function distortionXMLHttpRequestResponseXMLGetter$LWS({
10302
11847
  key: key$LWS
10303
11848
  }) {
@@ -10310,6 +11855,9 @@ function initDistortionXMLHttpRequestResponseXMLGetter$LWS({
10310
11855
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
10311
11856
  const docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponseXML$LWS, []);
10312
11857
  const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
11858
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
11859
+ throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest responseXML using an unsecure ${toSafeTemplateStringValue$LWS(rawResponseXML$LWS)}.`);
11860
+ }
10313
11861
  return replaceDocumentContent$LWS(rawResponseXML$LWS, lwsInternalPolicy$LWS.createHTML(content$LWS, key$LWS, ContentType$LWS.HTML));
10314
11862
  }];
10315
11863
  };
@@ -10329,29 +11877,43 @@ initDistortionBroadcastChannelPostMessage$LWS,
10329
11877
  // CSSStyleRule
10330
11878
  initDistortionCSSStyleRuleStyleGetter$LWS,
10331
11879
  // Document
10332
- initDistortionDocumentDomainSetter$LWS, initDistortionDocumentOnsecuritypolicyviolation$LWS, initDistortionDocumentOpen$LWS,
11880
+ initDistortionDocumentCreateNodeIterator$LWS, initDistortionDocumentCreateTreeWalker$LWS, initDistortionDocumentDomainSetter$LWS, initDistortionDocumentOnsecuritypolicyviolation$LWS, initDistortionDocumentOpen$LWS,
10333
11881
  // Element
10334
- initDistortionElementAttributesGetter$LWS, initDistortionElementGetInnerHTML$LWS, initDistortionElementRemove$LWS, initDistortionElementReplaceChildren$LWS, initDistortionElementReplaceWith$LWS,
11882
+ initDistortionElementAttributesGetter$LWS, initDistortionElementGetInnerHTML$LWS, initDistortionElementInnerHTMLGetter$LWS, initDistortionElementOuterHTMLGetter$LWS, initDistortionElementRemove$LWS, initDistortionElementReplaceChildren$LWS, initDistortionElementReplaceWith$LWS,
10335
11883
  // Function
10336
11884
  initDistortionFunction$LWS,
10337
11885
  // History
10338
11886
  initDistortionHistoryPushState$LWS, initDistortionHistoryReplaceState$LWS,
10339
11887
  // HTMLElement
10340
- initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
11888
+ initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
10341
11889
  // HTMLIFrameElement
10342
11890
  initDistortionIFrameElementContentDocumentGetter$LWS, initDistortionIFrameElementContentWindowGetter$LWS, initDistortionHTMLIFrameElementSandboxGetter$LWS, initDistortionHTMLIFrameElementSandboxSetter$LWS, initDistortionHTMLIFrameElementSrcSetter$LWS,
10343
11891
  // HTMLLinkElement
10344
11892
  initDistortionHTMLLinkElementRelSetter$LWS, initDistortionHTMLLinkElementRelListSetter$LWS,
11893
+ // HTMLMetaElement
11894
+ initDistortionHTMLMetaElementContentGetter$LWS,
10345
11895
  // HTMLObjectElement
10346
11896
  initDistortionHTMLObjectElementDataSetter$LWS,
10347
11897
  // HTMLScriptElement
10348
- initDistortionHTMLScriptElementSrcGetter$LWS, initDistortionHTMLScriptElementTextContentGetter$LWS, initDistortionHTMLScriptElementTextContentSetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
11898
+ initDistortionHTMLScriptElementInnerTextGetter$LWS, initDistortionHTMLScriptElementInnerTextSetter$LWS, initDistortionHTMLScriptElementSrcGetter$LWS, initDistortionHTMLScriptElementTextContentGetter$LWS, initDistortionHTMLScriptElementTextContentSetter$LWS, initDistortionHTMLScriptElementTextGetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
10349
11899
  // IDBObjectStore
10350
11900
  initDistortionIDBObjectStoreAdd$LWS, initDistortionIDBObjectStorePut$LWS,
10351
11901
  // MessagePort
10352
11902
  initDistortionMessagePortPostMessage$LWS,
11903
+ // IntersectionObserver
11904
+ initDistortionIntersectionObserverObserve$LWS,
11905
+ // MutationObserver
11906
+ initDistortionMutationObserverObserve$LWS,
11907
+ // PerformanceObserver
11908
+ initDistortionPerformanceObserverObserve$LWS,
11909
+ // ReportingObserver
11910
+ initDistortionReportingObserverCtor$LWS, initDistortionReportingObserverProto$LWS,
11911
+ // ResizeObserver
11912
+ initDistortionResizeObserverObserve$LWS,
10353
11913
  // Navigator
10354
11914
  initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS,
11915
+ // Observable
11916
+ initDistortionObservableForEach$LWS, initDistortionObservableSubscribe$LWS,
10355
11917
  // Node
10356
11918
  initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
10357
11919
  // Performance
@@ -10359,19 +11921,21 @@ initDistortionPerformanceMark$LWS, initDistortionPerformanceMeasure$LWS,
10359
11921
  // PerformanceMark
10360
11922
  initDistortionPerformanceMarkCtor$LWS,
10361
11923
  // Promise
10362
- initDistortionPromiseTry$LWS,
11924
+ initDistortionPromiseAll$LWS, initDistortionPromiseAllSettled$LWS, initDistortionPromiseAny$LWS, initDistortionPromiseCatch$LWS, initDistortionPromiseFinally$LWS, initDistortionPromiseRace$LWS, initDistortionPromiseReject$LWS, initDistortionPromiseResolve$LWS, initDistortionPromiseThen$LWS, initDistortionPromiseTry$LWS, initDistortionPromiseWithResolvers$LWS,
10363
11925
  // Notification
10364
11926
  initDistortionNotificationCtor$LWS,
10365
11927
  // 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,
11928
+ 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
11929
  // Selection
10368
- initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS,
11930
+ initDistortionSelectionAnchorNodeGetter$LWS, initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionFocusNodeGetter$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS, initDistortionSelectionToString$LWS,
10369
11931
  // ServiceWorkerContainer
10370
11932
  initDistortionServiceWorkerContainerProto$LWS,
10371
11933
  // SharedWorker
10372
11934
  initDistortionSharedWorkerCtor$LWS, initDistortionSharedWorkerProto$LWS,
10373
11935
  // Storage
10374
11936
  initDistortionStorage$LWS, initDistortionStorageClear$LWS, initDistortionStorageGetItem$LWS, initDistortionStorageKey$LWS, initDistortionStorageLength$LWS, initDistortionStorageRemoveItem$LWS, initDistortionStorageSetItem$LWS,
11937
+ // SVGAnimatedString
11938
+ initDistortionSVGAnimatedStringBaseValSetter$LWS,
10375
11939
  // SVGAnimateElement
10376
11940
  initDistortionSVGAnimateElementFromAttribute$LWS, initDistortionSVGAnimateElementToAttribute$LWS, initDistortionSVGAnimateElementValuesAttribute$LWS,
10377
11941
  // SVGElement
@@ -10383,7 +11947,7 @@ initDistortionSVGUseElementHrefAttribute$LWS, initDistortionSVGUseElementXlinkHr
10383
11947
  // TrustedTypePolicyFactory
10384
11948
  initDistortionTrustedTypePolicyFactoryCreatePolicy$LWS,
10385
11949
  // Window
10386
- initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
11950
+ initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowNameGetter$LWS, initDistortionWindowNameSetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
10387
11951
  // Worker
10388
11952
  initDistortionWorkerCtor$LWS, initDistortionWorkerProto$LWS,
10389
11953
  // XHR
@@ -10404,21 +11968,33 @@ initDistortionDocumentCookieGetter$LWS, initDistortionDocumentCookieSetter$LWS,
10404
11968
  // DOMParser
10405
11969
  initDistortionDOMParserParseFromString$LWS,
10406
11970
  // 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,
11971
+ 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
11972
  // Eval
10409
11973
  initDistortionEval$LWS,
10410
11974
  // Event
10411
11975
  initDistortionEventComposedPath$LWS, initDistortionEventPathGetter$LWS,
10412
11976
  // EventTarget
10413
11977
  initDistortionEventTargetAddEventListener$LWS,
11978
+ // HTMLAnchorElement
11979
+ initDistortionHTMLAnchorElementHrefSetter$LWS,
11980
+ // HTMLBaseElement
11981
+ initDistortionHTMLBaseElementHrefSetter$LWS,
10414
11982
  // HTMLBodyElement
10415
11983
  initDistortionHTMLBodyElementOnrejectionhandled$LWS, initDistortionHTMLBodyElementOnstorage$LWS, initDistortionHTMLBodyElementOnunhandledrejection$LWS,
10416
11984
  // HTMLElement
10417
11985
  initDistortionHTMLElementCtor$LWS, initDistortionHTMLElementOnsecuritypolicyviolation$LWS,
11986
+ // HTMLButtonElement
11987
+ initDistortionHTMLButtonElementFormActionSetter$LWS,
11988
+ // HTMLFormElement
11989
+ initDistortionHTMLFormElementActionSetter$LWS,
11990
+ // HTMLInputElement
11991
+ initDistortionHTMLInputElementFormActionSetter$LWS,
10418
11992
  // HTMLFrameSetElement
10419
11993
  initDistortionHTMLFrameSetElementOnrejectionhandled$LWS, initDistortionHTMLFrameSetElementOnstorage$LWS, initDistortionHTMLFrameSetElementOnunhandledrejection$LWS,
10420
11994
  // HTMLScriptElement,
10421
11995
  initDistortionHTMLScriptElementSrcSetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
11996
+ // IDBFactory
11997
+ initDistortionIDBFactoryDatabases$LWS, initDistortionIDBFactoryDeleteDatabase$LWS, initDistortionIDBFactoryOpen$LWS,
10422
11998
  // MathMLElement
10423
11999
  initDistortionMathMLElementOnsecuritypolicyviolation$LWS,
10424
12000
  // NamedNodeMap
@@ -10439,8 +12015,6 @@ initDistortionSVGScriptElementHrefGetter$LWS, initDistortionSVGScriptElementHref
10439
12015
  initDistortionSVGSetElementAttributeNameAttribute$LWS, initDistortionSVGElementOnsecuritypolicyviolation$LWS,
10440
12016
  // URL
10441
12017
  initDistortionURLCreateObjectURL$LWS,
10442
- // WebAssembly
10443
- initDistortionWebAssemblyInstanceExportsGetter$LWS, initDistortionWebAssemblyInstantiate$LWS, initDistortionWebAssemblyInstantiateStreaming$LWS,
10444
12018
  // Window
10445
12019
  initDistortionWindowOnrejectionhandled$LWS, initDistortionWindowOnsecuritypolicyviolation$LWS, initDistortionWindowOnstorage$LWS, initDistortionWindowOnunhandledrejection$LWS, initDistortionWindowSetInterval$LWS, initDistortionWindowSetTimeout$LWS,
10446
12020
  // XHR
@@ -10454,7 +12028,7 @@ initDistortionElementAfter$LWS, initDistortionElementAppend$LWS, initDistortionE
10454
12028
  // initDistortionNodeAppendChild,
10455
12029
  initDistortionNodeInsertBefore$LWS]);
10456
12030
  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']]));
12031
+ 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'], [initDistortionHTMLScriptElementInnerTextSetter$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'], [initDistortionIntersectionObserverObserve$LWS, 'observers'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionPerformanceObserverObserve$LWS, 'observers'], [initDistortionResizeObserverObserve$LWS, 'observers'], [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
12032
  const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
10459
12033
  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
12034
  const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
@@ -10474,7 +12048,7 @@ const SVGElementProtoBlockedProperties$LWS = ['nonce'];
10474
12048
  const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
10475
12049
  const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
10476
12050
  const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
10477
- /*! version: 0.26.4 */
12051
+ /*! version: 0.28.1 */
10478
12052
 
10479
12053
  /*!
10480
12054
  * Copyright (C) 2021 salesforce.com, inc.
@@ -10483,7 +12057,7 @@ let pdpSchema$LWS;
10483
12057
  function getPdpSchema$LWS() {
10484
12058
  return pdpSchema$LWS;
10485
12059
  }
10486
- /*! version: 0.26.4 */
12060
+ /*! version: 0.28.1 */
10487
12061
 
10488
12062
  /*!
10489
12063
  * Copyright (C) 2019 salesforce.com, inc.
@@ -10684,15 +12258,12 @@ function createDistortionEntries$LWS(record$LWS, factories$LWS) {
10684
12258
  let distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS = proxyMaskedFunctionDistortion$LWS;
10685
12259
  if (ENABLE_DISTORTION_TOGGLE_SWITCHES$LWS && toggleSwitchName$LWS) {
10686
12260
  distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS = createDistortionToggleSwitchWrapper$LWS(record$LWS.key, toggleSwitchName$LWS, proxyMaskedFunctionDistortion$LWS, originalValue$LWS);
10687
- // If the distorted API originated in a window created via window.open or
10688
- // document.open, it may be marked as an unsafe property. If so, we need
10689
- // to transfer the original value's marker to the wrapped toggle switch
10690
- // function to ensure that the distortion itself can find the marker when
10691
- // checking if it needs to be blocked.
10692
- if (originalValue$LWS[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
10693
- const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(originalValue$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS);
10694
- ReflectDefineProperty$LWS$1(distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, descriptor$LWS);
10695
- }
12261
+ }
12262
+ // No longer the primary mitigation path as of 264; kept for compatibility. Excluded from coverage.
12263
+ // istanbul ignore next: behavior will not be tested in collection coverage
12264
+ if (!isGaterEnabledFeature$LWS('changesSince.262') && originalValue$LWS[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
12265
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(originalValue$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS);
12266
+ ReflectDefineProperty$LWS$1(distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, descriptor$LWS);
10696
12267
  }
10697
12268
  entries$LWS[entries$LWS.length] = [originalValue$LWS, toggleSwitchName$LWS ? distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS : proxyMaskedFunctionDistortion$LWS];
10698
12269
  } else {
@@ -15163,8 +16734,7 @@ function getESGlobalKeys$LWS(maxPerfMode$LWS) {
15163
16734
  // *** 19.1 Value Properties of the Global Object
15164
16735
  'globalThis', 'Infinity', 'NaN', 'undefined',
15165
16736
  // *** 19.2 Function Properties of the Global Object
15166
- // 'eval', // dangerous & Reflective
15167
- 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
16737
+ 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
15168
16738
  // *** 19.3 Constructor Properties of the Global Object
15169
16739
  // 'AggregateError', // Reflective
15170
16740
  // 'Array', // Reflective
@@ -15212,7 +16782,7 @@ function getESGlobalKeys$LWS(maxPerfMode$LWS) {
15212
16782
  }
15213
16783
  // These are foundational things that should never be wrapped but are equivalent
15214
16784
  // @TODO: Revisit this list.
15215
- const ReflectiveIntrinsicObjectNames$LWS = ['AggregateError', 'Array', 'Error', 'EvalError', 'Function', 'Object', 'Proxy', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', 'eval', 'globalThis'];
16785
+ const ReflectiveIntrinsicObjectNames$LWS = ['AggregateError', 'Array', 'Error', 'EvalError', 'Function', 'Object', 'Proxy', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', 'globalThis'];
15216
16786
  function getESGlobalsAndReflectiveIntrinsicObjectNames$LWS(maxPerfMode$LWS) {
15217
16787
  const ESGlobalKeys$LWS = getESGlobalKeys$LWS(maxPerfMode$LWS);
15218
16788
  return toSafeArray$LWS([...ESGlobalKeys$LWS, ...ReflectiveIntrinsicObjectNames$LWS]);
@@ -15837,7 +17407,7 @@ function toSourceText$LWS(value$LWS, sourceType$LWS) {
15837
17407
  // tools from mistaking the regexp or the replacement string for an
15838
17408
  // actual source mapping URL.
15839
17409
  /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
15840
- sourceText$LWS = `\n//# LWS Version = "0.26.4"\n${sourceText$LWS}`;
17410
+ sourceText$LWS = `\n//# LWS Version = "0.28.1"\n${sourceText$LWS}`;
15841
17411
  return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
15842
17412
  // Append "'use strict'" to the extracted function body so it is
15843
17413
  // evaluated in strict mode.
@@ -15851,6 +17421,14 @@ const IFRAME_KEEP_ALIVE_FLAG$LWS = LOCKER_UNMINIFIED_FLAG$LWS$1 && !false;
15851
17421
  // created distortion map.
15852
17422
  const rootDistortionMapSeedEntries$LWS = [[rootDocument$LWS, rootDocument$LWS], [rootWindowLocation$LWS, rootWindowLocation$LWS], [rootWindow$LWS$1, rootWindow$LWS$1]];
15853
17423
  const seenGlobalObjects$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
17424
+ // Tracks child windows and the last document for which distortions were
17425
+ // created. Unlike the non-iterable WeakSet above, this Map can be walked in
17426
+ // distortionCallback to eagerly detect navigations that the event-based
17427
+ // detection (unload → microtask → DOMContentLoaded) may have missed due to
17428
+ // timing: the microtask can run before the browser has replaced the document,
17429
+ // causing the check to bail out and the DOMContentLoaded listener to never be
17430
+ // attached.
17431
+ const childWindowDocuments$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
15854
17432
  function createGetVirtualEnvironment$LWS(record$LWS) {
15855
17433
  let virtualEnvironment$LWS;
15856
17434
  return () => {
@@ -15949,9 +17527,81 @@ function createVirtualEnvironment$LWS(record$LWS) {
15949
17527
  distortionCallback(originalTarget$LWS) {
15950
17528
  const distortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
15951
17529
  if (distortedTarget$LWS) {
17530
+ // The WindowProxy maintains identity across navigations, but
17531
+ // each navigation replaces the inner window and all its
17532
+ // realm-specific prototypes. Detect this by checking whether
17533
+ // the WindowProxy's current document has been registered in
17534
+ // the distortion map. If not, the inner window has been
17535
+ // replaced and we must create a secondary sandbox record for
17536
+ // the new realm before its undistorted prototypes can be
17537
+ // reached by sandboxed code.
17538
+ if (isGaterEnabledFeature$LWS('changesSince.262') && distortedTarget$LWS === originalTarget$LWS && seenGlobalObjects$LWS.has(originalTarget$LWS)) {
17539
+ try {
17540
+ const currentDoc$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
17541
+ // Needed when the membrane resolves the WindowProxy after navigation has
17542
+ // swapped `document` but before iframe `load` has seeded the new document
17543
+ // into `distortions`. Hard to cover in Karma: near-membrane often does not
17544
+ // invoke this callback for routine DOM work, and identity (distortedTarget
17545
+ // === originalTarget) plus seenGlobalObjects is narrow; native
17546
+ // document.open/write on the child from host code is one way to advance
17547
+ // the document without relying on iframe load ordering.
17548
+ // istanbul ignore next: behavior cannot be tested in collection coverage
17549
+ if (!distortions$LWS.has(currentDoc$LWS)) {
17550
+ createSecondaryWindowSandboxRecord$LWS({
17551
+ context: EMPTY_OBJECT$LWS,
17552
+ document: currentDoc$LWS,
17553
+ globalObject: originalTarget$LWS,
17554
+ key: key$LWS,
17555
+ type: type$LWS
17556
+ }, _root$LWS);
17557
+ }
17558
+ } catch (_unused1$LWS) {
17559
+ // Cross-origin window — document access throws.
17560
+ // Opaque sandbox record was already created on first
17561
+ // encounter; nothing more to do.
17562
+ }
17563
+ }
15952
17564
  return distortedTarget$LWS;
15953
17565
  }
15954
17566
  if (typeof originalTarget$LWS === 'function') {
17567
+ // When a child window navigates, the browser replaces the
17568
+ // inner window and all its realm-specific built-ins (eval,
17569
+ // Function, Document.prototype, etc.). Near-membrane caches
17570
+ // the WindowProxy's proxy pointer, so distortionCallback is
17571
+ // never re-invoked for the WindowProxy itself — but the NEW
17572
+ // built-ins ARE seen as unknown objects here. Walk the child
17573
+ // window map and, for any window whose document has changed
17574
+ // since we last created distortions, eagerly create a
17575
+ // secondary sandbox record. This populates the distortion
17576
+ // map with entries for the new realm's objects so the
17577
+ // re-lookup below can succeed.
17578
+ if (isGaterEnabledFeature$LWS('changesSince.262') && childWindowDocuments$LWS.size > 0) {
17579
+ for (const [childGlobalObject$LWS, lastDocument$LWS] of childWindowDocuments$LWS) {
17580
+ // Only process child windows belonging to this
17581
+ // sandbox (each sandbox has its own distortion map).
17582
+ if (!distortions$LWS.has(childGlobalObject$LWS)) {
17583
+ continue;
17584
+ }
17585
+ try {
17586
+ const currentDoc$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, childGlobalObject$LWS, []);
17587
+ if (currentDoc$LWS !== lastDocument$LWS) {
17588
+ createSecondaryWindowSandboxRecord$LWS({
17589
+ context: EMPTY_OBJECT$LWS,
17590
+ document: currentDoc$LWS,
17591
+ globalObject: childGlobalObject$LWS,
17592
+ key: key$LWS,
17593
+ type: type$LWS
17594
+ }, _root$LWS);
17595
+ const newDistortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
17596
+ if (newDistortedTarget$LWS) {
17597
+ return newDistortedTarget$LWS;
17598
+ }
17599
+ }
17600
+ } catch (_unused35$LWS) {
17601
+ // Cross-origin window — document access throws.
17602
+ }
17603
+ }
17604
+ }
15955
17605
  return originalTarget$LWS;
15956
17606
  }
15957
17607
  // Perform the first own property check in a try-catch to avoid
@@ -15964,7 +17614,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15964
17614
  if (!ObjectHasOwn$LWS$1(originalTarget$LWS, 'location')) {
15965
17615
  return originalTarget$LWS;
15966
17616
  }
15967
- } catch (_unused1$LWS) {
17617
+ } catch (_unused36$LWS) {
15968
17618
  // Likely an opaque object of a cross-origin window.
15969
17619
  // 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
15970
17620
  return originalTarget$LWS;
@@ -15980,7 +17630,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15980
17630
  // not a window object, or if it is an opaque cross-origin window.
15981
17631
  originalTargetDocument$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
15982
17632
  originalTargetWindow$LWS = originalTarget$LWS;
15983
- } catch (_unused35$LWS) {
17633
+ } catch (_unused37$LWS) {
15984
17634
  try {
15985
17635
  // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
15986
17636
  if (ReflectApply$LWS$1(WindowLocationGetter$LWS, originalTarget$LWS, [])) {
@@ -15992,7 +17642,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15992
17642
  return originalTarget$LWS;
15993
17643
  }
15994
17644
  // eslint-disable-next-line no-empty
15995
- } catch (_unused36$LWS) {}
17645
+ } catch (_unused38$LWS) {}
15996
17646
  }
15997
17647
  // Check if originalTarget is a document and get its defaultView.
15998
17648
  } else if ('defaultView' in originalTarget$LWS) {
@@ -16006,7 +17656,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
16006
17656
  // This will throw if `originalTarget` is not a document object.
16007
17657
  defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, originalTarget$LWS, []);
16008
17658
  // eslint-disable-next-line no-empty
16009
- } catch (_unused37$LWS) {}
17659
+ } catch (_unused39$LWS) {}
16010
17660
  if (defaultView$LWS) {
16011
17661
  originalTargetDocument$LWS = originalTarget$LWS;
16012
17662
  originalTargetWindow$LWS = defaultView$LWS;
@@ -16242,6 +17892,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16242
17892
  // virtual environment distortion callback by adding them to the root window's
16243
17893
  // distortion map.
16244
17894
  distortions$LWS.set(document$LWS, document$LWS);
17895
+ childWindowDocuments$LWS.set(globalObject$LWS, document$LWS);
16245
17896
  distortions$LWS.set(location$LWS, location$LWS);
16246
17897
  const seenGlobalObject$LWS = seenGlobalObjects$LWS.has(globalObject$LWS);
16247
17898
  if (!seenGlobalObject$LWS) {
@@ -16295,7 +17946,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16295
17946
  type: type$LWS
16296
17947
  }, _root$LWS);
16297
17948
  }
16298
- } catch (_unused38$LWS) {
17949
+ } catch (_unused40$LWS) {
16299
17950
  // istanbul ignore next: this is a safety precaution that is unreachable via tests
16300
17951
  createOpaqueSecondaryWindowSandboxRecord$LWS({
16301
17952
  globalObject: globalObject$LWS,
@@ -16334,7 +17985,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16334
17985
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
16335
17986
  // istanbul ignore next: currently unreachable via tests
16336
17987
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
16337
- } catch (_unused39$LWS) {
17988
+ } catch (_unused41$LWS) {
16338
17989
  // istanbul ignore next: this is a safety precaution that is unreachable via tests
16339
17990
  createOpaqueSecondaryWindowSandboxRecord$LWS({
16340
17991
  globalObject: globalObject$LWS,
@@ -16590,7 +18241,7 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
16590
18241
  depRegistry$LWS.set(dep$LWS, secureDep$LWS);
16591
18242
  return secureDep$LWS;
16592
18243
  }
16593
- /*! version: 0.26.4 */
18244
+ /*! version: 0.28.1 */
16594
18245
 
16595
18246
  export { $LWS, CORE_SANDBOX_KEY$LWS as CORE_SANDBOX_KEY, createRootWindowSandboxRecord$LWS as createRootWindowSandboxRecord, evaluateFunction$LWS as evaluateFunction, evaluateInCoreSandbox$LWS as evaluateInCoreSandbox, evaluateInSandbox$LWS as evaluateInSandbox, trusted, wrapDependency$LWS as wrapDependency };
16596
18247
  //# sourceMappingURL=lockerSandbox.js.map