@lwrjs/client-modules 0.22.14 → 0.22.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -582,6 +582,7 @@ const {
582
582
  indexOf: StringProtoIndexOf$LWS,
583
583
  lastIndexOf: StringProtoLastIndexOf$LWS,
584
584
  match: StringProtoMatch$LWS,
585
+ normalize: StringProtoNormalize$LWS,
585
586
  replace: StringProtoReplace$LWS,
586
587
  slice: StringProtoSlice$LWS$1,
587
588
  split: StringProtoSplit$LWS,
@@ -1509,7 +1510,7 @@ const {
1509
1510
  const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
1510
1511
  const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
1511
1512
  const trustedResources$LWS = toSafeSet$LWS(new SetCtor$LWS$1());
1512
- /*! version: 0.26.4 */
1513
+ /*! version: 0.27.7 */
1513
1514
 
1514
1515
  /*!
1515
1516
  * Copyright (C) 2019 salesforce.com, inc.
@@ -1571,86 +1572,6 @@ const {
1571
1572
  append: DocumentFragmentProtoAppend$LWS,
1572
1573
  getElementById: DocumentFragmentProtoGetElementById$LWS
1573
1574
  } = DocumentFragment.prototype;
1574
- const {
1575
- prototype: ElementProto$LWS
1576
- } = Element;
1577
- const ElementAriaAttributesToPropertyName$LWS = {
1578
- __proto__: null,
1579
- 'aria-activedescendant': 'ariaActiveDescendant',
1580
- 'aria-atomic': 'ariaAtomic',
1581
- 'aria-autocomplete': 'ariaAutoComplete',
1582
- 'aria-busy': 'ariaBusy',
1583
- 'aria-checked': 'ariaChecked',
1584
- 'aria-colcount': 'ariaColCount',
1585
- 'aria-colindex': 'ariaColIndex',
1586
- 'aria-colspan': 'ariaColSpan',
1587
- 'aria-controls': 'ariaControls',
1588
- 'aria-current': 'ariaCurrent',
1589
- 'aria-describedby': 'ariaDescribedBy',
1590
- 'aria-details': 'ariaDetails',
1591
- 'aria-disabled': 'ariaDisabled',
1592
- 'aria-errormessage': 'ariaErrorMessage',
1593
- 'aria-expanded': 'ariaExpanded',
1594
- 'aria-flowto': 'ariaFlowTo',
1595
- 'aria-haspopup': 'ariaHasPopup',
1596
- 'aria-hidden': 'ariaHidden',
1597
- 'aria-invalid': 'ariaInvalid',
1598
- 'aria-keyshortcuts': 'ariaKeyShortcuts',
1599
- 'aria-label': 'ariaLabel',
1600
- 'aria-labelledby': 'ariaLabelledBy',
1601
- 'aria-level': 'ariaLevel',
1602
- 'aria-live': 'ariaLive',
1603
- 'aria-modal': 'ariaModal',
1604
- 'aria-multiline': 'ariaMultiLine',
1605
- 'aria-multiselectable': 'ariaMultiSelectable',
1606
- 'aria-orientation': 'ariaOrientation',
1607
- 'aria-owns': 'ariaOwns',
1608
- 'aria-placeholder': 'ariaPlaceholder',
1609
- 'aria-posinset': 'ariaPosInSet',
1610
- 'aria-pressed': 'ariaPressed',
1611
- 'aria-readonly': 'ariaReadOnly',
1612
- 'aria-relevant': 'ariaRelevant',
1613
- 'aria-required': 'ariaRequired',
1614
- 'aria-roledescription': 'ariaRoleDescription',
1615
- 'aria-rowcount': 'ariaRowCount',
1616
- 'aria-rowindex': 'ariaRowIndex',
1617
- 'aria-rowspan': 'ariaRowSpan',
1618
- 'aria-selected': 'ariaSelected',
1619
- 'aria-setsize': 'ariaSetSize',
1620
- 'aria-sort': 'ariaSort',
1621
- 'aria-valuemax': 'ariaValueMax',
1622
- 'aria-valuemin': 'ariaValueMin',
1623
- 'aria-valuenow': 'ariaValueNow',
1624
- 'aria-valuetext': 'ariaValueText'
1625
- };
1626
- // Used by '@locker/near-membrane-dom'.
1627
- const {
1628
- remove: ElementProtoRemove$LWS$1
1629
- } = ElementProto$LWS;
1630
- const {
1631
- closest: ElementProtoClosest$LWS,
1632
- getAttribute: ElementProtoGetAttribute$LWS,
1633
- getAttributeNode: ElementProtoGetAttributeNode$LWS,
1634
- getAttributeNodeNS: ElementProtoGetAttributeNodeNS$LWS,
1635
- hasAttribute: ElementProtoHasAttribute$LWS,
1636
- querySelector: ElementProtoQuerySelector$LWS,
1637
- querySelectorAll: ElementProtoQuerySelectorAll$LWS,
1638
- removeAttribute: ElementProtoRemoveAttribute$LWS,
1639
- removeAttributeNode: ElementProtoRemoveAttributeNode$LWS,
1640
- removeAttributeNS: ElementProtoRemoveAttributeNS$LWS,
1641
- setAttribute: ElementProtoSetAttribute$LWS$1,
1642
- setAttributeNS: ElementProtoSetAttributeNS$LWS,
1643
- toggleAttribute: ElementProtoToggleAttribute$LWS
1644
- } = ElementProto$LWS;
1645
- const {
1646
- get: ElementProtoInnerHTMLGetter$LWS,
1647
- set: ElementProtoInnerHTMLSetter$LWS
1648
- } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'innerHTML');
1649
- const ElementProtoNamespaceURIGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'namespaceURI');
1650
- const {
1651
- get: ElementProtoOuterHTMLGetter$LWS
1652
- } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'outerHTML');
1653
- const ElementProtoTagNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'tagName');
1654
1575
 
1655
1576
  // Check for the noopener feature being enabled:
1656
1577
  // - noopener
@@ -1730,17 +1651,9 @@ function initWindowOpenChildWindow$LWS(win$LWS, url$LWS) {
1730
1651
  }
1731
1652
  return win$LWS;
1732
1653
  }
1733
- // This is only used by window.open() and document.open(x, y, z) distortions to
1734
- // block access to unsafe properties of the child window that's returned by those
1735
- // APIs. These properties must be otherwise available directly on the sandbox window,
1736
- // or via iframe.contentWindow created within the sandbox.
1737
- // To be effective, we mark the blocked thing with a symbol, so that can be detected by
1738
- // the distortion, otherwise the distortion will replace whatever we define here with
1739
- // whatever it provides.
1740
1654
  const CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS = SymbolFor$LWS$1('@@lwsChildWindowBlockedProperty');
1741
1655
  const CHILD_WINDOW_BLOCKED_PROPERTIES$LWS = ['eval', 'Function', 'setInterval', 'setTimeout'];
1742
1656
  function markForUnsafePropertyBlocking$LWS(childWindow$LWS) {
1743
- // If this function somehow receives the rootWindow, just return it.
1744
1657
  if (!childWindow$LWS || childWindow$LWS === rootWindow$LWS$1) {
1745
1658
  return childWindow$LWS;
1746
1659
  }
@@ -1759,23 +1672,11 @@ function markForUnsafePropertyBlocking$LWS(childWindow$LWS) {
1759
1672
  if (typeof childWindow$LWS[blocked$LWS] === 'function') {
1760
1673
  descriptor$LWS.value = replacement$LWS;
1761
1674
  }
1762
- /* Eventually there will be other types of blocked properties
1763
- else {
1764
- descriptor.get = replacement;
1765
- }
1766
- */
1767
1675
  ReflectDefineProperty$LWS$1(childWindow$LWS, blocked$LWS, descriptor$LWS);
1768
1676
  }
1769
1677
  return childWindow$LWS;
1770
1678
  }
1771
1679
  function throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, name$LWS) {
1772
- // This seemingly strange approach is necessary because this distortion will
1773
- // otherwise replace whatever was force-assigned to the childWindow property
1774
- // by markForUnsafePropertyBlocking with this distortion, effectively acting
1775
- // as an UNDO of markForUnsafePropertyBlocking(). We have to dig into
1776
- // the sandbox's global object and look at the actual property to see if it was
1777
- // marked for unsafe property blocking, because indirect property (ie. eval) will bypass
1778
- // any "this" property lookups.
1779
1680
  const getPossiblyBlockedPropertyFromSandbox$LWS = virtualEnvironmentEvaluator$LWS(`() => globalThis.${name$LWS}`);
1780
1681
  // istanbul ignore else: it is unnecessary to cover the else path here
1781
1682
  if (getPossiblyBlockedPropertyFromSandbox$LWS()[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
@@ -1845,6 +1746,153 @@ function normalizeWindowOpenArguments$LWS(args$LWS) {
1845
1746
  }
1846
1747
  return normalizedArgs$LWS;
1847
1748
  }
1749
+ const {
1750
+ // We don't cherry-pick the 'userAgent' property from `navigator` here
1751
+ // to avoid triggering its getter.
1752
+ navigator: navigator$LWS$1,
1753
+ navigator: {
1754
+ userAgentData: userAgentData$LWS$1
1755
+ }
1756
+ } = rootWindow$LWS$1;
1757
+ // The user-agent client hints API is experimental and subject to change.
1758
+ // https://caniuse.com/mdn-api_navigator_useragentdata
1759
+ // istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
1760
+ const brands$LWS$1 = userAgentData$LWS$1 == null ? void 0 : userAgentData$LWS$1.brands;
1761
+ // Note: Chromium identifies itself as Chrome in its user-agent string.
1762
+ // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent
1763
+ const chromiumUserAgentRegExp$LWS$1 = / (?:Headless)?Chrome\/\d+/;
1764
+ const webKitUserAgentRegExp$LWS = /WebKit/i;
1765
+ let userAgent$LWS$1;
1766
+ function getUserAgent$LWS$1() {
1767
+ if (userAgent$LWS$1 === undefined) {
1768
+ userAgent$LWS$1 = navigator$LWS$1.userAgent;
1769
+ }
1770
+ return userAgent$LWS$1;
1771
+ }
1772
+ const CUSTOM_ELEMENT_REGISTRY_ATTRIBUTE_NAME$LWS = LOCKER_SERVICE_KEY_LOWERED$LWS;
1773
+ // Used by '@locker/near-membrane-dom'.
1774
+ const IS_CHROMIUM_BROWSER$LWS$1 =
1775
+ // While experimental, `navigator.userAgentData.brands` may be defined as an
1776
+ // empty array in headless Chromium based browsers.
1777
+ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ?
1778
+ // Use user-agent client hints API if available to avoid deprecation
1779
+ // warnings.
1780
+ // https://developer.mozilla.org/en-US/docs/Web/API/User-Agent_Client_Hints_API
1781
+ // istanbul ignore next: this code is not reachable in the coverage run.
1782
+ ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
1783
+ // prettier-ignore
1784
+ // istanbul ignore next: this code is not reachable in the coverage run.
1785
+ item$LWS => (item$LWS == null ? void 0 : item$LWS.brand) === 'Chromium']) !== undefined :
1786
+ // Fallback to a standard user-agent string sniff.
1787
+ ReflectApply$LWS$1(RegExpProtoTest$LWS$1, chromiumUserAgentRegExp$LWS$1, [getUserAgent$LWS$1()]);
1788
+ const IS_WEBKIT_BROWSER$LWS = !IS_CHROMIUM_BROWSER$LWS$1 && (
1789
+ // istanbul ignore next: this code is not reachable in the coverage run.
1790
+ ArrayIsArray$LWS$1(brands$LWS$1) && brands$LWS$1.length ? ReflectApply$LWS$1(ArrayProtoFind$LWS$1, brands$LWS$1, [
1791
+ // istanbul ignore next
1792
+ item$LWS => {
1793
+ const brand$LWS = item$LWS == null ? void 0 : item$LWS.brand;
1794
+ return typeof brand$LWS === 'string' && ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [brand$LWS]);
1795
+ }]) !== undefined : ReflectApply$LWS$1(RegExpProtoTest$LWS$1, webKitUserAgentRegExp$LWS, [getUserAgent$LWS$1()]));
1796
+ // Pattern to match CSP nonce values, e.g., 'nonce-abc123'
1797
+ // The nonce value is base64 encoded and may contain alphanumeric characters, +, /, and =
1798
+ const NONCE_PATTERN$LWS = /'nonce-[A-Za-z0-9+/=]+'/g;
1799
+ const BLOCKED_ELEMENTS$LWS = toSafeSet$LWS(new SetCtor$LWS$1(['base']));
1800
+ function isBlockedElement$LWS(tagName$LWS) {
1801
+ return BLOCKED_ELEMENTS$LWS.has(tagName$LWS);
1802
+ }
1803
+ const {
1804
+ prototype: ElementProto$LWS
1805
+ } = Element;
1806
+ const ElementAriaAttributesToPropertyName$LWS = {
1807
+ __proto__: null,
1808
+ 'aria-activedescendant': 'ariaActiveDescendant',
1809
+ 'aria-atomic': 'ariaAtomic',
1810
+ 'aria-autocomplete': 'ariaAutoComplete',
1811
+ 'aria-busy': 'ariaBusy',
1812
+ 'aria-checked': 'ariaChecked',
1813
+ 'aria-colcount': 'ariaColCount',
1814
+ 'aria-colindex': 'ariaColIndex',
1815
+ 'aria-colspan': 'ariaColSpan',
1816
+ 'aria-controls': 'ariaControls',
1817
+ 'aria-current': 'ariaCurrent',
1818
+ 'aria-describedby': 'ariaDescribedBy',
1819
+ 'aria-details': 'ariaDetails',
1820
+ 'aria-disabled': 'ariaDisabled',
1821
+ 'aria-errormessage': 'ariaErrorMessage',
1822
+ 'aria-expanded': 'ariaExpanded',
1823
+ 'aria-flowto': 'ariaFlowTo',
1824
+ 'aria-haspopup': 'ariaHasPopup',
1825
+ 'aria-hidden': 'ariaHidden',
1826
+ 'aria-invalid': 'ariaInvalid',
1827
+ 'aria-keyshortcuts': 'ariaKeyShortcuts',
1828
+ 'aria-label': 'ariaLabel',
1829
+ 'aria-labelledby': 'ariaLabelledBy',
1830
+ 'aria-level': 'ariaLevel',
1831
+ 'aria-live': 'ariaLive',
1832
+ 'aria-modal': 'ariaModal',
1833
+ 'aria-multiline': 'ariaMultiLine',
1834
+ 'aria-multiselectable': 'ariaMultiSelectable',
1835
+ 'aria-orientation': 'ariaOrientation',
1836
+ 'aria-owns': 'ariaOwns',
1837
+ 'aria-placeholder': 'ariaPlaceholder',
1838
+ 'aria-posinset': 'ariaPosInSet',
1839
+ 'aria-pressed': 'ariaPressed',
1840
+ 'aria-readonly': 'ariaReadOnly',
1841
+ 'aria-relevant': 'ariaRelevant',
1842
+ 'aria-required': 'ariaRequired',
1843
+ 'aria-roledescription': 'ariaRoleDescription',
1844
+ 'aria-rowcount': 'ariaRowCount',
1845
+ 'aria-rowindex': 'ariaRowIndex',
1846
+ 'aria-rowspan': 'ariaRowSpan',
1847
+ 'aria-selected': 'ariaSelected',
1848
+ 'aria-setsize': 'ariaSetSize',
1849
+ 'aria-sort': 'ariaSort',
1850
+ 'aria-valuemax': 'ariaValueMax',
1851
+ 'aria-valuemin': 'ariaValueMin',
1852
+ 'aria-valuenow': 'ariaValueNow',
1853
+ 'aria-valuetext': 'ariaValueText'
1854
+ };
1855
+ // Used by '@locker/near-membrane-dom'.
1856
+ const {
1857
+ remove: ElementProtoRemove$LWS$1
1858
+ } = ElementProto$LWS;
1859
+ const {
1860
+ closest: ElementProtoClosest$LWS,
1861
+ getAttribute: ElementProtoGetAttribute$LWS,
1862
+ getAttributeNode: ElementProtoGetAttributeNode$LWS,
1863
+ getAttributeNodeNS: ElementProtoGetAttributeNodeNS$LWS,
1864
+ hasAttribute: ElementProtoHasAttribute$LWS,
1865
+ querySelector: ElementProtoQuerySelector$LWS,
1866
+ querySelectorAll: ElementProtoQuerySelectorAll$LWS,
1867
+ removeAttribute: ElementProtoRemoveAttribute$LWS,
1868
+ removeAttributeNode: ElementProtoRemoveAttributeNode$LWS,
1869
+ removeAttributeNS: ElementProtoRemoveAttributeNS$LWS,
1870
+ setAttribute: ElementProtoSetAttribute$LWS$1,
1871
+ setAttributeNS: ElementProtoSetAttributeNS$LWS,
1872
+ toggleAttribute: ElementProtoToggleAttribute$LWS
1873
+ } = ElementProto$LWS;
1874
+ const {
1875
+ get: ElementProtoInnerHTMLGetter$LWS,
1876
+ set: ElementProtoInnerHTMLSetter$LWS
1877
+ } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'innerHTML');
1878
+ const ElementProtoNamespaceURIGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'namespaceURI');
1879
+ const {
1880
+ get: ElementProtoOuterHTMLGetter$LWS
1881
+ } = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'outerHTML');
1882
+ const ElementProtoTagNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'tagName');
1883
+ /**
1884
+ * Removes CSP nonce patterns from a string.
1885
+ *
1886
+ * CSP nonces (e.g., 'nonce-abc123') are cryptographic tokens used to allowlist
1887
+ * inline scripts/styles. This function strips them from serialized content to
1888
+ * prevent nonce exfiltration attacks.
1889
+ *
1890
+ * @param content - The string to sanitize (e.g., innerHTML, CSP content attribute)
1891
+ * @returns The string with all 'nonce-xxx' patterns removed
1892
+ */
1893
+ function removeNoncePatterns$LWS(content$LWS) {
1894
+ return ReflectApply$LWS$1(StringProtoReplace$LWS, content$LWS, [NONCE_PATTERN$LWS, '']);
1895
+ }
1848
1896
  const HTMLElement$LWS = getUnmaskedFunction$LWS(rootWindow$LWS$1.HTMLElement);
1849
1897
  const {
1850
1898
  prototype: HTMLElementProto$LWS
@@ -1880,6 +1928,95 @@ ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'parentNode');
1880
1928
  ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
1881
1929
  const rootDocumentDetachedFragment$LWS = ReflectApply$LWS$1(DocumentProtoCreateDocumentFragment$LWS, rootDocument$LWS, []);
1882
1930
  const rootDocumentDetachedContainer$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['div']);
1931
+ // Regex to match null bytes and zero-width characters that browsers may strip or ignore
1932
+ // \x00 - Null byte
1933
+ // \u00AD - Soft Hyphen
1934
+ // \u034F - Combining Grapheme Joiner
1935
+ // \u200B - Zero Width Space
1936
+ // \u200C - Zero Width Non-Joiner
1937
+ // \u200D - Zero Width Joiner
1938
+ // \u2060 - Word Joiner
1939
+ // \uFEFF - Zero Width No-Break Space (BOM)
1940
+ // eslint-disable-next-line no-control-regex, no-misleading-character-class
1941
+ const INVISIBLE_CHARS_REGEX$LWS = /[\x00\u00AD\u034F\u200B\u200C\u200D\u2060\uFEFF]/g;
1942
+ function normalizeInput$LWS(input$LWS, replacement$LWS = '') {
1943
+ // Replace invisible characters with space (not remove) to preserve token boundaries
1944
+ // This ensures DOCTYPE and the root element name remain separate tokens
1945
+ const lowerCasedInput$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, toSafeStringValue$LWS(input$LWS), []);
1946
+ return ReflectApply$LWS$1(StringProtoReplace$LWS, lowerCasedInput$LWS, [INVISIBLE_CHARS_REGEX$LWS, replacement$LWS]);
1947
+ }
1948
+ // Regex to detect DOCTYPE with internal DTD subset containing entity definitions.
1949
+ // Matches: <!DOCTYPE root [...anything...]>
1950
+ // The internal subset can contain ENTITY, ELEMENT, ATTLIST, NOTATION declarations.
1951
+ // This is an XXE attack vector where entities can contain malicious script content.
1952
+ const DOCTYPE_WITH_INTERNAL_SUBSET_REGEX$LWS = /<!doctype\s+\S+\s*\[/;
1953
+ // Regex to detect DOCTYPE with SYSTEM or PUBLIC external entity references.
1954
+ // Matches: <!DOCTYPE root SYSTEM "..."> or <!DOCTYPE root PUBLIC "..." "...">
1955
+ // External DTDs can define entities that get expanded with malicious content.
1956
+ const DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS = /<!doctype\s+\S+\s+(?:system|public)\s/;
1957
+ const DOCTYPE_OPENER$LWS = '<!doctype';
1958
+ const PI_OPENER$LWS = '<?';
1959
+ const PI_CLOSER$LWS = '?>';
1960
+ const COMMENT_OPENER$LWS = '<!--';
1961
+ const COMMENT_CLOSER$LWS = '-->';
1962
+ // Locate a DOCTYPE that sits in the document prolog — the only position where a
1963
+ // DTD is actually parsed and where entity definitions can take effect. A DTD is
1964
+ // only meaningful before the root element's start tag; anything after the root
1965
+ // element opens (text, CDATA sections, comments, processing instructions) is
1966
+ // inert character data and can never act as a DTD, no matter what it spells.
1967
+ //
1968
+ // Returns the prolog slice beginning at the DOCTYPE so the existing
1969
+ // dangerous-form regexes can classify it, or null when the prolog contains no
1970
+ // DOCTYPE. Walks the prolog token by token, skipping the XML declaration and
1971
+ // processing instructions (`<?...?>`) and comments (`<!-- ... -->`), and stops
1972
+ // at the first other `<` — that is the root element's start tag. Skipping
1973
+ // comments here is what defeats the `<!-- <![CDATA[ -->` decoy: a real prolog
1974
+ // DOCTYPE after a comment is still found, and a DOCTYPE buried inside a comment
1975
+ // is correctly ignored.
1976
+ function findPrologDoctype$LWS(normalizedInput$LWS) {
1977
+ const {
1978
+ length: length$LWS
1979
+ } = normalizedInput$LWS;
1980
+ let index$LWS = 0;
1981
+ while (index$LWS < length$LWS) {
1982
+ const char$LWS = ReflectApply$LWS$1(StringProtoCharAt$LWS, normalizedInput$LWS, [index$LWS]);
1983
+ // Skip insignificant whitespace between prolog tokens.
1984
+ if (char$LWS === ' ' || char$LWS === '\t' || char$LWS === '\n' || char$LWS === '\r') {
1985
+ index$LWS += 1;
1986
+ continue;
1987
+ }
1988
+ // Anything that is not a markup-opening `<` at this point is either the
1989
+ // start of the root element's content model or malformed; in both cases
1990
+ // there is no prolog DOCTYPE to find.
1991
+ if (char$LWS !== '<') {
1992
+ return null;
1993
+ }
1994
+ if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [DOCTYPE_OPENER$LWS, index$LWS])) {
1995
+ return ReflectApply$LWS$1(StringProtoSlice$LWS$1, normalizedInput$LWS, [index$LWS]);
1996
+ }
1997
+ if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [COMMENT_OPENER$LWS, index$LWS])) {
1998
+ const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [COMMENT_CLOSER$LWS, index$LWS + COMMENT_OPENER$LWS.length]);
1999
+ // Unterminated comment: no well-formed prolog DOCTYPE can follow.
2000
+ if (closerOffset$LWS === -1) {
2001
+ return null;
2002
+ }
2003
+ index$LWS = closerOffset$LWS + COMMENT_CLOSER$LWS.length;
2004
+ continue;
2005
+ }
2006
+ if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [PI_OPENER$LWS, index$LWS])) {
2007
+ const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [PI_CLOSER$LWS, index$LWS + PI_OPENER$LWS.length]);
2008
+ if (closerOffset$LWS === -1) {
2009
+ return null;
2010
+ }
2011
+ index$LWS = closerOffset$LWS + PI_CLOSER$LWS.length;
2012
+ continue;
2013
+ }
2014
+ // First `<` that is not a PI, comment, or DOCTYPE is the root element
2015
+ // start tag. The prolog has ended without a DOCTYPE.
2016
+ return null;
2017
+ }
2018
+ return null;
2019
+ }
1883
2020
  /* eslint-disable no-underscore-dangle */
1884
2021
  class Validator$LWS {
1885
2022
  constructor(document$LWS, {
@@ -1893,10 +2030,48 @@ class Validator$LWS {
1893
2030
  ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, this._templates.right, [rightString$LWS]);
1894
2031
  return deepIsEqualNode$LWS(this._templates.left, this._templates.right);
1895
2032
  };
2033
+ // Detect XML External Entity (XXE) injection attacks via DOCTYPE declarations.
2034
+ // Attackers can embed malicious script content inside ENTITY definitions that
2035
+ // get expanded when the XML/SVG is rendered, bypassing DOMPurify sanitization.
2036
+ //
2037
+ // A DTD only takes effect when it appears in the document prolog (before the
2038
+ // root element). The original guard scanned the entire input for a dangerous
2039
+ // DOCTYPE substring, which also rejected benign documents that merely quote a
2040
+ // DOCTYPE as inert text — inside a CDATA section, an XML comment, or element
2041
+ // text. The prolog-aware path keeps the dangerous-form classification
2042
+ // (internal subset, SYSTEM/PUBLIC external reference) exactly as-is, but only
2043
+ // applies it to a DOCTYPE that actually sits in the prolog. When the gate is
2044
+ // off, the original whole-input scan is preserved.
2045
+ // eslint-disable-next-line class-methods-use-this
2046
+ this.isXMLEntityAttack = input$LWS => {
2047
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS, ' ');
2048
+ // Block DOCTYPE with:
2049
+ // - Internal DTD subset (e.g., <!DOCTYPE svg [<!ENTITY foo "...">]>)
2050
+ // - SYSTEM or PUBLIC external entity references
2051
+ if (isGaterEnabledFeature$LWS('xmlEntityAttackPrologScan')) {
2052
+ const prologDoctype$LWS = findPrologDoctype$LWS(normalizedInput$LWS);
2053
+ if (prologDoctype$LWS === null) {
2054
+ return false;
2055
+ }
2056
+ return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, DOCTYPE_WITH_INTERNAL_SUBSET_REGEX$LWS, [prologDoctype$LWS]) || ReflectApply$LWS$1(RegExpProtoTest$LWS$1, DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS, [prologDoctype$LWS]);
2057
+ }
2058
+ 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]);
2059
+ };
2060
+ // Detect namespaced script elements that execute in XML contexts.
2061
+ // HTML-mode sanitizers treat <prefix:script> as an inert unknown element,
2062
+ // but XML parsers resolve the namespace and create an executable script
2063
+ // when the namespace is XHTML or SVG. The namespace URL itself can be
2064
+ // obfuscated with XML character entities in attribute values, but the
2065
+ // xmlns attribute name cannot, so checking for "xmlns" is reliable.
2066
+ // eslint-disable-next-line class-methods-use-this
2067
+ this.isXMLNamespacedScriptAttack = input$LWS => {
2068
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
2069
+ return hasTag$LWS(normalizedInput$LWS, 'script') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
2070
+ };
1896
2071
  // There is no reason to ever allow any HTML or XML that contains all three of these substrings.
1897
2072
  // 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), []);
2073
+ this.isIframeSrcdocScriptAttack = input$LWS => {
2074
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
1900
2075
  const hasIframe$LWS = hasTag$LWS(normalizedInput$LWS, 'iframe') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['srcdoc']);
1901
2076
  const hasScript$LWS = hasTag$LWS(normalizedInput$LWS, 'script');
1902
2077
  // If neither an iframe or a script was detected, then this input is safe.
@@ -1928,7 +2103,14 @@ class Validator$LWS {
1928
2103
  ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
1929
2104
  // If innerHTML contains "script", but innerText does not, then the string
1930
2105
  // 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');
2106
+ let checkableInnerText$LWS = innerText$LWS;
2107
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
2108
+ // Strip < > : from innerText before checking, because HTML entities like
2109
+ // &lt;script&gt; decode to <script> in text content and would otherwise
2110
+ // trick hasTag into thinking visible text contains a script tag.
2111
+ checkableInnerText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, innerText$LWS, [/[<>:]/g, '']);
2112
+ }
2113
+ return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableInnerText$LWS, 'script');
1932
2114
  };
1933
2115
  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
2116
  this._constructors = {
@@ -1965,10 +2147,13 @@ function deepIsEqualNode$LWS(leftRoot$LWS, rightRoot$LWS) {
1965
2147
  function hasTag$LWS(input$LWS, tag$LWS) {
1966
2148
  let checkableInput$LWS = input$LWS;
1967
2149
  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, ' ']);
2150
+ // Input is already lowercased and invisible chars stripped by caller
2151
+ checkableInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, input$LWS, [/\s+/g, ' ']);
1970
2152
  }
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}>`]);
2153
+ // Match <tag or :tag (namespaced) followed by whitespace, >, /
2154
+ // Also match when directly followed by src or srcdoc (null byte was stripped)
2155
+ const tagPattern$LWS = new RegExpCtor$LWS$1(`[<:]${tag$LWS}(?:[\\s>/]|(?=src))`);
2156
+ return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, tagPattern$LWS, [checkableInput$LWS]);
1972
2157
  }
1973
2158
  const rootValidator$LWS = new Validator$LWS(rootDocument$LWS, rootWindow$LWS$1);
1974
2159
  const documentToValidatorMap$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1([[rootDocument$LWS, rootValidator$LWS]]));
@@ -1996,53 +2181,6 @@ const {
1996
2181
  } = BlobProto$LWS;
1997
2182
  const BlobProtoSizeGetter$LWS = ObjectLookupOwnGetter$LWS$1(BlobProto$LWS, 'size');
1998
2183
  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
2184
 
2047
2185
  // Used by '@locker/near-membrane-shared-dom'.
2048
2186
  // The DOMException constructor was exposed in Edge 12 but wasn't invocable
@@ -2087,6 +2225,20 @@ const {
2087
2225
  } = ReflectGetOwnPropertyDescriptor$LWS(HTMLAnchorElementProto$LWS, 'href');
2088
2226
  const HTMLAnchorElementProtoPathnameGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElementProto$LWS, 'pathname');
2089
2227
  const HTMLAnchorElementProtoProtocolGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLAnchorElementProto$LWS, 'protocol');
2228
+ const {
2229
+ prototype: HTMLButtonElementProto$LWS
2230
+ } = HTMLButtonElement;
2231
+ const {
2232
+ get: HTMLButtonElementProtoFormActionGetter$LWS,
2233
+ set: HTMLButtonElementProtoFormActionSetter$LWS
2234
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLButtonElementProto$LWS, 'formAction');
2235
+ const {
2236
+ prototype: HTMLFormElementProto$LWS
2237
+ } = HTMLFormElement;
2238
+ const {
2239
+ get: HTMLFormElementProtoActionGetter$LWS,
2240
+ set: HTMLFormElementProtoActionSetter$LWS
2241
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLFormElementProto$LWS, 'action');
2090
2242
  const {
2091
2243
  prototype: HTMLIFrameElementProto$LWS
2092
2244
  } = HTMLIFrameElement;
@@ -2096,6 +2248,13 @@ const HTMLIFrameElementProtoSandboxGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTML
2096
2248
  const HTMLIFrameElementProtoSandboxSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'sandbox');
2097
2249
  const HTMLIFrameElementProtoSrcGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLIFrameElementProto$LWS, 'src');
2098
2250
  const HTMLIFrameElementProtoSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLIFrameElementProto$LWS, 'src');
2251
+ const {
2252
+ prototype: HTMLInputElementProto$LWS
2253
+ } = HTMLInputElement;
2254
+ const {
2255
+ get: HTMLInputElementProtoFormActionGetter$LWS,
2256
+ set: HTMLInputElementProtoFormActionSetter$LWS
2257
+ } = ReflectGetOwnPropertyDescriptor$LWS(HTMLInputElementProto$LWS, 'formAction');
2099
2258
  const HTMLScriptElementCtor$LWS = HTMLScriptElement;
2100
2259
  const {
2101
2260
  prototype: HTMLScriptElementProto$LWS
@@ -2175,6 +2334,13 @@ function getOriginalScriptProperty$LWS(script$LWS) {
2175
2334
  function isScriptEvaluated$LWS(script$LWS) {
2176
2335
  return evaluatedScriptElements$LWS.has(script$LWS);
2177
2336
  }
2337
+ function isUnknownScriptElement$LWS(element$LWS, globalObject$LWS) {
2338
+ const {
2339
+ HTMLScriptElement: HTMLScriptElement$LWS,
2340
+ SVGScriptElement: SVGScriptElement$LWS
2341
+ } = globalObject$LWS;
2342
+ return (element$LWS instanceof HTMLScriptElement$LWS || element$LWS instanceof SVGScriptElement$LWS) && !originalScriptPropertyCache$LWS.has(element$LWS) && !evaluatedScriptElements$LWS.has(element$LWS);
2343
+ }
2178
2344
  function isScriptPropertyEvaluatorHookDefined$LWS(script$LWS) {
2179
2345
  return originalScriptPropertyCache$LWS.has(script$LWS);
2180
2346
  }
@@ -2290,7 +2456,7 @@ const {
2290
2456
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
2291
2457
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
2292
2458
  ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
2293
- /*! version: 0.26.4 */
2459
+ /*! version: 0.27.7 */
2294
2460
 
2295
2461
  /*!
2296
2462
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2312,6 +2478,10 @@ function isMIMETypeAllowed$LWS(mimeType$LWS) {
2312
2478
  return false;
2313
2479
  }
2314
2480
  const DISALLOWED_ENDPOINTS_LIST$LWS = ['/aura', '/webruntime'];
2481
+ // Endpoints that should not be used as browsing context targets (window.open, iframe.src)
2482
+ // because they return manipulable content. Unlike fetch/XHR which just return data,
2483
+ // browsing contexts can be manipulated by attackers to inject malicious DOM.
2484
+ const DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS = ['/chatter'];
2315
2485
  const TRUSTED_DOMAINS_REG_EXP$LWS = /\.(force|salesforce|visualforce|documentforce|my\.site|salesforce-sites)\.com$/;
2316
2486
  const URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['about:', 'http:', 'https:']);
2317
2487
  const newlinesAndTabsRegExp$LWS = /[\u2028\u2029\n\r\t]/g;
@@ -2332,9 +2502,26 @@ function isSameOriginURL$LWS(resourceValue$LWS) {
2332
2502
  // then it can be treated as a same-origin URL.
2333
2503
  return resourceUrlOrigin$LWS && resourceUrlOrigin$LWS === rootWindow$LWS$1.location.origin;
2334
2504
  }
2505
+ // Detects exploit patterns that abuse the current page context
2506
+ function isAttemptingToExploitURL$LWS(resourceValue$LWS) {
2507
+ const loweredResourceValue$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, resourceValue$LWS, []);
2508
+ const locationHref$LWS = rootWindow$LWS$1.location.href;
2509
+ 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}?`]);
2510
+ }
2511
+ // Validates that a URL doesn't target disallowed endpoints.
2335
2512
  // @TODO: W-7302311 Make paths and domains configurable.
2336
- function isValidURL$LWS(parsedURL$LWS) {
2513
+ function isAllowedEndpointURL$LWS(parsedURL$LWS) {
2337
2514
  const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
2515
+ // This MUST be done inside the function because the gate may not be enabled when the
2516
+ // module code is loaded and evaluated (as would be the case for test environments)
2517
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
2518
+ // Cross-origin URLs bypass the denylist — they cannot carry the user's session
2519
+ // credentials to this instance's platform-internal endpoints (W-23009170).
2520
+ if (!isSameOriginURL$LWS(parsedURL$LWS.normalizedURL)) {
2521
+ return true;
2522
+ }
2523
+ DISALLOWED_ENDPOINTS_LIST$LWS.push('/_nc_external', '/force', '/setup');
2524
+ }
2338
2525
  for (let i$LWS = 0, {
2339
2526
  length: length$LWS
2340
2527
  } = DISALLOWED_ENDPOINTS_LIST$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -2344,6 +2531,26 @@ function isValidURL$LWS(parsedURL$LWS) {
2344
2531
  }
2345
2532
  return true;
2346
2533
  }
2534
+ // Validates that a URL is safe for browsing context targets (window.open, iframe.src).
2535
+ // Unlike fetch/XHR which just return response data, browsing contexts can be
2536
+ // manipulated by attackers to inject malicious content.
2537
+ // This includes all endpoints blocked by isAllowedEndpointURL plus browsing-context-specific ones.
2538
+ function isValidBrowsingContextURL$LWS(parsedURL$LWS) {
2539
+ // First check against the general disallowed endpoints
2540
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
2541
+ return false;
2542
+ }
2543
+ // Then check against browsing-context-specific disallowed endpoints
2544
+ const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
2545
+ for (let i$LWS = 0, {
2546
+ length: length$LWS
2547
+ } = DISALLOWED_BROWSING_CONTEXT_ENDPOINTS_LIST$LWS; i$LWS < length$LWS; i$LWS += 1) {
2548
+ 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]}/`])) {
2549
+ return false;
2550
+ }
2551
+ }
2552
+ return true;
2553
+ }
2347
2554
  function isValidURLScheme$LWS(url$LWS) {
2348
2555
  ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
2349
2556
  return URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
@@ -2365,7 +2572,7 @@ function sanitizeURLForElement$LWS(url$LWS) {
2365
2572
  function sanitizeURLString$LWS(urlString$LWS) {
2366
2573
  return urlString$LWS === '' ? urlString$LWS : ReflectApply$LWS$1(StringProtoReplace$LWS, urlString$LWS, [newlinesAndTabsRegExp$LWS, '']);
2367
2574
  }
2368
- /*! version: 0.26.4 */
2575
+ /*! version: 0.27.7 */
2369
2576
 
2370
2577
  /*! @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
2578
 
@@ -3777,7 +3984,7 @@ try {
3777
3984
  // swallow
3778
3985
  }
3779
3986
  const trusted = createPolicy('trusted', policyOptions);
3780
- /*! version: 0.26.4 */
3987
+ /*! version: 0.27.7 */
3781
3988
 
3782
3989
  /*!
3783
3990
  * Copyright (C) 2019 salesforce.com, inc.
@@ -3838,7 +4045,7 @@ var CONFIG$LWS = /*#__PURE__*/Object.freeze({
3838
4045
  const instancesBySandboxKeyRegistry$LWS = {
3839
4046
  __proto__: null
3840
4047
  };
3841
- const SANITIZE_ATTRIBUTES_LIST$LWS = toSafeArray$LWS$1(['href', 'xlink:href']);
4048
+ const SANITIZE_USE_ELEMENT_ATTRIBUTES_LIST$LWS = toSafeArray$LWS$1(['href', 'xlink:href']);
3842
4049
  const SHARED_SVG_SANITIZER_KEY$LWS = 'SHARED_SVG_SANITIZER_KEY';
3843
4050
  ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
3844
4051
  // Queue for managing pending XHR requests.
@@ -4022,9 +4229,20 @@ function uponSanitizeAttribute$LWS(node$LWS, data$LWS, _config$LWS) {
4022
4229
  attrValue: attrValue$LWS,
4023
4230
  attrName: attrName$LWS
4024
4231
  } = 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)) {
4232
+ const nodeName$LWS = ReflectApply$LWS$1(StringProtoToUpperCase$LWS, ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, []), []);
4233
+ if (attrValue$LWS && nodeName$LWS === 'USE' && SANITIZE_USE_ELEMENT_ATTRIBUTES_LIST$LWS.includes(attrName$LWS)) {
4026
4234
  data$LWS.attrValue = sanitizeSvgHref$LWS(attrValue$LWS);
4027
4235
  }
4236
+ // Remove action/formaction attributes pointing to disallowed endpoints.
4237
+ // Using keepAttr=false rather than blanking the value so that formaction
4238
+ // removal falls back to the form's own (already validated) action attribute
4239
+ // instead of overriding it with the current page URL.
4240
+ if (isGaterEnabledFeature$LWS('changesSince.262') && attrValue$LWS && (attrName$LWS === 'action' || attrName$LWS === 'formaction') && (nodeName$LWS === 'FORM' || nodeName$LWS === 'BUTTON' || nodeName$LWS === 'INPUT')) {
4241
+ const parsedURL$LWS = parseURL$LWS(attrValue$LWS);
4242
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
4243
+ data$LWS.keepAttr = false;
4244
+ }
4245
+ }
4028
4246
  // To support Lit, we must tell DOMPurify that attributes starting with "@", ".", or "?" are allowed.
4029
4247
  // Ref:
4030
4248
  // https://lit.dev/docs/components/events/
@@ -4042,7 +4260,7 @@ function blobSanitizer$LWS(sandboxKey$LWS) {
4042
4260
  }
4043
4261
  return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
4044
4262
  }
4045
- /*! version: 0.26.4 */
4263
+ /*! version: 0.27.7 */
4046
4264
 
4047
4265
  /*!
4048
4266
  * Copyright (C) 2023 salesforce.com, inc.
@@ -4096,7 +4314,8 @@ var ContentType$LWS;
4096
4314
  (function (ContentType$LWS) {
4097
4315
  ContentType$LWS[ContentType$LWS["HTML"] = 0] = "HTML";
4098
4316
  ContentType$LWS[ContentType$LWS["SVG"] = 1] = "SVG";
4099
- ContentType$LWS[ContentType$LWS["XML"] = 2] = "XML";
4317
+ ContentType$LWS[ContentType$LWS["XHTML"] = 2] = "XHTML";
4318
+ ContentType$LWS[ContentType$LWS["XML"] = 3] = "XML";
4100
4319
  })(ContentType$LWS || (ContentType$LWS = {}));
4101
4320
  const evaluatedScripts$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
4102
4321
  const scriptURLsCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
@@ -4121,11 +4340,22 @@ const policyOptions$LWS = {
4121
4340
  }
4122
4341
  case ContentType$LWS.SVG:
4123
4342
  {
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);
4343
+ let svgWrapper$LWS;
4344
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
4345
+ // Use template element to parse SVG content - template content is inert,
4346
+ // meaning images won't load and event handlers won't fire during parsing.
4347
+ // This prevents TOCTOU attacks where onload fires before sanitization.
4348
+ const tplElement$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, document, ['template']);
4349
+ // Wrap dirty content in SVG to ensure proper SVG namespace parsing
4350
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, tplElement$LWS, [trusted.createHTML(`<svg xmlns="${NAMESPACE_SVG$LWS}">${dirty$LWS}</svg>`)]);
4351
+ const content$LWS = ReflectApply$LWS$1(HTMLTemplateElementProtoContentGetter$LWS, tplElement$LWS, []);
4352
+ svgWrapper$LWS = ReflectApply$LWS$1(NodeProtoFirstChildGetter$LWS, content$LWS, []);
4353
+ } else {
4354
+ // Original behavior: create live SVG element (vulnerable to TOCTOU)
4355
+ svgWrapper$LWS = ReflectApply$LWS$1(DocumentProtoCreateElementNS$LWS, document, [NAMESPACE_SVG$LWS, 'svg']);
4356
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, svgWrapper$LWS, [trusted.createHTML(dirty$LWS)]);
4357
+ }
4358
+ const sanitized$LWS = getSanitizerForConfig$LWS('SHARED_SVG_SANITIZER_KEY', 'NODE_SVG').sanitize(svgWrapper$LWS);
4129
4359
  const firstChild$LWS = ReflectApply$LWS$1(NodeProtoFirstChildGetter$LWS, sanitized$LWS, []);
4130
4360
  return ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, firstChild$LWS, []);
4131
4361
  }
@@ -4239,7 +4469,7 @@ function createScriptSrcURLSetter$LWS(targetElement$LWS) {
4239
4469
  ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
4240
4470
  };
4241
4471
  }
4242
- /*! version: 0.26.4 */
4472
+ /*! version: 0.27.7 */
4243
4473
 
4244
4474
  /*!
4245
4475
  * Copyright (C) 2019 salesforce.com, inc.
@@ -4986,6 +5216,28 @@ function setCustomElementsRegistry$LWS(document$LWS, key$LWS) {
4986
5216
  currentRegistry$LWS = getSandboxCustomElementRegistry$LWS(document$LWS, key$LWS);
4987
5217
  }
4988
5218
  const DataTransferProtoBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
5219
+
5220
+ /**
5221
+ * Blocks read access to the 'nonce' attribute.
5222
+ *
5223
+ * The 'nonce' attribute contains a cryptographic token used by Content Security Policy
5224
+ * to allow specific inline scripts/styles to execute. If malicious code can read this
5225
+ * value, it can bypass CSP by injecting scripts with the stolen nonce.
5226
+ *
5227
+ * This function is intentionally separate from the general attribute distortion registry
5228
+ * (registerAttributeDistortion/getAttributeDistortion) because that registry is designed
5229
+ * for setter distortions that validate/sanitize values being set. Most blocked attributes
5230
+ * (like 'srcdoc' on iframes) only need to block writes while allowing reads. The 'nonce'
5231
+ * attribute is unique in that it must block both reads AND writes.
5232
+ *
5233
+ * By using a dedicated function, we avoid incorrectly applying setter distortions when
5234
+ * reading attributes, which would cause errors for attributes like 'src' and 'href'.
5235
+ */
5236
+ function blockAccessToNonce$LWS(attrName$LWS) {
5237
+ if (attrName$LWS === 'nonce') {
5238
+ throw new LockerSecurityError$LWS("Attribute 'nonce' not accessible");
5239
+ }
5240
+ }
4989
5241
  const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
4990
5242
  const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4991
5243
  function finalizeAttributeDistortions$LWS(record$LWS) {
@@ -5016,11 +5268,7 @@ function finalizeAttributeDistortions$LWS(record$LWS) {
5016
5268
  attributeFactories$LWS[i$LWS](attributeDistortionRegistry$LWS);
5017
5269
  }
5018
5270
  }
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;
5271
+ function lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS) {
5024
5272
  const sandboxAttributeDistortionRegistry$LWS = sandboxAttributeDistortionRegistryCache$LWS.get(document$LWS);
5025
5273
  // istanbul ignore if: currently unreachable via tests
5026
5274
  if (sandboxAttributeDistortionRegistry$LWS === undefined) {
@@ -5052,6 +5300,29 @@ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attri
5052
5300
  }
5053
5301
  return undefined;
5054
5302
  }
5303
+ function getAttributeDistortion$LWS(record$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS = NAMESPACE_DEFAULT$LWS) {
5304
+ const {
5305
+ document: document$LWS,
5306
+ key: key$LWS
5307
+ } = record$LWS;
5308
+ const result$LWS = lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS);
5309
+ if (result$LWS !== undefined) {
5310
+ return result$LWS;
5311
+ }
5312
+ // When an element is passed to a setAttribute function from a different
5313
+ // realm (e.g. cross-realm setAttribute obtained via a navigated iframe),
5314
+ // the instanceof check fails because the registry's constructors belong
5315
+ // to the function's realm, not the element's. Fall back to the element's
5316
+ // ownerDocument registry where constructors match the element's prototype
5317
+ // chain.
5318
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
5319
+ const elementDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, element$LWS, []);
5320
+ if (elementDocument$LWS && elementDocument$LWS !== document$LWS) {
5321
+ return lookupAttributeDistortion$LWS(elementDocument$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS);
5322
+ }
5323
+ }
5324
+ return undefined;
5325
+ }
5055
5326
  // Utility for normalizing namespaces which default to HTML behavior.
5056
5327
  // script.setAttributeNS(null, 'src', 'foo.js') has the same behavior as
5057
5328
  // script.setAttribute('src', 'foo.js').
@@ -5805,9 +6076,13 @@ function initDistortionDocumentCreateElement$LWS({
5805
6076
  const {
5806
6077
  0: tagName$LWS
5807
6078
  } = args$LWS;
6079
+ const normalizedTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
6080
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isBlockedElement$LWS(normalizedTagName$LWS)) {
6081
+ throw new LockerSecurityError$LWS(`Cannot create '${normalizedTagName$LWS}' element.`);
6082
+ }
5808
6083
  // Slow path for potential custom elements that might be registered
5809
6084
  // in the sandbox's virtual custom element registry.
5810
- if (ReflectApply$LWS$1(StringProtoIncludes$LWS, tagName$LWS, ['-'])) {
6085
+ if (ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedTagName$LWS, ['-'])) {
5811
6086
  // This must be called to signal to the virtual
5812
6087
  // CustomElementRegistry that the next thing created will be
5813
6088
  // a custom element and it must be marked for association to
@@ -5835,17 +6110,71 @@ function initDistortionDocumentCreateElementNS$LWS({
5835
6110
  const {
5836
6111
  1: tagName$LWS
5837
6112
  } = args$LWS;
6113
+ const normalizedTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
6114
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isBlockedElement$LWS(normalizedTagName$LWS)) {
6115
+ throw new LockerSecurityError$LWS(`Cannot create '${normalizedTagName$LWS}' element.`);
6116
+ }
5838
6117
  // Slow path for potential custom elements that might
5839
6118
  // be registered in the sandbox's virtual custom element registry.
5840
- if (ReflectApply$LWS$1(StringProtoIncludes$LWS, tagName$LWS, ['-'])) {
6119
+ if (ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedTagName$LWS, ['-'])) {
5841
6120
  // This must be called to signal to the virtual
5842
6121
  // CustomElementRegistry that the next thing created will be
5843
6122
  // a custom element and it must be marked for association to
5844
6123
  // this sandbox.
5845
6124
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
5846
6125
  }
5847
- return ReflectApply$LWS$1(originalDocumentCreateElementNS$LWS, this, args$LWS);
5848
- }];
6126
+ return ReflectApply$LWS$1(originalDocumentCreateElementNS$LWS, this, args$LWS);
6127
+ }];
6128
+ };
6129
+ }
6130
+ const {
6131
+ isSharedElement: isSharedElement$C$LWS
6132
+ } = rootValidator$LWS;
6133
+ function initDistortionDocumentCreateNodeIterator$LWS({
6134
+ globalObject: {
6135
+ Document: {
6136
+ prototype: {
6137
+ createNodeIterator: originalCreateNodeIterator$LWS
6138
+ }
6139
+ }
6140
+ }
6141
+ }) {
6142
+ const distortionEntry$LWS = [originalCreateNodeIterator$LWS, function createNodeIterator$LWS(...args$LWS) {
6143
+ const {
6144
+ 0: root$LWS
6145
+ } = args$LWS;
6146
+ if (isGaterEnabledFeature$LWS('changesSince.262') && root$LWS && isSharedElement$C$LWS(root$LWS)) {
6147
+ throw new LockerSecurityError$LWS(`Cannot create NodeIterator rooted at shared element ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, root$LWS, [])}.`);
6148
+ }
6149
+ return ReflectApply$LWS$1(originalCreateNodeIterator$LWS, this, args$LWS);
6150
+ }];
6151
+ return function distortionDocumentCreateNodeIterator$LWS() {
6152
+ return distortionEntry$LWS;
6153
+ };
6154
+ }
6155
+ const {
6156
+ isSharedElement: isSharedElement$B$LWS
6157
+ } = rootValidator$LWS;
6158
+ function initDistortionDocumentCreateTreeWalker$LWS({
6159
+ globalObject: {
6160
+ Document: {
6161
+ prototype: {
6162
+ createTreeWalker: originalCreateTreeWalker$LWS
6163
+ }
6164
+ }
6165
+ }
6166
+ }) {
6167
+ const distortionEntry$LWS = [originalCreateTreeWalker$LWS, function createTreeWalker$LWS(...args$LWS) {
6168
+ const {
6169
+ 0: root$LWS
6170
+ } = args$LWS;
6171
+ if (isGaterEnabledFeature$LWS('restrictCreateTreeWalker') && root$LWS && isSharedElement$B$LWS(root$LWS)) {
6172
+ throw new LockerSecurityError$LWS(`Cannot create TreeWalker rooted at shared element ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, root$LWS, [])}.`);
6173
+ }
6174
+ return ReflectApply$LWS$1(originalCreateTreeWalker$LWS, this, args$LWS);
6175
+ }];
6176
+ return function distortionDocumentCreateTreeWalker$LWS() {
6177
+ return distortionEntry$LWS;
5849
6178
  };
5850
6179
  }
5851
6180
  function domain$LWS() {
@@ -5863,8 +6192,13 @@ function initDistortionDocumentDomainSetter$LWS({
5863
6192
  };
5864
6193
  }
5865
6194
  const {
5866
- isSharedElement: isSharedElement$s$LWS
6195
+ isSharedElement: isSharedElement$A$LWS
5867
6196
  } = rootValidator$LWS;
6197
+ // Regex to strip non-ASCII characters after NFKD normalization.
6198
+ // This handles Unicode normalization attacks like using Turkish "İ" (U+0130)
6199
+ // which Firefox normalizes to "I" in execCommand, bypassing lowercase checks.
6200
+ // eslint-disable-next-line no-control-regex
6201
+ const nonASCIIRegExp$LWS = /[^\x00-\x7F]/g;
5868
6202
  function throwLockerSecurityError$LWS(command$LWS, target$LWS) {
5869
6203
  throw new LockerSecurityError$LWS(`Cannot execute command '${command$LWS}' on ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, target$LWS, [])}.`);
5870
6204
  }
@@ -5891,7 +6225,20 @@ function initDistortionDocumentExecCommand$LWS({
5891
6225
  } = args$LWS;
5892
6226
  if (length$LWS >= 1) {
5893
6227
  const command$LWS = toSafeStringValue$LWS(args$LWS[0]);
5894
- const loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, command$LWS, []);
6228
+ let loweredCommand$LWS;
6229
+ // istanbul ignore else: ungated else is not reachable in coverage runs
6230
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6231
+ // Normalize the command using NFKD (Compatibility Decomposition)
6232
+ // to handle Unicode normalization attacks. For example, Turkish "İ"
6233
+ // (U+0130) decomposes to "I" + combining dot above, and we then
6234
+ // strip non-ASCII characters to get a clean ASCII string for comparison.
6235
+ // This matches Firefox's internal behavior which normalizes commands.
6236
+ const normalizedCommand$LWS = ReflectApply$LWS$1(StringProtoNormalize$LWS, command$LWS, ['NFKD']);
6237
+ const asciiOnlyCommand$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, normalizedCommand$LWS, [nonASCIIRegExp$LWS, '']);
6238
+ loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, asciiOnlyCommand$LWS, []);
6239
+ } else {
6240
+ loweredCommand$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, command$LWS, []);
6241
+ }
5895
6242
  if (loweredCommand$LWS === 'selectall' && this === rootDocument$LWS) {
5896
6243
  throwLockerSecurityError$LWS(command$LWS, this);
5897
6244
  }
@@ -5909,7 +6256,7 @@ function initDistortionDocumentExecCommand$LWS({
5909
6256
  // istanbul ignore else: external is the default sandbox type for coverage runs
5910
6257
  if (type$LWS === 0 /* SandboxType.External */) {
5911
6258
  const activeElement$LWS = ReflectApply$LWS$1(originalActiveElement$LWS, this, []);
5912
- if (isSharedElement$s$LWS(activeElement$LWS) && ReflectApply$LWS$1(originalIsContentEditable$LWS, activeElement$LWS, [])) {
6259
+ if (isSharedElement$A$LWS(activeElement$LWS) && ReflectApply$LWS$1(originalIsContentEditable$LWS, activeElement$LWS, [])) {
5913
6260
  throwLockerSecurityError$LWS(command$LWS, activeElement$LWS);
5914
6261
  }
5915
6262
  }
@@ -5961,25 +6308,23 @@ function initDistortionDocumentOpen$LWS({
5961
6308
  // for window.open
5962
6309
  // https://developer.mozilla.org/en-US/docs/Web/API/Document/open#three-argument_document.open
5963
6310
  const normalizedArgs$LWS = normalizeWindowOpenArguments$LWS(args$LWS);
5964
- const childWindow$LWS = ReflectApply$LWS$1(originalDocumentOpen$LWS, this, normalizedArgs$LWS);
6311
+ // istanbul ignore next: resourceUrl default is not reachable via tests
5965
6312
  const {
5966
6313
  0: resourceUrl$LWS = ''
5967
6314
  } = 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
6315
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isAttemptingToExploitURL$LWS(resourceUrl$LWS)) {
6316
+ throw new LockerSecurityError$LWS(`Cannot open: ${resourceUrl$LWS}`);
6317
+ }
6318
+ const childWindow$LWS = ReflectApply$LWS$1(originalDocumentOpen$LWS, this, normalizedArgs$LWS);
6319
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
6320
+ // istanbul ignore else: previous behavior will not be tested in collection coverage
6321
+ if (isGaterEnabledFeature$LWS('changesSince.256')) {
6322
+ if (isSameOriginURL$LWS(resourceUrl$LWS)) {
6323
+ markForUnsafePropertyBlocking$LWS(childWindow$LWS);
6324
+ }
6325
+ } else {
5978
6326
  markForUnsafePropertyBlocking$LWS(childWindow$LWS);
5979
6327
  }
5980
- } else {
5981
- // When the gate is disabled, mark all child windows
5982
- markForUnsafePropertyBlocking$LWS(childWindow$LWS);
5983
6328
  }
5984
6329
  if (childWindow$LWS) {
5985
6330
  initWindowOpenChildWindow$LWS(childWindow$LWS, resourceUrl$LWS);
@@ -6029,7 +6374,9 @@ function initDistortionDOMParserParseFromString$LWS({
6029
6374
  }) {
6030
6375
  return [originalParseFromString$LWS, function parseFromString$LWS(...args$LWS) {
6031
6376
  const {
6032
- isInherentlyUnsecure: isInherentlyUnsecure$LWS
6377
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
6378
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
6379
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
6033
6380
  } = getValidator$LWS(document$LWS, globalObject$LWS);
6034
6381
  // DOMParser.prototype.parseFromString can only be called with
6035
6382
  // exactly two arguments. If it receives one argument, it will fail.
@@ -6045,8 +6392,12 @@ function initDistortionDOMParserParseFromString$LWS({
6045
6392
  let contentType$LWS;
6046
6393
  switch (mimeType$LWS) {
6047
6394
  case 'application/xhtml+xml':
6395
+ // XHTML is HTML in XML syntax - sanitize as HTML
6396
+ contentType$LWS = ContentType$LWS.XHTML;
6397
+ break;
6048
6398
  case 'application/xml':
6049
6399
  case 'text/xml':
6400
+ // Generic XML is not sanitized (may contain non-HTML tags)
6050
6401
  contentType$LWS = ContentType$LWS.XML;
6051
6402
  break;
6052
6403
  case 'image/svg+xml':
@@ -6055,17 +6406,19 @@ function initDistortionDOMParserParseFromString$LWS({
6055
6406
  default:
6056
6407
  contentType$LWS = ContentType$LWS.HTML;
6057
6408
  }
6409
+ // For XML/XHTML types, check for iframe/script attacks BEFORE sanitization.
6410
+ // This ensures we throw on dangerous content rather than silently removing it.
6411
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (contentType$LWS === ContentType$LWS.XML || contentType$LWS === ContentType$LWS.XHTML)) {
6412
+ if (isIframeSrcdocScriptAttack$LWS(string$LWS) || isXMLEntityAttack$LWS(string$LWS) || isXMLNamespacedScriptAttack$LWS(string$LWS)) {
6413
+ throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
6414
+ }
6415
+ }
6058
6416
  // This must be called to signal to the virtual
6059
6417
  // CustomElementRegistry that the next thing created
6060
6418
  // MAY CONTAIN a custom element, which must be marked for
6061
6419
  // association to this sandbox.
6062
6420
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6063
6421
  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
6422
  // Reassign args with sanitized string
6070
6423
  args$LWS[0] = trustedHtml$LWS;
6071
6424
  // Prevent shapeshifting arg from manipulating the
@@ -6077,7 +6430,7 @@ function initDistortionDOMParserParseFromString$LWS({
6077
6430
  };
6078
6431
  }
6079
6432
  const {
6080
- isSharedElement: isSharedElement$r$LWS,
6433
+ isSharedElement: isSharedElement$z$LWS,
6081
6434
  isAllowedSharedElementChild: isAllowedSharedElementChild$6$LWS
6082
6435
  } = rootValidator$LWS;
6083
6436
  function initDistortionElementAfter$LWS({
@@ -6092,7 +6445,7 @@ function initDistortionElementAfter$LWS({
6092
6445
  }) {
6093
6446
  const distortionEntry$LWS = [originalAfter$LWS, function after$LWS(...args$LWS) {
6094
6447
  // istanbul ignore else: needs default platform behavior test
6095
- if (isSharedElement$r$LWS(this)) {
6448
+ if (isSharedElement$z$LWS(this)) {
6096
6449
  for (let i$LWS = 0, {
6097
6450
  length: length$LWS
6098
6451
  } = args$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -6110,7 +6463,7 @@ function initDistortionElementAfter$LWS({
6110
6463
  };
6111
6464
  }
6112
6465
  const {
6113
- isSharedElement: isSharedElement$q$LWS,
6466
+ isSharedElement: isSharedElement$y$LWS,
6114
6467
  isAllowedSharedElementChild: isAllowedSharedElementChild$5$LWS
6115
6468
  } = rootValidator$LWS;
6116
6469
  function initDistortionElementAppend$LWS({
@@ -6125,7 +6478,7 @@ function initDistortionElementAppend$LWS({
6125
6478
  }) {
6126
6479
  const distortionEntry$LWS = [originalAppend$LWS, function append$LWS(...args$LWS) {
6127
6480
  // istanbul ignore else: needs default platform behavior test
6128
- if (isSharedElement$q$LWS(this)) {
6481
+ if (isSharedElement$y$LWS(this)) {
6129
6482
  // Element.prototype.append(...args) accepts an arbitrary number
6130
6483
  // of arguments which can be comprised of Nodes and DOMStrings.
6131
6484
  for (let i$LWS = 0, {
@@ -6222,7 +6575,7 @@ function initDistortionElementAttributesGetter$LWS({
6222
6575
  };
6223
6576
  }
6224
6577
  const {
6225
- isSharedElement: isSharedElement$p$LWS,
6578
+ isSharedElement: isSharedElement$x$LWS,
6226
6579
  isAllowedSharedElementChild: isAllowedSharedElementChild$4$LWS
6227
6580
  } = rootValidator$LWS;
6228
6581
  function initDistortionElementBefore$LWS({
@@ -6237,7 +6590,7 @@ function initDistortionElementBefore$LWS({
6237
6590
  }) {
6238
6591
  const distortionEntry$LWS = [originalBefore$LWS, function before$LWS(...args$LWS) {
6239
6592
  // istanbul ignore else: needs default platform behavior test
6240
- if (isSharedElement$p$LWS(this)) {
6593
+ if (isSharedElement$x$LWS(this)) {
6241
6594
  for (let i$LWS = 0, {
6242
6595
  length: length$LWS
6243
6596
  } = args$LWS; i$LWS < length$LWS; i$LWS += 1) {
@@ -6255,6 +6608,90 @@ function initDistortionElementBefore$LWS({
6255
6608
  return distortionEntry$LWS;
6256
6609
  };
6257
6610
  }
6611
+ function initDistortionElementGetAttribute$LWS({
6612
+ globalObject: {
6613
+ Element: {
6614
+ prototype: {
6615
+ getAttribute: originalGetAttribute$LWS
6616
+ }
6617
+ }
6618
+ }
6619
+ }) {
6620
+ return function distortionElementGetAttribute$LWS() {
6621
+ return [originalGetAttribute$LWS, function getAttribute$LWS(...args$LWS) {
6622
+ const {
6623
+ length: length$LWS
6624
+ } = args$LWS;
6625
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS > 0) {
6626
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[0])));
6627
+ }
6628
+ return ReflectApply$LWS$1(originalGetAttribute$LWS, this, args$LWS);
6629
+ }];
6630
+ };
6631
+ }
6632
+ function initDistortionElementGetAttributeNode$LWS({
6633
+ globalObject: {
6634
+ Element: {
6635
+ prototype: {
6636
+ getAttributeNode: originalGetAttributeNode$LWS
6637
+ }
6638
+ }
6639
+ }
6640
+ }) {
6641
+ return function distortionElementGetAttributeNode$LWS() {
6642
+ return [originalGetAttributeNode$LWS, function getAttributeNode$LWS(...args$LWS) {
6643
+ const {
6644
+ length: length$LWS
6645
+ } = args$LWS;
6646
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS > 0) {
6647
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[0])));
6648
+ }
6649
+ return ReflectApply$LWS$1(originalGetAttributeNode$LWS, this, args$LWS);
6650
+ }];
6651
+ };
6652
+ }
6653
+ function initDistortionElementGetAttributeNodeNS$LWS({
6654
+ globalObject: {
6655
+ Element: {
6656
+ prototype: {
6657
+ getAttributeNodeNS: originalGetAttributeNodeNS$LWS
6658
+ }
6659
+ }
6660
+ }
6661
+ }) {
6662
+ return function distortionElementGetAttributeNodeNS$LWS() {
6663
+ return [originalGetAttributeNodeNS$LWS, function getAttributeNodeNS$LWS(...args$LWS) {
6664
+ const {
6665
+ length: length$LWS
6666
+ } = args$LWS;
6667
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS >= 2) {
6668
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[1])));
6669
+ }
6670
+ return ReflectApply$LWS$1(originalGetAttributeNodeNS$LWS, this, args$LWS);
6671
+ }];
6672
+ };
6673
+ }
6674
+ function initDistortionElementGetAttributeNS$LWS({
6675
+ globalObject: {
6676
+ Element: {
6677
+ prototype: {
6678
+ getAttributeNS: originalGetAttributeNS$LWS
6679
+ }
6680
+ }
6681
+ }
6682
+ }) {
6683
+ return function distortionElementGetAttributeNS$LWS() {
6684
+ return [originalGetAttributeNS$LWS, function getAttributeNS$LWS(...args$LWS) {
6685
+ const {
6686
+ length: length$LWS
6687
+ } = args$LWS;
6688
+ if (isGaterEnabledFeature$LWS('changesSince.262') && length$LWS >= 2) {
6689
+ blockAccessToNonce$LWS(normalizeNamespacedAttributeName$LWS(toSafeStringValue$LWS(args$LWS[1])));
6690
+ }
6691
+ return ReflectApply$LWS$1(originalGetAttributeNS$LWS, this, args$LWS);
6692
+ }];
6693
+ };
6694
+ }
6258
6695
 
6259
6696
  // TODO: this has been deprecated and is no longer implemented in any browser
6260
6697
  function initDistortionElementGetInnerHTML$LWS({
@@ -6301,6 +6738,28 @@ function initDistortionElementGetInnerHTML$LWS({
6301
6738
  return distortionEntry$LWS;
6302
6739
  };
6303
6740
  }
6741
+ function initDistortionElementInnerHTMLGetter$LWS({
6742
+ globalObject: globalObject$LWS
6743
+ }) {
6744
+ const {
6745
+ Element: Element$LWS
6746
+ } = globalObject$LWS;
6747
+ const originalInnerHTMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Element$LWS.prototype, 'innerHTML');
6748
+ const distortionEntry$LWS = [originalInnerHTMLGetter$LWS, function innerHTML$LWS() {
6749
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6750
+ var _getOriginalScriptPro$LWS;
6751
+ if (isUnknownScriptElement$LWS(this, globalObject$LWS)) {
6752
+ return '';
6753
+ }
6754
+ return (_getOriginalScriptPro$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro$LWS : removeNoncePatterns$LWS(ReflectApply$LWS$1(originalInnerHTMLGetter$LWS, this, []));
6755
+ }
6756
+ // istanbul ignore next: ungated return is not reachable in coverage runs
6757
+ return ReflectApply$LWS$1(originalInnerHTMLGetter$LWS, this, []);
6758
+ }];
6759
+ return function distortionElementInnerHTMLGetter$LWS() {
6760
+ return distortionEntry$LWS;
6761
+ };
6762
+ }
6304
6763
  function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTrustedString$LWS, originalScriptPropertyGetter$LWS, originalScriptPropertySetter$LWS, distortions$LWS, sandboxEvaluator$LWS, signedScriptHookSourceText$LWS) {
6305
6764
  const valueAsString$LWS = toSafeStringValue$LWS(valueAsTrustedString$LWS);
6306
6765
  if (!isScriptPropertyEvaluatorHookDefined$LWS(incomingThis$LWS)) {
@@ -6332,8 +6791,8 @@ function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTruste
6332
6791
  return false;
6333
6792
  }
6334
6793
  const {
6335
- isInherentlyUnsecure: isInherentlyUnsecure$4$LWS,
6336
- isSharedElement: isSharedElement$o$LWS
6794
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$5$LWS,
6795
+ isSharedElement: isSharedElement$w$LWS
6337
6796
  } = rootValidator$LWS;
6338
6797
  function initDistortionElementInnerHTMLSetter$LWS({
6339
6798
  document: document$LWS,
@@ -6357,9 +6816,15 @@ function initDistortionElementInnerHTMLSetter$LWS({
6357
6816
  }) {
6358
6817
  return [originalInnerHTMLSetter$LWS, function innerHTML$LWS(value$LWS) {
6359
6818
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6360
- if (!isOwnerXMLDocument$LWS) {
6819
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
6820
+ // even when inside an XMLDocument, so they must always be sanitized.
6821
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
6822
+ // Sanitize if:
6823
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
6824
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
6825
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6361
6826
  // istanbul ignore else: needs default platform behavior test
6362
- if (isSharedElement$o$LWS(this)) {
6827
+ if (isSharedElement$w$LWS(this)) {
6363
6828
  throw new LockerSecurityError$LWS(`Cannot set innerHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6364
6829
  }
6365
6830
  if (this instanceof HTMLScriptElement$LWS || this instanceof SVGScriptElement) {
@@ -6373,10 +6838,10 @@ function initDistortionElementInnerHTMLSetter$LWS({
6373
6838
  // MAY CONTAIN a custom element, which must be marked for
6374
6839
  // association to this sandbox.
6375
6840
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6376
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6841
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6377
6842
  value$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, contentType$LWS);
6378
6843
  }
6379
- if (isInherentlyUnsecure$4$LWS(value$LWS)) {
6844
+ if (isIframeSrcdocScriptAttack$5$LWS(value$LWS)) {
6380
6845
  throw new LockerSecurityError$LWS(`Cannot set 'innerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6381
6846
  }
6382
6847
  ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [value$LWS]);
@@ -6384,7 +6849,7 @@ function initDistortionElementInnerHTMLSetter$LWS({
6384
6849
  };
6385
6850
  }
6386
6851
  const {
6387
- isSharedElement: isSharedElement$n$LWS,
6852
+ isSharedElement: isSharedElement$v$LWS,
6388
6853
  isAllowedSharedElementChild: isAllowedSharedElementChild$3$LWS
6389
6854
  } = rootValidator$LWS;
6390
6855
  function initDistortionElementInsertAdjacentElement$LWS({
@@ -6403,7 +6868,7 @@ function initDistortionElementInsertAdjacentElement$LWS({
6403
6868
  1: element$LWS
6404
6869
  } = args$LWS;
6405
6870
  // istanbul ignore else: needs default platform behavior test
6406
- if (isSharedElement$n$LWS(this) && !isAllowedSharedElementChild$3$LWS(element$LWS)) {
6871
+ if (isSharedElement$v$LWS(this) && !isAllowedSharedElementChild$3$LWS(element$LWS)) {
6407
6872
  throw new LockerSecurityError$LWS(`Cannot insert ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, element$LWS, [])} adjacent to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6408
6873
  }
6409
6874
  }
@@ -6414,8 +6879,8 @@ function initDistortionElementInsertAdjacentElement$LWS({
6414
6879
  };
6415
6880
  }
6416
6881
  const {
6417
- isInherentlyUnsecure: isInherentlyUnsecure$3$LWS,
6418
- isSharedElement: isSharedElement$m$LWS
6882
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$4$LWS,
6883
+ isSharedElement: isSharedElement$u$LWS
6419
6884
  } = rootValidator$LWS;
6420
6885
  const allowedElementHTMLRegExp$LWS = /^\s*<(link|script|style)/i;
6421
6886
  function initDistortionElementInsertAdjacentHTML$LWS({
@@ -6435,7 +6900,7 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6435
6900
  // istanbul ignore else: needs default platform behavior test
6436
6901
  if (args$LWS.length > 1) {
6437
6902
  const match$LWS = ReflectApply$LWS$1(StringProtoMatch$LWS, args$LWS[1], [allowedElementHTMLRegExp$LWS]);
6438
- if (isSharedElement$m$LWS(this) && match$LWS === null) {
6903
+ if (isSharedElement$u$LWS(this) && match$LWS === null) {
6439
6904
  throw new LockerSecurityError$LWS(`Cannot insert adjacent HTML to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}`);
6440
6905
  }
6441
6906
  // This must be called to signal to the virtual
@@ -6446,7 +6911,7 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6446
6911
  const contentType$LWS = this instanceof SVGElement ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6447
6912
  args$LWS[1] = lwsInternalPolicy$LWS.createHTML(args$LWS[1], key$LWS, contentType$LWS);
6448
6913
  // If the sanitized string is still insecure, throw an exception
6449
- if (isInherentlyUnsecure$3$LWS(args$LWS[1])) {
6914
+ if (isIframeSrcdocScriptAttack$4$LWS(args$LWS[1])) {
6450
6915
  throw new LockerSecurityError$LWS(`Cannot set 'insertAdjacentHTML' using an unsecure ${toSafeTemplateStringValue$LWS(args$LWS[1])}.`);
6451
6916
  }
6452
6917
  }
@@ -6454,9 +6919,27 @@ function initDistortionElementInsertAdjacentHTML$LWS({
6454
6919
  }];
6455
6920
  };
6456
6921
  }
6922
+ function initDistortionElementOuterHTMLGetter$LWS({
6923
+ globalObject: {
6924
+ Element: Element$LWS
6925
+ }
6926
+ }) {
6927
+ const originalOuterHTMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(Element$LWS.prototype, 'outerHTML');
6928
+ const distortionEntry$LWS = [originalOuterHTMLGetter$LWS, function outerHTML$LWS() {
6929
+ const html$LWS = ReflectApply$LWS$1(originalOuterHTMLGetter$LWS, this, []);
6930
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
6931
+ return removeNoncePatterns$LWS(html$LWS);
6932
+ }
6933
+ // istanbul ignore next: ungated return is not reachable in coverage runs
6934
+ return html$LWS;
6935
+ }];
6936
+ return function distortionElementOuterHTMLGetter$LWS() {
6937
+ return distortionEntry$LWS;
6938
+ };
6939
+ }
6457
6940
  const {
6458
- isInherentlyUnsecure: isInherentlyUnsecure$2$LWS,
6459
- isSharedElement: isSharedElement$l$LWS
6941
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$3$LWS,
6942
+ isSharedElement: isSharedElement$t$LWS
6460
6943
  } = rootValidator$LWS;
6461
6944
  function initDistortionElementOuterHTMLSetter$LWS({
6462
6945
  document: document$LWS,
@@ -6470,7 +6953,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6470
6953
  }) {
6471
6954
  return [originalOuterHTMLSetter$LWS, function outerHTML$LWS(value$LWS) {
6472
6955
  // istanbul ignore else: needs default platform behavior test
6473
- if (isSharedElement$l$LWS(this)) {
6956
+ if (isSharedElement$t$LWS(this)) {
6474
6957
  throw new LockerSecurityError$LWS(`Cannot set outerHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6475
6958
  }
6476
6959
  // This must be called to signal to the virtual
@@ -6481,7 +6964,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6481
6964
  const html$LWS = lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML);
6482
6965
  // Ensure that the created html snippet is secure (no mXSS)
6483
6966
  if (isGaterEnabledFeature$LWS('changesSince.260')) {
6484
- if (isInherentlyUnsecure$2$LWS(html$LWS)) {
6967
+ if (isIframeSrcdocScriptAttack$3$LWS(html$LWS)) {
6485
6968
  throw new LockerSecurityError$LWS(`Cannot set 'outerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6486
6969
  }
6487
6970
  }
@@ -6490,7 +6973,7 @@ function initDistortionElementOuterHTMLSetter$LWS({
6490
6973
  };
6491
6974
  }
6492
6975
  const {
6493
- isSharedElement: isSharedElement$k$LWS,
6976
+ isSharedElement: isSharedElement$s$LWS,
6494
6977
  isAllowedSharedElementChild: isAllowedSharedElementChild$2$LWS
6495
6978
  } = rootValidator$LWS;
6496
6979
  function initDistortionElementPrepend$LWS({
@@ -6505,7 +6988,7 @@ function initDistortionElementPrepend$LWS({
6505
6988
  }) {
6506
6989
  const distortionEntry$LWS = [originalPrepend$LWS, function prepend$LWS(...args$LWS) {
6507
6990
  // istanbul ignore else: needs default platform behavior test
6508
- if (isSharedElement$k$LWS(this)) {
6991
+ if (isSharedElement$s$LWS(this)) {
6509
6992
  // Element.prototype.prepend(...args) accepts an arbitrary
6510
6993
  // number of arguments which can be comprised of Nodes and
6511
6994
  // DOMStrings.
@@ -6529,7 +7012,7 @@ function initDistortionElementPrepend$LWS({
6529
7012
  };
6530
7013
  }
6531
7014
  const {
6532
- isSharedElement: isSharedElement$j$LWS
7015
+ isSharedElement: isSharedElement$r$LWS
6533
7016
  } = rootValidator$LWS;
6534
7017
  function initDistortionElementRemove$LWS({
6535
7018
  globalObject: {
@@ -6542,7 +7025,7 @@ function initDistortionElementRemove$LWS({
6542
7025
  }) {
6543
7026
  const distortionEntry$LWS = [originalRemove$LWS, function remove$LWS() {
6544
7027
  // istanbul ignore else: needs default platform behavior test
6545
- if (isSharedElement$j$LWS(this)) {
7028
+ if (isSharedElement$r$LWS(this)) {
6546
7029
  throw new LockerSecurityError$LWS(`Cannot remove ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6547
7030
  }
6548
7031
  ReflectApply$LWS$1(originalRemove$LWS, this, []);
@@ -6552,7 +7035,7 @@ function initDistortionElementRemove$LWS({
6552
7035
  };
6553
7036
  }
6554
7037
  const {
6555
- isSharedElement: isSharedElement$i$LWS
7038
+ isSharedElement: isSharedElement$q$LWS
6556
7039
  } = rootValidator$LWS;
6557
7040
  function initDistortionElementReplaceChildren$LWS({
6558
7041
  globalObject: {
@@ -6565,7 +7048,7 @@ function initDistortionElementReplaceChildren$LWS({
6565
7048
  }) {
6566
7049
  const distortionEntry$LWS = [originalReplaceChildren$LWS, function replaceChildren$LWS(...args$LWS) {
6567
7050
  // istanbul ignore else: needs default platform behavior test
6568
- if (isSharedElement$i$LWS(this)) {
7051
+ if (isSharedElement$q$LWS(this)) {
6569
7052
  throw new LockerSecurityError$LWS(`Cannot replace children of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6570
7053
  }
6571
7054
  return ReflectApply$LWS$1(originalReplaceChildren$LWS, this, args$LWS);
@@ -6575,7 +7058,7 @@ function initDistortionElementReplaceChildren$LWS({
6575
7058
  };
6576
7059
  }
6577
7060
  const {
6578
- isSharedElement: isSharedElement$h$LWS
7061
+ isSharedElement: isSharedElement$p$LWS
6579
7062
  } = rootValidator$LWS;
6580
7063
  function initDistortionElementReplaceWith$LWS({
6581
7064
  globalObject: {
@@ -6588,7 +7071,7 @@ function initDistortionElementReplaceWith$LWS({
6588
7071
  }) {
6589
7072
  const distortionEntry$LWS = [originalReplaceWith$LWS, function replaceWith$LWS(...args$LWS) {
6590
7073
  // istanbul ignore else: needs default platform behavior test
6591
- if (isSharedElement$h$LWS(this)) {
7074
+ if (isSharedElement$p$LWS(this)) {
6592
7075
  throw new LockerSecurityError$LWS(`Cannot replace ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6593
7076
  }
6594
7077
  return ReflectApply$LWS$1(originalReplaceWith$LWS, this, args$LWS);
@@ -6794,8 +7277,8 @@ function initDistortionElementSetAttributeNS$LWS({
6794
7277
  };
6795
7278
  }
6796
7279
  const {
6797
- isInherentlyUnsecure: isInherentlyUnsecure$1$LWS,
6798
- isSharedElement: isSharedElement$g$LWS
7280
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$2$LWS,
7281
+ isSharedElement: isSharedElement$o$LWS
6799
7282
  } = rootValidator$LWS;
6800
7283
  function initDistortionElementSetHTML$LWS({
6801
7284
  document: document$LWS,
@@ -6819,10 +7302,16 @@ function initDistortionElementSetHTML$LWS({
6819
7302
  }) {
6820
7303
  return [originalSetHTML$LWS, function setHTML$LWS(...args$LWS) {
6821
7304
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6822
- if (!isOwnerXMLDocument$LWS) {
7305
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
7306
+ // even when inside an XMLDocument, so they must always be sanitized.
7307
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
7308
+ // Sanitize if:
7309
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
7310
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
7311
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6823
7312
  const normalizedValue$LWS = toSafeStringValue$LWS(args$LWS[0]);
6824
7313
  // istanbul ignore else: needs default platform behavior test
6825
- if (isSharedElement$g$LWS(this)) {
7314
+ if (isSharedElement$o$LWS(this)) {
6826
7315
  throw new LockerSecurityError$LWS(`Cannot setHTML of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6827
7316
  }
6828
7317
  // This must be called to signal to the virtual
@@ -6832,9 +7321,9 @@ function initDistortionElementSetHTML$LWS({
6832
7321
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6833
7322
  // If options not specified, the default Sanitizer object is used.
6834
7323
  // This will be in addition to the sanitization we have.
6835
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7324
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6836
7325
  args$LWS[0] = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
6837
- if (isInherentlyUnsecure$1$LWS(args$LWS[0])) {
7326
+ if (isIframeSrcdocScriptAttack$2$LWS(args$LWS[0])) {
6838
7327
  throw new LockerSecurityError$LWS(`Cannot 'setHTML' using an unsecure ${toSafeTemplateStringValue$LWS(args$LWS[0])}.`);
6839
7328
  }
6840
7329
  }
@@ -6843,8 +7332,8 @@ function initDistortionElementSetHTML$LWS({
6843
7332
  };
6844
7333
  }
6845
7334
  const {
6846
- isInherentlyUnsecure: isInherentlyUnsecure$LWS,
6847
- isSharedElement: isSharedElement$f$LWS
7335
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$1$LWS,
7336
+ isSharedElement: isSharedElement$n$LWS
6848
7337
  } = rootValidator$LWS;
6849
7338
  function initDistortionElementSetHTMLUnsafe$LWS({
6850
7339
  document: document$LWS,
@@ -6878,9 +7367,15 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6878
7367
  return [originalSetHTMLUnsafe$LWS, function setHTMLUnsafe$LWS(value$LWS) {
6879
7368
  let normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
6880
7369
  const isOwnerXMLDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, this, []) instanceof XMLDocument$LWS;
6881
- if (!isOwnerXMLDocument$LWS) {
7370
+ // SVG elements can contain executable event handlers (onload, onerror, etc.)
7371
+ // even when inside an XMLDocument, so they must always be sanitized.
7372
+ const isSVGElement$LWS = isGaterEnabledFeature$LWS('changesSince.262') && this instanceof SVGElement$LWS;
7373
+ // Sanitize if:
7374
+ // 1. Not an XMLDocument (existing behavior for HTML documents), OR
7375
+ // 2. It's an SVGElement (SVG elements can have event handlers even in XMLDocuments)
7376
+ if (!isOwnerXMLDocument$LWS || isSVGElement$LWS) {
6882
7377
  // istanbul ignore else: needs default platform behavior test
6883
- if (isSharedElement$f$LWS(this)) {
7378
+ if (isSharedElement$n$LWS(this)) {
6884
7379
  throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
6885
7380
  }
6886
7381
  // This is necessary to support script.setHTMLUnsafe(...)
@@ -6895,10 +7390,10 @@ function initDistortionElementSetHTMLUnsafe$LWS({
6895
7390
  // MAY CONTAIN a custom element, which must be marked for
6896
7391
  // association to this sandbox.
6897
7392
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
6898
- const contentType$LWS = this instanceof SVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7393
+ const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
6899
7394
  normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
6900
7395
  }
6901
- if (isInherentlyUnsecure$LWS(normalizedValue$LWS)) {
7396
+ if (isIframeSrcdocScriptAttack$1$LWS(normalizedValue$LWS)) {
6902
7397
  throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
6903
7398
  }
6904
7399
  ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
@@ -6976,7 +7471,9 @@ function initDistortionEval$LWS({
6976
7471
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
6977
7472
  }) {
6978
7473
  return [originalEval$LWS, function (sourceText$LWS) {
6979
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'eval');
7474
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
7475
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'eval');
7476
+ }
6980
7477
  return sandboxEvaluator$LWS(transformSourceText$LWS(toSafeStringValue$LWS(sourceText$LWS)), UNCOMPILED_CONTEXT$LWS);
6981
7478
  }];
6982
7479
  };
@@ -7084,7 +7581,9 @@ function initDistortionFunction$LWS({
7084
7581
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
7085
7582
  }) {
7086
7583
  return [originalFunction$LWS, function Function$LWS(...args$LWS) {
7087
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'Function');
7584
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
7585
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'Function');
7586
+ }
7088
7587
  // The `arguments` object has `Symbol.iterator` as an own
7089
7588
  // property, not inherited, so it avoids prototype pollution
7090
7589
  // attacks.
@@ -7168,6 +7667,52 @@ function initDistortionHistoryReplaceState$LWS({
7168
7667
  return distortionEntry$LWS;
7169
7668
  };
7170
7669
  }
7670
+
7671
+ // Anchor elements allow blob: URLs in addition to standard schemes for download links
7672
+ const ANCHOR_URL_SCHEMES_LIST$LWS = toSafeArray$LWS$1(['about:', 'blob:', 'http:', 'https:']);
7673
+ function isValidAnchorURLScheme$LWS(url$LWS) {
7674
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, normalizerAnchor$LWS, [url$LWS]);
7675
+ return ANCHOR_URL_SCHEMES_LIST$LWS.includes(ReflectApply$LWS$1(HTMLAnchorElementProtoProtocolGetter$LWS, normalizerAnchor$LWS, []));
7676
+ }
7677
+ function initDistortionHTMLAnchorElementHrefSetter$LWS({
7678
+ globalObject: {
7679
+ HTMLAnchorElement: HTMLAnchorElement$LWS
7680
+ }
7681
+ }) {
7682
+ const originalHrefSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLAnchorElement$LWS.prototype, 'href');
7683
+ function href$LWS(value$LWS) {
7684
+ const urlString$LWS = sanitizeURLForElement$LWS(value$LWS);
7685
+ if (isGaterEnabledFeature$LWS('htmlAnchorElementHrefValidation') && !isValidAnchorURLScheme$LWS(urlString$LWS)) {
7686
+ throw new LockerSecurityError$LWS('HTMLAnchorElement.href supports http://, https://, blob: schemes, relative urls and about:blank.');
7687
+ }
7688
+ ReflectApply$LWS$1(HTMLAnchorElementProtoHrefSetter$LWS, this, [urlString$LWS]);
7689
+ }
7690
+ const distortionEntry$LWS = [originalHrefSetter$LWS, href$LWS];
7691
+ return function distortionHTMLAnchorElementHrefSetter$LWS(record$LWS) {
7692
+ if (isGaterEnabledFeature$LWS('htmlAnchorElementHrefValidation')) {
7693
+ registerAttributeDistortion$LWS(record$LWS, HTMLAnchorElement$LWS, 'href', NAMESPACE_DEFAULT$LWS, href$LWS);
7694
+ }
7695
+ // This will fall back to the original href setter if the gate is not enabled
7696
+ return distortionEntry$LWS;
7697
+ };
7698
+ }
7699
+ function initDistortionHTMLBaseElementHrefSetter$LWS({
7700
+ globalObject: {
7701
+ HTMLBaseElement: HTMLBaseElement$LWS
7702
+ }
7703
+ }) {
7704
+ const originalHrefSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLBaseElement$LWS.prototype, 'href');
7705
+ function href$LWS(...args$LWS) {
7706
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7707
+ throw new LockerSecurityError$LWS('Cannot set HTMLBaseElement.href.');
7708
+ }
7709
+ return ReflectApply$LWS$1(originalHrefSetter$LWS, this, args$LWS);
7710
+ }
7711
+ const distortionEntry$LWS = [originalHrefSetter$LWS, href$LWS];
7712
+ return function distortionHTMLBaseElementHrefSetter$LWS() {
7713
+ return distortionEntry$LWS;
7714
+ };
7715
+ }
7171
7716
  function initDistortionHTMLBodyElementOnrejectionhandled$LWS({
7172
7717
  globalObject: {
7173
7718
  HTMLBodyElement: HTMLBodyElement$LWS
@@ -7189,6 +7734,36 @@ function initDistortionHTMLBodyElementOnunhandledrejection$LWS({
7189
7734
  }) {
7190
7735
  return createEventDistortionFactory$LWS(HTMLBodyElement$LWS.prototype, HTMLBodyElement$LWS, 'unhandledrejection');
7191
7736
  }
7737
+ function initDistortionHTMLButtonElementFormActionSetter$LWS({
7738
+ globalObject: {
7739
+ HTMLButtonElement: HTMLButtonElement$LWS
7740
+ }
7741
+ }) {
7742
+ const originalFormActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLButtonElement$LWS.prototype, 'formAction');
7743
+ return function distortionHTMLButtonElementFormActionSetter$LWS(record$LWS) {
7744
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7745
+ function formAction$LWS(value$LWS) {
7746
+ const normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
7747
+ let urlString$LWS = '';
7748
+ if (normalizedValue$LWS !== '') {
7749
+ const parsedURL$LWS = parseURL$LWS(normalizedValue$LWS);
7750
+ const {
7751
+ normalizedURL: normalizedURL$LWS
7752
+ } = parsedURL$LWS;
7753
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7754
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
7755
+ }
7756
+ urlString$LWS = normalizedURL$LWS;
7757
+ }
7758
+ ReflectApply$LWS$1(HTMLButtonElementProtoFormActionSetter$LWS, this, [urlString$LWS]);
7759
+ }
7760
+ registerAttributeDistortion$LWS(record$LWS, HTMLButtonElement$LWS, 'formaction', NAMESPACE_DEFAULT$LWS, formAction$LWS);
7761
+ return [originalFormActionSetter$LWS, formAction$LWS];
7762
+ }
7763
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7764
+ return [originalFormActionSetter$LWS, originalFormActionSetter$LWS];
7765
+ };
7766
+ }
7192
7767
  function initDistortionHTMLElementCtor$LWS({
7193
7768
  document: document$LWS,
7194
7769
  globalObject: {
@@ -7228,8 +7803,26 @@ function initDistortionHTMLElementDatasetGetter$LWS({
7228
7803
  return distortionEntry$LWS;
7229
7804
  };
7230
7805
  }
7806
+ function initDistortionHTMLElementInnerTextGetter$LWS({
7807
+ globalObject: globalObject$LWS
7808
+ }) {
7809
+ const originalInnerTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(globalObject$LWS.HTMLElement.prototype, 'innerText');
7810
+ // istanbul ignore if: currently unreachable via tests
7811
+ if (typeof originalInnerTextGetter$LWS !== 'function') {
7812
+ return noop$LWS$1;
7813
+ }
7814
+ const distortionEntry$LWS = [originalInnerTextGetter$LWS, function innerText$LWS() {
7815
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
7816
+ return '';
7817
+ }
7818
+ return ReflectApply$LWS$1(originalInnerTextGetter$LWS, this, []);
7819
+ }];
7820
+ return function distortionHTMLElementInnerTextGetter$LWS() {
7821
+ return distortionEntry$LWS;
7822
+ };
7823
+ }
7231
7824
  const {
7232
- isSharedElement: isSharedElement$e$LWS
7825
+ isSharedElement: isSharedElement$m$LWS
7233
7826
  } = rootValidator$LWS;
7234
7827
  function initDistortionHTMLElementInnerTextSetter$LWS({
7235
7828
  globalObject: {
@@ -7243,7 +7836,7 @@ function initDistortionHTMLElementInnerTextSetter$LWS({
7243
7836
  }
7244
7837
  const distortionEntry$LWS = [originalInnerTextSetter$LWS, function innerText$LWS(value$LWS) {
7245
7838
  // istanbul ignore else: needs default platform behavior test
7246
- if (isSharedElement$e$LWS(this)) {
7839
+ if (isSharedElement$m$LWS(this)) {
7247
7840
  throw new LockerSecurityError$LWS(`Cannot set innerText of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7248
7841
  }
7249
7842
  ReflectApply$LWS$1(originalInnerTextSetter$LWS, this, [value$LWS]);
@@ -7263,7 +7856,7 @@ function initDistortionHTMLElementOnsecuritypolicyviolation$LWS({
7263
7856
  return createEventDistortionFactory$LWS(HTMLElementProto$LWS, HTMLElement$LWS, 'securitypolicyviolation');
7264
7857
  }
7265
7858
  const {
7266
- isSharedElement: isSharedElement$d$LWS
7859
+ isSharedElement: isSharedElement$l$LWS
7267
7860
  } = rootValidator$LWS;
7268
7861
  // The outerText property is non-standard, so the descriptor could be undefined,
7269
7862
  // like in the case of Firefox.
@@ -7280,7 +7873,7 @@ function initDistortionHTMLElementOuterTextSetter$LWS({
7280
7873
  }
7281
7874
  const distortionEntry$LWS = [originalOuterTextSetter$LWS, function outerText$LWS(value$LWS) {
7282
7875
  // istanbul ignore else: needs default platform behavior test
7283
- if (isSharedElement$d$LWS(this)) {
7876
+ if (isSharedElement$l$LWS(this)) {
7284
7877
  throw new LockerSecurityError$LWS(`Cannot set outerText of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])}.`);
7285
7878
  }
7286
7879
  ReflectApply$LWS$1(originalOuterTextSetter$LWS, this, [value$LWS]);
@@ -7302,6 +7895,36 @@ function initDistortionHTMLElementStyleGetter$LWS({
7302
7895
  return distortionEntry$LWS;
7303
7896
  };
7304
7897
  }
7898
+ function initDistortionHTMLFormElementActionSetter$LWS({
7899
+ globalObject: {
7900
+ HTMLFormElement: HTMLFormElement$LWS
7901
+ }
7902
+ }) {
7903
+ const originalActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLFormElement$LWS.prototype, 'action');
7904
+ return function distortionHTMLFormElementActionSetter$LWS(record$LWS) {
7905
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
7906
+ function action$LWS(value$LWS) {
7907
+ const normalizedActionValue$LWS = toSafeStringValue$LWS(value$LWS);
7908
+ let urlString$LWS = '';
7909
+ if (normalizedActionValue$LWS !== '') {
7910
+ const parsedURL$LWS = parseURL$LWS(normalizedActionValue$LWS);
7911
+ const {
7912
+ normalizedURL: normalizedURL$LWS
7913
+ } = parsedURL$LWS;
7914
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7915
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
7916
+ }
7917
+ urlString$LWS = normalizedURL$LWS;
7918
+ }
7919
+ ReflectApply$LWS$1(HTMLFormElementProtoActionSetter$LWS, this, [urlString$LWS]);
7920
+ }
7921
+ registerAttributeDistortion$LWS(record$LWS, HTMLFormElement$LWS, 'action', NAMESPACE_DEFAULT$LWS, action$LWS);
7922
+ return [originalActionSetter$LWS, action$LWS];
7923
+ }
7924
+ // istanbul ignore next: ungated return is not reachable in coverage runs
7925
+ return [originalActionSetter$LWS, originalActionSetter$LWS];
7926
+ };
7927
+ }
7305
7928
  function initDistortionHTMLFrameSetElementOnrejectionhandled$LWS({
7306
7929
  globalObject: {
7307
7930
  HTMLFrameSetElement: HTMLFrameSetElement$LWS
@@ -7431,6 +8054,13 @@ function initDistortionHTMLIFrameElementSrcSetter$LWS({
7431
8054
  return function distortionHTMLIFrameElementSrcSetter$LWS(record$LWS) {
7432
8055
  function src$LWS(value$LWS) {
7433
8056
  const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
8057
+ // This must be done on the raw value before sanitization, because sanitization can
8058
+ // remove the exploit pattern.
8059
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8060
+ if (isAttemptingToExploitURL$LWS(normalizedSrcValue$LWS)) {
8061
+ throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(normalizedSrcValue$LWS)}"`);
8062
+ }
8063
+ }
7434
8064
  // If the string being set to iframe.src is not an empty string, sanitize it for assignment
7435
8065
  // to iframe.src. If it is an empty string, let it be and proceed.
7436
8066
  // Otherwise, take no action.
@@ -7440,7 +8070,7 @@ function initDistortionHTMLIFrameElementSrcSetter$LWS({
7440
8070
  }
7441
8071
  if (isGaterEnabledFeature$LWS('changesSince.258')) {
7442
8072
  const parsedURL$LWS = parseURL$LWS(urlString$LWS);
7443
- if (!isValidURL$LWS(parsedURL$LWS)) {
8073
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7444
8074
  const {
7445
8075
  normalizedURL: normalizedURL$LWS
7446
8076
  } = parsedURL$LWS;
@@ -7473,6 +8103,36 @@ function initDistortionHTMLIFrameElementSandboxSetter$LWS({
7473
8103
  return [originalSandboxSetter$LWS, sandbox$LWS];
7474
8104
  };
7475
8105
  }
8106
+ function initDistortionHTMLInputElementFormActionSetter$LWS({
8107
+ globalObject: {
8108
+ HTMLInputElement: HTMLInputElement$LWS
8109
+ }
8110
+ }) {
8111
+ const originalFormActionSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLInputElement$LWS.prototype, 'formAction');
8112
+ return function distortionHTMLInputElementFormActionSetter$LWS(record$LWS) {
8113
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8114
+ function formAction$LWS(value$LWS) {
8115
+ const normalizedValue$LWS = toSafeStringValue$LWS(value$LWS);
8116
+ let urlString$LWS = '';
8117
+ if (normalizedValue$LWS !== '') {
8118
+ const parsedURL$LWS = parseURL$LWS(normalizedValue$LWS);
8119
+ const {
8120
+ normalizedURL: normalizedURL$LWS
8121
+ } = parsedURL$LWS;
8122
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
8123
+ throw new LockerSecurityError$LWS(`Cannot set form action to disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
8124
+ }
8125
+ urlString$LWS = normalizedURL$LWS;
8126
+ }
8127
+ ReflectApply$LWS$1(HTMLInputElementProtoFormActionSetter$LWS, this, [urlString$LWS]);
8128
+ }
8129
+ registerAttributeDistortion$LWS(record$LWS, HTMLInputElement$LWS, 'formaction', NAMESPACE_DEFAULT$LWS, formAction$LWS);
8130
+ return [originalFormActionSetter$LWS, formAction$LWS];
8131
+ }
8132
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8133
+ return [originalFormActionSetter$LWS, originalFormActionSetter$LWS];
8134
+ };
8135
+ }
7476
8136
  const importRegExp$LWS = /import/i;
7477
8137
  const WARN_MESSAGE$LWS = 'Lightning Web Security: HTMLLinkElement does not allow setting "rel" property to "import" value.';
7478
8138
  function isValidRelValue$LWS(value$LWS) {
@@ -7517,6 +8177,24 @@ function initDistortionHTMLLinkElementRelListSetter$LWS({
7517
8177
  return distortionEntry$LWS;
7518
8178
  };
7519
8179
  }
8180
+ function initDistortionHTMLMetaElementContentGetter$LWS({
8181
+ globalObject: {
8182
+ HTMLMetaElement: HTMLMetaElement$LWS
8183
+ }
8184
+ }) {
8185
+ const originalContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLMetaElement$LWS.prototype, 'content');
8186
+ const distortionEntry$LWS = [originalContentGetter$LWS, function content$LWS() {
8187
+ const originalContent$LWS = ReflectApply$LWS$1(originalContentGetter$LWS, this, []);
8188
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
8189
+ return removeNoncePatterns$LWS(originalContent$LWS);
8190
+ }
8191
+ // istanbul ignore next: ungated return is not reachable in coverage runs
8192
+ return originalContent$LWS;
8193
+ }];
8194
+ return function distortionHTMLMetaElementContentGetter$LWS() {
8195
+ return distortionEntry$LWS;
8196
+ };
8197
+ }
7520
8198
  function initDistortionHTMLObjectElementDataSetter$LWS({
7521
8199
  globalObject: {
7522
8200
  HTMLObjectElement: HTMLObjectElement$LWS
@@ -7529,7 +8207,7 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
7529
8207
  throw new LockerSecurityError$LWS('HTMLObjectElement.data supports http://, https:// schemes, relative urls and about:blank.');
7530
8208
  }
7531
8209
  const parsedURL$LWS = parseURL$LWS(urlString$LWS);
7532
- if (!isValidURL$LWS(parsedURL$LWS)) {
8210
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7533
8211
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
7534
8212
  }
7535
8213
  ReflectApply$LWS$1(originalDataSetter$LWS, this, [trusted.createScriptURL(urlString$LWS)]);
@@ -7540,6 +8218,35 @@ function initDistortionHTMLObjectElementDataSetter$LWS({
7540
8218
  return distortionEntry$LWS;
7541
8219
  };
7542
8220
  }
8221
+ function initDistortionHTMLScriptElementInnerTextGetter$LWS({
8222
+ globalObject: globalObject$LWS
8223
+ }) {
8224
+ const {
8225
+ HTMLScriptElement: HTMLScriptElement$LWS
8226
+ } = globalObject$LWS;
8227
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'innerText');
8228
+ // This may not be implemented in all browsers.
8229
+ // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
8230
+ if (!isGaterEnabledFeature$LWS('changesSince.262') || !descriptor$LWS) {
8231
+ return noop$LWS$1;
8232
+ }
8233
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8234
+ const {
8235
+ get: originalInnerTextGetter$LWS
8236
+ } = descriptor$LWS;
8237
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8238
+ const distortionEntry$LWS = [originalInnerTextGetter$LWS, function innerText$LWS() {
8239
+ var _getOriginalScriptPro2$LWS;
8240
+ if (isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8241
+ return '';
8242
+ }
8243
+ return (_getOriginalScriptPro2$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro2$LWS : ReflectApply$LWS$1(originalInnerTextGetter$LWS, this, []);
8244
+ }];
8245
+ // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
8246
+ return function distortionHTMLScriptElementInnerTextGetter$LWS() {
8247
+ return distortionEntry$LWS;
8248
+ };
8249
+ }
7543
8250
  const descriptorCaches$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
7544
8251
  function createBlockedAttributeDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS) {
7545
8252
  return function initDistortionBlockedAttribute$LWS() {
@@ -7672,6 +8379,14 @@ function addBlockedPropertyDistortionFactoryInitializers$LWS({
7672
8379
  }
7673
8380
  }
7674
8381
  }
8382
+ // @ts-ignore value and eval/Function have different type defs, but that's ok for identity comparison
8383
+ function throwIfUnsafeCallbackReference$LWS(value$LWS) {
8384
+ if (typeof value$LWS === 'function' && (
8385
+ // @ts-ignore
8386
+ value$LWS === eval || value$LWS === Function)) {
8387
+ throw new LockerSecurityError$LWS('Cannot pass unsafe eval or Function reference.');
8388
+ }
8389
+ }
7675
8390
  const scriptURLs$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
7676
8391
  function trackScriptURL$LWS(targetElement$LWS, url$LWS) {
7677
8392
  scriptURLs$LWS.set(targetElement$LWS, url$LWS);
@@ -7679,6 +8394,13 @@ function trackScriptURL$LWS(targetElement$LWS, url$LWS) {
7679
8394
  function getScriptURL$LWS(targetElement$LWS) {
7680
8395
  return scriptURLs$LWS.get(targetElement$LWS);
7681
8396
  }
8397
+ const svgAnimatedStringOwners$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8398
+ function trackSVGAnimatedStringOwner$LWS(animatedString$LWS, owner$LWS) {
8399
+ svgAnimatedStringOwners$LWS.set(animatedString$LWS, owner$LWS);
8400
+ }
8401
+ function getSVGAnimatedStringOwner$LWS(animatedString$LWS) {
8402
+ return svgAnimatedStringOwners$LWS.get(animatedString$LWS);
8403
+ }
7682
8404
  function createScriptDistortion$LWS({
7683
8405
  sandboxEvaluator: sandboxEvaluator$LWS
7684
8406
  }, attributeName$LWS) {
@@ -7735,6 +8457,24 @@ function initDistortionHTMLScriptElementSrcSetter$LWS({
7735
8457
  return [originalSrcSetter$LWS, src$LWS];
7736
8458
  };
7737
8459
  }
8460
+ function initDistortionHTMLScriptElementTextGetter$LWS({
8461
+ globalObject: globalObject$LWS
8462
+ }) {
8463
+ const {
8464
+ HTMLScriptElement: HTMLScriptElement$LWS
8465
+ } = globalObject$LWS;
8466
+ const originalTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLScriptElement$LWS.prototype, 'text');
8467
+ const distortionEntry$LWS = [originalTextGetter$LWS, function text$LWS() {
8468
+ var _getOriginalScriptPro3$LWS;
8469
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8470
+ return '';
8471
+ }
8472
+ return (_getOriginalScriptPro3$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro3$LWS : ReflectApply$LWS$1(originalTextGetter$LWS, this, []);
8473
+ }];
8474
+ return function distortionHTMLScriptElementTextGetter$LWS() {
8475
+ return distortionEntry$LWS;
8476
+ };
8477
+ }
7738
8478
  function initDistortionHTMLScriptElementTextSetter$LWS({
7739
8479
  globalObject: {
7740
8480
  HTMLScriptElement: HTMLScriptElement$LWS
@@ -7765,10 +8505,11 @@ function initDistortionHTMLScriptElementTextSetter$LWS({
7765
8505
  };
7766
8506
  }
7767
8507
  function initDistortionHTMLScriptElementTextContentGetter$LWS({
7768
- globalObject: {
7769
- HTMLScriptElement: HTMLScriptElement$LWS
7770
- }
8508
+ globalObject: globalObject$LWS
7771
8509
  }) {
8510
+ const {
8511
+ HTMLScriptElement: HTMLScriptElement$LWS
8512
+ } = globalObject$LWS;
7772
8513
  const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElement$LWS.prototype, 'textContent');
7773
8514
  // This may not be implemented in all browsers.
7774
8515
  // https://www.w3.org/TR/trusted-types/#enforcement-in-scripts
@@ -7781,8 +8522,11 @@ function initDistortionHTMLScriptElementTextContentGetter$LWS({
7781
8522
  } = descriptor$LWS;
7782
8523
  // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
7783
8524
  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, []);
8525
+ var _getOriginalScriptPro4$LWS;
8526
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
8527
+ return '';
8528
+ }
8529
+ return (_getOriginalScriptPro4$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro4$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
7786
8530
  }];
7787
8531
  // istanbul ignore next: currently not implemented in Chrome (used for coverage collection)
7788
8532
  return function distortionHTMLScriptElementSrcGetter$LWS() {
@@ -7823,6 +8567,88 @@ function initDistortionHTMLScriptElementTextContentSetter$LWS({
7823
8567
  }];
7824
8568
  };
7825
8569
  }
8570
+ function initDistortionIDBFactoryDatabases$LWS({
8571
+ globalObject: {
8572
+ IDBFactory: IDBFactory$LWS
8573
+ }
8574
+ }) {
8575
+ var _IDBFactory$prototype$LWS;
8576
+ const originalDatabases$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype$LWS.databases;
8577
+ if (typeof originalDatabases$LWS !== 'function') {
8578
+ return noop$LWS$1;
8579
+ }
8580
+ return function distortionIDBFactoryDatabases$LWS({
8581
+ key: key$LWS
8582
+ }) {
8583
+ return [originalDatabases$LWS, function databases$LWS() {
8584
+ const databasesResultPromise$LWS = ReflectApply$LWS$1(originalDatabases$LWS, this, []);
8585
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
8586
+ return databasesResultPromise$LWS;
8587
+ }
8588
+ return ReflectApply$LWS$1(PromiseProtoThen$LWS, databasesResultPromise$LWS, [result$LWS => {
8589
+ const sandboxedDatabases$LWS = [];
8590
+ let sandboxedDatabasesOffset$LWS = 0;
8591
+ for (let i$LWS = 0, {
8592
+ length: length$LWS
8593
+ } = result$LWS; i$LWS < length$LWS; i$LWS += 1) {
8594
+ const dbInfo$LWS = result$LWS[i$LWS];
8595
+ const {
8596
+ name: name$LWS
8597
+ } = dbInfo$LWS;
8598
+ if (name$LWS !== undefined && startsWithNamespaceMarker$LWS(name$LWS, key$LWS)) {
8599
+ sandboxedDatabases$LWS[sandboxedDatabasesOffset$LWS++] = {
8600
+ name: removeNamespaceMarker$LWS(name$LWS, key$LWS),
8601
+ version: dbInfo$LWS.version
8602
+ };
8603
+ }
8604
+ }
8605
+ return sandboxedDatabases$LWS;
8606
+ }]);
8607
+ }];
8608
+ };
8609
+ }
8610
+ function initDistortionIDBFactoryDeleteDatabase$LWS({
8611
+ globalObject: {
8612
+ IDBFactory: IDBFactory$LWS
8613
+ }
8614
+ }) {
8615
+ var _IDBFactory$prototype2$LWS;
8616
+ const originalDeleteDatabase$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype2$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype2$LWS.deleteDatabase;
8617
+ if (typeof originalDeleteDatabase$LWS !== 'function') {
8618
+ return noop$LWS$1;
8619
+ }
8620
+ return function distortionIDBFactoryDeleteDatabase$LWS({
8621
+ key: key$LWS
8622
+ }) {
8623
+ return [originalDeleteDatabase$LWS, function deleteDatabase$LWS(...args$LWS) {
8624
+ if (args$LWS.length && isGaterEnabledFeature$LWS('changesSince.262')) {
8625
+ args$LWS[0] = prependNamespaceMarker$LWS(args$LWS[0], key$LWS);
8626
+ }
8627
+ return ReflectApply$LWS$1(originalDeleteDatabase$LWS, this, args$LWS);
8628
+ }];
8629
+ };
8630
+ }
8631
+ function initDistortionIDBFactoryOpen$LWS({
8632
+ globalObject: {
8633
+ IDBFactory: IDBFactory$LWS
8634
+ }
8635
+ }) {
8636
+ var _IDBFactory$prototype3$LWS;
8637
+ const originalOpen$LWS = IDBFactory$LWS == null || (_IDBFactory$prototype3$LWS = IDBFactory$LWS.prototype) == null ? void 0 : _IDBFactory$prototype3$LWS.open;
8638
+ if (typeof originalOpen$LWS !== 'function') {
8639
+ return noop$LWS$1;
8640
+ }
8641
+ return function distortionIDBFactoryOpen$LWS({
8642
+ key: key$LWS
8643
+ }) {
8644
+ return [originalOpen$LWS, function open$LWS(...args$LWS) {
8645
+ if (args$LWS.length && isGaterEnabledFeature$LWS('changesSince.262')) {
8646
+ args$LWS[0] = prependNamespaceMarker$LWS(args$LWS[0], key$LWS);
8647
+ }
8648
+ return ReflectApply$LWS$1(originalOpen$LWS, this, args$LWS);
8649
+ }];
8650
+ };
8651
+ }
7826
8652
  function initDistortionIDBObjectStoreAdd$LWS({
7827
8653
  globalObject: {
7828
8654
  DOMException: DOMException$LWS,
@@ -7930,6 +8756,31 @@ function initDistortionMessagePortPostMessage$LWS({
7930
8756
  return distortionEntry$LWS;
7931
8757
  };
7932
8758
  }
8759
+ const {
8760
+ isSharedElement: isSharedElement$k$LWS
8761
+ } = rootValidator$LWS;
8762
+ function initDistortionMutationObserverObserve$LWS({
8763
+ globalObject: {
8764
+ MutationObserver: {
8765
+ prototype: {
8766
+ observe: originalObserve$LWS
8767
+ }
8768
+ }
8769
+ }
8770
+ }) {
8771
+ const distortionEntry$LWS = [originalObserve$LWS, function observe$LWS(...args$LWS) {
8772
+ const {
8773
+ 0: target$LWS
8774
+ } = args$LWS;
8775
+ if (isGaterEnabledFeature$LWS('changesSince.262') && target$LWS && isSharedElement$k$LWS(target$LWS)) {
8776
+ throw new LockerSecurityError$LWS(`Cannot observe mutations on shared element ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, target$LWS, [])}.`);
8777
+ }
8778
+ return ReflectApply$LWS$1(originalObserve$LWS, this, args$LWS);
8779
+ }];
8780
+ return function distortionMutationObserverObserve$LWS() {
8781
+ return distortionEntry$LWS;
8782
+ };
8783
+ }
7933
8784
  function initDistortionNamedNodeMapSetNamedItem$LWS({
7934
8785
  globalObject: {
7935
8786
  Attr: Attr$LWS,
@@ -7982,7 +8833,7 @@ function initDistortionNavigatorSendBeacon$LWS({
7982
8833
  const distortionEntry$LWS = [originalSendBeacon$LWS, function sendBeacon$LWS(...args$LWS) {
7983
8834
  if (args$LWS.length) {
7984
8835
  const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(args$LWS[0]));
7985
- if (!isValidURL$LWS(parsedURL$LWS)) {
8836
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
7986
8837
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
7987
8838
  }
7988
8839
  args$LWS[0] = parsedURL$LWS.normalizedURL;
@@ -8009,7 +8860,7 @@ function initDistortionNavigatorServiceWorkerGetter$LWS({
8009
8860
  };
8010
8861
  }
8011
8862
  const {
8012
- isSharedElement: isSharedElement$c$LWS,
8863
+ isSharedElement: isSharedElement$j$LWS,
8013
8864
  isAllowedSharedElementChild: isAllowedSharedElementChild$1$LWS
8014
8865
  } = rootValidator$LWS;
8015
8866
  function initDistortionNodeInsertBefore$LWS({
@@ -8032,7 +8883,7 @@ function initDistortionNodeInsertBefore$LWS({
8032
8883
  0: node$LWS
8033
8884
  } = args$LWS;
8034
8885
  // istanbul ignore else: needs default platform behavior test
8035
- if (isSharedElement$c$LWS(this) && !isAllowedSharedElementChild$1$LWS(node$LWS)) {
8886
+ if (isSharedElement$j$LWS(this) && !isAllowedSharedElementChild$1$LWS(node$LWS)) {
8036
8887
  throw new LockerSecurityError$LWS(`Cannot insert child ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])} into ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])},`);
8037
8888
  }
8038
8889
  }
@@ -8077,7 +8928,7 @@ function initDistortionNodeValueSetter$LWS({
8077
8928
  };
8078
8929
  }
8079
8930
  const {
8080
- isSharedElement: isSharedElement$b$LWS
8931
+ isSharedElement: isSharedElement$i$LWS
8081
8932
  } = rootValidator$LWS;
8082
8933
  function initDistortionNodeRemoveChild$LWS({
8083
8934
  globalObject: {
@@ -8098,7 +8949,7 @@ function initDistortionNodeRemoveChild$LWS({
8098
8949
  0: child$LWS
8099
8950
  } = args$LWS;
8100
8951
  // istanbul ignore else: needs default platform behavior test
8101
- if (isSharedElement$b$LWS(child$LWS)) {
8952
+ if (isSharedElement$i$LWS(child$LWS)) {
8102
8953
  throw new LockerSecurityError$LWS(`Cannot remove ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, child$LWS, [])}.`);
8103
8954
  }
8104
8955
  }
@@ -8110,7 +8961,7 @@ function initDistortionNodeRemoveChild$LWS({
8110
8961
  };
8111
8962
  }
8112
8963
  const {
8113
- isSharedElement: isSharedElement$a$LWS
8964
+ isSharedElement: isSharedElement$h$LWS
8114
8965
  } = rootValidator$LWS;
8115
8966
  function initDistortionNodeReplaceChild$LWS({
8116
8967
  globalObject: {
@@ -8134,7 +8985,7 @@ function initDistortionNodeReplaceChild$LWS({
8134
8985
  1: child$LWS
8135
8986
  } = args$LWS;
8136
8987
  // istanbul ignore else: needs default platform behavior test
8137
- if (isSharedElement$a$LWS(child$LWS)) {
8988
+ if (isSharedElement$h$LWS(child$LWS)) {
8138
8989
  throw new LockerSecurityError$LWS(`Cannot replace ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, child$LWS, [])}.`);
8139
8990
  }
8140
8991
  }
@@ -8146,19 +8997,18 @@ function initDistortionNodeReplaceChild$LWS({
8146
8997
  };
8147
8998
  }
8148
8999
  function initDistortionNodeTextContentGetter$LWS({
9000
+ globalObject: globalObject$LWS,
8149
9001
  globalObject: {
8150
- HTMLScriptElement: HTMLScriptElement$LWS,
8151
- Node: Node$LWS,
8152
- SVGScriptElement: SVGScriptElement$LWS
9002
+ Node: Node$LWS
8153
9003
  }
8154
9004
  }) {
8155
9005
  const originalTextContentGetter$LWS = ObjectLookupOwnGetter$LWS$1(Node$LWS.prototype, 'textContent');
8156
9006
  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, []);
9007
+ var _getOriginalScriptPro5$LWS;
9008
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isUnknownScriptElement$LWS(this, globalObject$LWS)) {
9009
+ return '';
8160
9010
  }
8161
- return ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
9011
+ return (_getOriginalScriptPro5$LWS = getOriginalScriptProperty$LWS(this)) != null ? _getOriginalScriptPro5$LWS : ReflectApply$LWS$1(originalTextContentGetter$LWS, this, []);
8162
9012
  }];
8163
9013
  return function distortionHTMLScriptElementSrcGetter$LWS() {
8164
9014
  return distortionEntry$LWS;
@@ -8173,7 +9023,7 @@ function initDistortionNodeTextContentGetter$LWS({
8173
9023
  // magenta global object, which would erroneously prevent code from interacting
8174
9024
  // with that document's <html>, <head> and <body>.
8175
9025
  const {
8176
- isSharedElement: isSharedElement$9$LWS
9026
+ isSharedElement: isSharedElement$g$LWS
8177
9027
  } = rootValidator$LWS;
8178
9028
  function initDistortionNodeTextContentSetter$LWS({
8179
9029
  globalObject: {
@@ -8228,7 +9078,7 @@ function initDistortionNodeTextContentSetter$LWS({
8228
9078
  }
8229
9079
  }
8230
9080
  // istanbul ignore else: needs default platform behavior test
8231
- else if (isSharedElement$9$LWS(this)) {
9081
+ else if (isSharedElement$g$LWS(this)) {
8232
9082
  throw new LockerSecurityError$LWS(`Cannot set textContent of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, this, [])} elements.`);
8233
9083
  }
8234
9084
  ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
@@ -8274,6 +9124,70 @@ function initDistortionNotificationCtor$LWS({
8274
9124
  return distortionEntry$LWS;
8275
9125
  };
8276
9126
  }
9127
+ function initDistortionObservableForEach$LWS({
9128
+ globalObject: {
9129
+ Observable: OriginalObservable$LWS
9130
+ }
9131
+ }) {
9132
+ var _OriginalObservable$p$LWS;
9133
+ const originalForEach$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p$LWS.forEach;
9134
+ if (typeof originalForEach$LWS !== 'function') {
9135
+ return noop$LWS$1;
9136
+ }
9137
+ const distortionEntry$LWS = [originalForEach$LWS, function forEach$LWS(...args$LWS) {
9138
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9139
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9140
+ }
9141
+ return ReflectApply$LWS$1(originalForEach$LWS, this, args$LWS);
9142
+ }];
9143
+ return function distortionObservableForEach$LWS() {
9144
+ return distortionEntry$LWS;
9145
+ };
9146
+ }
9147
+ function initDistortionObservableSubscribe$LWS({
9148
+ globalObject: {
9149
+ Observable: OriginalObservable$LWS
9150
+ }
9151
+ }) {
9152
+ var _OriginalObservable$p2$LWS;
9153
+ const originalSubscribe$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p2$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p2$LWS.subscribe;
9154
+ if (typeof originalSubscribe$LWS !== 'function') {
9155
+ return noop$LWS$1;
9156
+ }
9157
+ const distortionEntry$LWS = [originalSubscribe$LWS, function subscribe$LWS(...args$LWS) {
9158
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9159
+ const {
9160
+ 0: observerOrNext$LWS
9161
+ } = args$LWS;
9162
+ if (observerOrNext$LWS !== null && observerOrNext$LWS !== undefined) {
9163
+ if (typeof observerOrNext$LWS === 'function') {
9164
+ throwIfUnsafeCallbackReference$LWS(observerOrNext$LWS);
9165
+ } else if (typeof observerOrNext$LWS === 'object') {
9166
+ // Snapshot properties to prevent TOCTOU: attacker-controlled
9167
+ // getters could return a safe value during the check but
9168
+ // return eval when Observable reads them internally.
9169
+ const {
9170
+ next: next$LWS,
9171
+ error,
9172
+ complete: complete$LWS
9173
+ } = observerOrNext$LWS;
9174
+ throwIfUnsafeCallbackReference$LWS(next$LWS);
9175
+ throwIfUnsafeCallbackReference$LWS(error);
9176
+ throwIfUnsafeCallbackReference$LWS(complete$LWS);
9177
+ args$LWS[0] = {
9178
+ next: next$LWS,
9179
+ error,
9180
+ complete: complete$LWS
9181
+ };
9182
+ }
9183
+ }
9184
+ }
9185
+ return ReflectApply$LWS$1(originalSubscribe$LWS, this, args$LWS);
9186
+ }];
9187
+ return function distortionObservableSubscribe$LWS() {
9188
+ return distortionEntry$LWS;
9189
+ };
9190
+ }
8277
9191
  function initDistortionPerformanceMark$LWS({
8278
9192
  globalObject: {
8279
9193
  Performance: {
@@ -8334,51 +9248,342 @@ function initDistortionPerformanceMarkCtor$LWS({
8334
9248
  PerformanceMark: originalPerformanceMarkCtor$LWS
8335
9249
  }
8336
9250
  }) {
8337
- // istanbul ignore if: needs default platform behavior test
8338
- if (typeof originalPerformanceMarkCtor$LWS !== 'function') {
8339
- return noop$LWS$1;
8340
- }
8341
- const distortionEntry$LWS = [originalPerformanceMarkCtor$LWS, function PerformanceMark$LWS(...args$LWS) {
8342
- try {
8343
- return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
8344
- } catch (error) {
8345
- if (args$LWS.length > 1 && error instanceof DOMException$LWS) {
8346
- const providedOptions$LWS = args$LWS[1];
8347
- if (isObject$LWS$1(providedOptions$LWS)) {
8348
- args$LWS[1] = partialStructuredClone$LWS(providedOptions$LWS);
8349
- return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
9251
+ // istanbul ignore if: needs default platform behavior test
9252
+ if (typeof originalPerformanceMarkCtor$LWS !== 'function') {
9253
+ return noop$LWS$1;
9254
+ }
9255
+ const distortionEntry$LWS = [originalPerformanceMarkCtor$LWS, function PerformanceMark$LWS(...args$LWS) {
9256
+ try {
9257
+ return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
9258
+ } catch (error) {
9259
+ if (args$LWS.length > 1 && error instanceof DOMException$LWS) {
9260
+ const providedOptions$LWS = args$LWS[1];
9261
+ if (isObject$LWS$1(providedOptions$LWS)) {
9262
+ args$LWS[1] = partialStructuredClone$LWS(providedOptions$LWS);
9263
+ return ReflectConstruct$LWS(originalPerformanceMarkCtor$LWS, args$LWS);
9264
+ }
9265
+ }
9266
+ throw error;
9267
+ }
9268
+ }];
9269
+ return function distortionPerformanceMarkCtor$LWS() {
9270
+ return distortionEntry$LWS;
9271
+ };
9272
+ }
9273
+ function initDistortionPromiseAll$LWS({
9274
+ globalObject: {
9275
+ Promise: Promise$LWS
9276
+ }
9277
+ }) {
9278
+ const originalPromiseAll$LWS = Promise$LWS == null ? void 0 : Promise$LWS.all;
9279
+ if (typeof originalPromiseAll$LWS !== 'function') {
9280
+ return noop$LWS$1;
9281
+ }
9282
+ const distortionEntry$LWS = [originalPromiseAll$LWS, function (...args$LWS) {
9283
+ // Always use the real Promise constructor as `this` to prevent
9284
+ // malicious constructors from being passed via Promise.all.call()
9285
+ // that could inject eval as resolve/reject callbacks.
9286
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9287
+ return ReflectApply$LWS$1(originalPromiseAll$LWS, Promise$LWS, args$LWS);
9288
+ }
9289
+ return ReflectApply$LWS$1(originalPromiseAll$LWS, this, args$LWS);
9290
+ }];
9291
+ return function distortionPromiseAll$LWS() {
9292
+ return distortionEntry$LWS;
9293
+ };
9294
+ }
9295
+ function initDistortionPromiseAllSettled$LWS({
9296
+ globalObject: {
9297
+ Promise: Promise$LWS
9298
+ }
9299
+ }) {
9300
+ const originalPromiseAllSettled$LWS = Promise$LWS == null ? void 0 : Promise$LWS.allSettled;
9301
+ if (typeof originalPromiseAllSettled$LWS !== 'function') {
9302
+ return noop$LWS$1;
9303
+ }
9304
+ const distortionEntry$LWS = [originalPromiseAllSettled$LWS, function (...args$LWS) {
9305
+ // Always use the real Promise constructor as `this` to prevent
9306
+ // malicious constructors from being passed via Promise.allSettled.call()
9307
+ // that could inject eval as resolve/reject callbacks.
9308
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9309
+ return ReflectApply$LWS$1(originalPromiseAllSettled$LWS, Promise$LWS, args$LWS);
9310
+ }
9311
+ return ReflectApply$LWS$1(originalPromiseAllSettled$LWS, this, args$LWS);
9312
+ }];
9313
+ return function distortionPromiseAllSettled$LWS() {
9314
+ return distortionEntry$LWS;
9315
+ };
9316
+ }
9317
+ function initDistortionPromiseAny$LWS({
9318
+ globalObject: {
9319
+ Promise: Promise$LWS
9320
+ }
9321
+ }) {
9322
+ const originalPromiseAny$LWS = Promise$LWS == null ? void 0 : Promise$LWS.any;
9323
+ if (typeof originalPromiseAny$LWS !== 'function') {
9324
+ return noop$LWS$1;
9325
+ }
9326
+ const distortionEntry$LWS = [originalPromiseAny$LWS, function (...args$LWS) {
9327
+ // Always use the real Promise constructor as `this` to prevent
9328
+ // malicious constructors from being passed via Promise.any.call()
9329
+ // that could inject eval as resolve/reject callbacks.
9330
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9331
+ return ReflectApply$LWS$1(originalPromiseAny$LWS, Promise$LWS, args$LWS);
9332
+ }
9333
+ return ReflectApply$LWS$1(originalPromiseAny$LWS, this, args$LWS);
9334
+ }];
9335
+ return function distortionPromiseAny$LWS() {
9336
+ return distortionEntry$LWS;
9337
+ };
9338
+ }
9339
+ function initDistortionPromiseCatch$LWS({
9340
+ globalObject: {
9341
+ Promise: {
9342
+ prototype: PromiseProto$LWS
9343
+ }
9344
+ }
9345
+ }) {
9346
+ const originalPromiseCatch$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.catch;
9347
+ if (typeof originalPromiseCatch$LWS !== 'function') {
9348
+ return noop$LWS$1;
9349
+ }
9350
+ const distortionEntry$LWS = [originalPromiseCatch$LWS, function (...args$LWS) {
9351
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9352
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9353
+ }
9354
+ return ReflectApply$LWS$1(originalPromiseCatch$LWS, this, args$LWS);
9355
+ }];
9356
+ return function distortionPromiseCatch$LWS() {
9357
+ return distortionEntry$LWS;
9358
+ };
9359
+ }
9360
+ function initDistortionPromiseFinally$LWS({
9361
+ globalObject: {
9362
+ Promise: {
9363
+ prototype: PromiseProto$LWS
9364
+ }
9365
+ }
9366
+ }) {
9367
+ const originalPromiseFinally$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.finally;
9368
+ if (typeof originalPromiseFinally$LWS !== 'function') {
9369
+ return noop$LWS$1;
9370
+ }
9371
+ const distortionEntry$LWS = [originalPromiseFinally$LWS, function (...args$LWS) {
9372
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9373
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9374
+ }
9375
+ return ReflectApply$LWS$1(originalPromiseFinally$LWS, this, args$LWS);
9376
+ }];
9377
+ return function distortionPromiseFinally$LWS() {
9378
+ return distortionEntry$LWS;
9379
+ };
9380
+ }
9381
+ function initDistortionPromiseRace$LWS({
9382
+ globalObject: {
9383
+ Promise: Promise$LWS
9384
+ }
9385
+ }) {
9386
+ const originalPromiseRace$LWS = Promise$LWS == null ? void 0 : Promise$LWS.race;
9387
+ if (typeof originalPromiseRace$LWS !== 'function') {
9388
+ return noop$LWS$1;
9389
+ }
9390
+ const distortionEntry$LWS = [originalPromiseRace$LWS, function (...args$LWS) {
9391
+ // Always use the real Promise constructor as `this` to prevent
9392
+ // malicious constructors from being passed via Promise.race.call()
9393
+ // that could inject eval as resolve/reject callbacks.
9394
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9395
+ return ReflectApply$LWS$1(originalPromiseRace$LWS, Promise$LWS, args$LWS);
9396
+ }
9397
+ return ReflectApply$LWS$1(originalPromiseRace$LWS, this, args$LWS);
9398
+ }];
9399
+ return function distortionPromiseRace$LWS() {
9400
+ return distortionEntry$LWS;
9401
+ };
9402
+ }
9403
+ function initDistortionPromiseReject$LWS({
9404
+ globalObject: {
9405
+ Promise: Promise$LWS
9406
+ }
9407
+ }) {
9408
+ const originalPromiseReject$LWS = Promise$LWS == null ? void 0 : Promise$LWS.reject;
9409
+ if (typeof originalPromiseReject$LWS !== 'function') {
9410
+ return noop$LWS$1;
9411
+ }
9412
+ const distortionEntry$LWS = [originalPromiseReject$LWS, function (...args$LWS) {
9413
+ // Always use the real Promise constructor as `this` to prevent
9414
+ // malicious constructors from being passed via Promise.reject.call()
9415
+ // that could inject eval as resolve/reject callbacks.
9416
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9417
+ return ReflectApply$LWS$1(originalPromiseReject$LWS, Promise$LWS, args$LWS);
9418
+ }
9419
+ return ReflectApply$LWS$1(originalPromiseReject$LWS, this, args$LWS);
9420
+ }];
9421
+ return function distortionPromiseReject$LWS() {
9422
+ return distortionEntry$LWS;
9423
+ };
9424
+ }
9425
+ function initDistortionPromiseResolve$LWS({
9426
+ globalObject: {
9427
+ Promise: Promise$LWS
9428
+ }
9429
+ }) {
9430
+ const originalPromiseResolve$LWS = Promise$LWS == null ? void 0 : Promise$LWS.resolve;
9431
+ if (typeof originalPromiseResolve$LWS !== 'function') {
9432
+ return noop$LWS$1;
9433
+ }
9434
+ const distortionEntry$LWS = [originalPromiseResolve$LWS, function (...args$LWS) {
9435
+ // Always use the real Promise constructor as `this` to prevent
9436
+ // malicious constructors from being passed via Promise.resolve.call()
9437
+ // that could inject eval as resolve/reject callbacks.
9438
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9439
+ return ReflectApply$LWS$1(originalPromiseResolve$LWS, Promise$LWS, args$LWS);
9440
+ }
9441
+ return ReflectApply$LWS$1(originalPromiseResolve$LWS, this, args$LWS);
9442
+ }];
9443
+ return function distortionPromiseResolve$LWS() {
9444
+ return distortionEntry$LWS;
9445
+ };
9446
+ }
9447
+ function initDistortionPromiseThen$LWS({
9448
+ globalObject: {
9449
+ Promise: {
9450
+ prototype: PromiseProto$LWS
9451
+ }
9452
+ }
9453
+ }) {
9454
+ const originalPromiseThen$LWS = PromiseProto$LWS == null ? void 0 : PromiseProto$LWS.then;
9455
+ if (typeof originalPromiseThen$LWS !== 'function') {
9456
+ return noop$LWS$1;
9457
+ }
9458
+ const distortionEntry$LWS = [originalPromiseThen$LWS, function then$LWS(...args$LWS) {
9459
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9460
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9461
+ throwIfUnsafeCallbackReference$LWS(args$LWS[1]);
9462
+ }
9463
+ return ReflectApply$LWS$1(originalPromiseThen$LWS, this, args$LWS);
9464
+ }];
9465
+ return function distortionPromiseThen$LWS() {
9466
+ return distortionEntry$LWS;
9467
+ };
9468
+ }
9469
+ function initDistortionPromiseTry$LWS({
9470
+ globalObject: {
9471
+ Promise: Promise$LWS
9472
+ }
9473
+ }) {
9474
+ const originalPromiseTry$LWS = Promise$LWS == null ? void 0 : Promise$LWS.try;
9475
+ if (typeof originalPromiseTry$LWS !== 'function') {
9476
+ return noop$LWS$1;
9477
+ }
9478
+ const distortionEntry$LWS = [originalPromiseTry$LWS, function (...args$LWS) {
9479
+ if (isGaterEnabledFeature$LWS('changesSince.260')) {
9480
+ throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
9481
+ }
9482
+ // Always use the real Promise constructor as `this` to prevent
9483
+ // malicious constructors from being passed via Promise.try.call()
9484
+ // that could inject eval as resolve/reject callbacks.
9485
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9486
+ return ReflectApply$LWS$1(originalPromiseTry$LWS, Promise$LWS, args$LWS);
9487
+ }
9488
+ return ReflectApply$LWS$1(originalPromiseTry$LWS, this, args$LWS);
9489
+ }];
9490
+ return function distortionPromiseTry$LWS() {
9491
+ return distortionEntry$LWS;
9492
+ };
9493
+ }
9494
+ function initDistortionPromiseWithResolvers$LWS({
9495
+ globalObject: {
9496
+ Promise: Promise$LWS
9497
+ }
9498
+ }) {
9499
+ const originalPromiseWithResolvers$LWS = Promise$LWS == null ? void 0 : Promise$LWS.withResolvers;
9500
+ if (typeof originalPromiseWithResolvers$LWS !== 'function') {
9501
+ return noop$LWS$1;
9502
+ }
9503
+ const distortionEntry$LWS = [originalPromiseWithResolvers$LWS, function () {
9504
+ // Always use the real Promise constructor as `this` to prevent
9505
+ // malicious constructors from being passed via Promise.withResolvers.call()
9506
+ // that could leak eval as resolve/reject references.
9507
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9508
+ return ReflectApply$LWS$1(originalPromiseWithResolvers$LWS, Promise$LWS, []);
9509
+ }
9510
+ return ReflectApply$LWS$1(originalPromiseWithResolvers$LWS, this, []);
9511
+ }];
9512
+ return function distortionPromiseWithResolvers$LWS() {
9513
+ return distortionEntry$LWS;
9514
+ };
9515
+ }
9516
+ const {
9517
+ isSharedElement: isSharedElement$f$LWS
9518
+ } = rootValidator$LWS;
9519
+ function initDistortionRangeCloneContents$LWS({
9520
+ globalObject: {
9521
+ AbstractRange: AbstractRange$LWS,
9522
+ Range: {
9523
+ prototype: {
9524
+ cloneContents: originalCloneContents$LWS
9525
+ }
9526
+ }
9527
+ }
9528
+ }) {
9529
+ // 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.
9530
+ const {
9531
+ prototype: AbstractRangeProto$LWS
9532
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9533
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9534
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9535
+ const distortionEntry$LWS = [originalCloneContents$LWS, function cloneContents$LWS(...args$LWS) {
9536
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9537
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9538
+ for (let i$LWS = 0, {
9539
+ length: length$LWS
9540
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9541
+ const container$LWS = containers$LWS[i$LWS];
9542
+ if (isSharedElement$f$LWS(container$LWS)) {
9543
+ throw new LockerSecurityError$LWS(`Cannot clone contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
8350
9544
  }
8351
9545
  }
8352
- throw error;
8353
9546
  }
9547
+ return ReflectApply$LWS$1(originalCloneContents$LWS, this, args$LWS);
8354
9548
  }];
8355
- return function distortionPerformanceMarkCtor$LWS() {
9549
+ return function distortionRangeCloneContents$LWS() {
8356
9550
  return distortionEntry$LWS;
8357
9551
  };
8358
9552
  }
8359
- function initDistortionPromiseTry$LWS({
9553
+ const {
9554
+ isSharedElement: isSharedElement$e$LWS
9555
+ } = rootValidator$LWS;
9556
+ function initDistortionRangeCloneRange$LWS({
8360
9557
  globalObject: {
8361
- Promise: Promise$LWS
9558
+ AbstractRange: AbstractRange$LWS,
9559
+ Range: {
9560
+ prototype: {
9561
+ cloneRange: originalCloneRange$LWS
9562
+ }
9563
+ }
8362
9564
  }
8363
9565
  }) {
8364
- const originalPromiseTry$LWS = Promise$LWS == null ? void 0 : Promise$LWS.try;
8365
- if (typeof originalPromiseTry$LWS !== 'function') {
8366
- return noop$LWS$1;
8367
- }
8368
- const distortionEntry$LWS = [originalPromiseTry$LWS, function (...args$LWS) {
8369
- const {
8370
- 0: callback$LWS
8371
- } = args$LWS;
8372
- if (typeof callback$LWS === 'function') {
8373
- if (isGaterEnabledFeature$LWS('changesSince.260') &&
8374
- // @ts-ignore callback and eval have different type defs, but that's ok for this condition
8375
- callback$LWS === eval) {
8376
- throw new LockerSecurityError$LWS('Cannot pass unsafe eval reference.');
9566
+ // 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.
9567
+ const {
9568
+ prototype: AbstractRangeProto$LWS
9569
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9570
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9571
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9572
+ const distortionEntry$LWS = [originalCloneRange$LWS, function cloneRange$LWS(...args$LWS) {
9573
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9574
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9575
+ for (let i$LWS = 0, {
9576
+ length: length$LWS
9577
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9578
+ const container$LWS = containers$LWS[i$LWS];
9579
+ if (isSharedElement$e$LWS(container$LWS)) {
9580
+ throw new LockerSecurityError$LWS(`Cannot clone range of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9581
+ }
8377
9582
  }
8378
9583
  }
8379
- return ReflectApply$LWS$1(originalPromiseTry$LWS, this, args$LWS);
9584
+ return ReflectApply$LWS$1(originalCloneRange$LWS, this, args$LWS);
8380
9585
  }];
8381
- return function distortionPromiseTry$LWS() {
9586
+ return function distortionRangeCloneRange$LWS() {
8382
9587
  return distortionEntry$LWS;
8383
9588
  };
8384
9589
  }
@@ -8414,7 +9619,7 @@ function initDistortionRangeCreateContextualFragment$LWS({
8414
9619
  };
8415
9620
  }
8416
9621
  const {
8417
- isSharedElement: isSharedElement$8$LWS
9622
+ isSharedElement: isSharedElement$d$LWS
8418
9623
  } = rootValidator$LWS;
8419
9624
  function initDistortionRangeDeleteContents$LWS({
8420
9625
  globalObject: {
@@ -8443,7 +9648,7 @@ function initDistortionRangeDeleteContents$LWS({
8443
9648
  length: length$LWS
8444
9649
  } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
8445
9650
  const container$LWS = containers$LWS[i$LWS];
8446
- if (isSharedElement$8$LWS(container$LWS)) {
9651
+ if (isSharedElement$d$LWS(container$LWS)) {
8447
9652
  throw new LockerSecurityError$LWS(`Cannot delete contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
8448
9653
  }
8449
9654
  }
@@ -8454,7 +9659,7 @@ function initDistortionRangeDeleteContents$LWS({
8454
9659
  };
8455
9660
  }
8456
9661
  const {
8457
- isSharedElement: isSharedElement$7$LWS
9662
+ isSharedElement: isSharedElement$c$LWS
8458
9663
  } = rootValidator$LWS;
8459
9664
  function initDistortionRangeExtractContents$LWS({
8460
9665
  globalObject: {
@@ -8483,7 +9688,7 @@ function initDistortionRangeExtractContents$LWS({
8483
9688
  length: length$LWS
8484
9689
  } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
8485
9690
  const container$LWS = containers$LWS[i$LWS];
8486
- if (isSharedElement$7$LWS(container$LWS)) {
9691
+ if (isSharedElement$c$LWS(container$LWS)) {
8487
9692
  throw new LockerSecurityError$LWS(`Cannot extract contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
8488
9693
  }
8489
9694
  }
@@ -8494,7 +9699,44 @@ function initDistortionRangeExtractContents$LWS({
8494
9699
  };
8495
9700
  }
8496
9701
  const {
8497
- isSharedElement: isSharedElement$6$LWS,
9702
+ isSharedElement: isSharedElement$b$LWS
9703
+ } = rootValidator$LWS;
9704
+ function initDistortionRangeGetBoundingClientRect$LWS({
9705
+ globalObject: {
9706
+ AbstractRange: AbstractRange$LWS,
9707
+ Range: {
9708
+ prototype: {
9709
+ getBoundingClientRect: originalGetBoundingClientRect$LWS
9710
+ }
9711
+ }
9712
+ }
9713
+ }) {
9714
+ // 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.
9715
+ const {
9716
+ prototype: AbstractRangeProto$LWS
9717
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9718
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9719
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9720
+ const distortionEntry$LWS = [originalGetBoundingClientRect$LWS, function getBoundingClientRect$LWS(...args$LWS) {
9721
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9722
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9723
+ for (let i$LWS = 0, {
9724
+ length: length$LWS
9725
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9726
+ const container$LWS = containers$LWS[i$LWS];
9727
+ if (isSharedElement$b$LWS(container$LWS)) {
9728
+ throw new LockerSecurityError$LWS(`Cannot get bounding client rect of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9729
+ }
9730
+ }
9731
+ }
9732
+ return ReflectApply$LWS$1(originalGetBoundingClientRect$LWS, this, args$LWS);
9733
+ }];
9734
+ return function distortionRangeGetBoundingClientRect$LWS() {
9735
+ return distortionEntry$LWS;
9736
+ };
9737
+ }
9738
+ const {
9739
+ isSharedElement: isSharedElement$a$LWS,
8498
9740
  isAllowedSharedElementChild: isAllowedSharedElementChild$LWS
8499
9741
  } = rootValidator$LWS;
8500
9742
  function initDistortionRangeInsertNode$LWS({
@@ -8514,7 +9756,7 @@ function initDistortionRangeInsertNode$LWS({
8514
9756
  // istanbul ignore else: needs default platform behavior test
8515
9757
  if (args$LWS.length) {
8516
9758
  const commonAncestorContainer$LWS = ReflectApply$LWS$1(originalCommonAncestorContainerGetter$LWS, this, []);
8517
- if (commonAncestorContainer$LWS && isSharedElement$6$LWS(commonAncestorContainer$LWS) && !isAllowedSharedElementChild$LWS(args$LWS[0])) {
9759
+ if (commonAncestorContainer$LWS && isSharedElement$a$LWS(commonAncestorContainer$LWS) && !isAllowedSharedElementChild$LWS(args$LWS[0])) {
8518
9760
  throw new LockerSecurityError$LWS(`Cannot insert a new child node of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, commonAncestorContainer$LWS, [])}.`);
8519
9761
  }
8520
9762
  }
@@ -8525,7 +9767,7 @@ function initDistortionRangeInsertNode$LWS({
8525
9767
  };
8526
9768
  }
8527
9769
  const {
8528
- isSharedElement: isSharedElement$5$LWS
9770
+ isSharedElement: isSharedElement$9$LWS
8529
9771
  } = rootValidator$LWS;
8530
9772
  function createRangeProtoMethodDistortionFactoryInitializer$LWS(methodName$LWS) {
8531
9773
  return function initDistortionRangeProtoMethod$LWS({
@@ -8550,7 +9792,7 @@ function createRangeProtoMethodDistortionFactoryInitializer$LWS(methodName$LWS)
8550
9792
  0: node$LWS
8551
9793
  } = args$LWS;
8552
9794
  // istanbul ignore else: needs default platform behavior test
8553
- if (isSharedElement$5$LWS(node$LWS)) {
9795
+ if (isSharedElement$9$LWS(node$LWS)) {
8554
9796
  throw new LockerSecurityError$LWS(`Cannot call ${methodName$LWS} with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}.`);
8555
9797
  }
8556
9798
  }
@@ -8573,7 +9815,66 @@ const initDistortionRangeSetStartAfter$LWS = createRangeProtoMethodDistortionFac
8573
9815
  const initDistortionRangeSetStartBefore$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('setStartBefore');
8574
9816
  const initDistortionRangeSurroundContents$LWS = createRangeProtoMethodDistortionFactoryInitializer$LWS('surroundContents');
8575
9817
  const {
8576
- isSharedElement: isSharedElement$4$LWS
9818
+ isSharedElement: isSharedElement$8$LWS
9819
+ } = rootValidator$LWS;
9820
+ function initDistortionRangeToString$LWS({
9821
+ globalObject: {
9822
+ AbstractRange: AbstractRange$LWS,
9823
+ Range: {
9824
+ prototype: {
9825
+ toString: originalRangeToString$LWS
9826
+ }
9827
+ }
9828
+ }
9829
+ }) {
9830
+ // 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.
9831
+ const {
9832
+ prototype: AbstractRangeProto$LWS
9833
+ } = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
9834
+ const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
9835
+ const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
9836
+ const distortionEntry$LWS = [originalRangeToString$LWS, function toString$LWS(...args$LWS) {
9837
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9838
+ const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
9839
+ for (let i$LWS = 0, {
9840
+ length: length$LWS
9841
+ } = containers$LWS; i$LWS < length$LWS; i$LWS += 1) {
9842
+ const container$LWS = containers$LWS[i$LWS];
9843
+ if (isSharedElement$8$LWS(container$LWS)) {
9844
+ throw new LockerSecurityError$LWS(`Cannot read contents of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, container$LWS, [])}.`);
9845
+ }
9846
+ }
9847
+ }
9848
+ return ReflectApply$LWS$1(originalRangeToString$LWS, this, args$LWS);
9849
+ }];
9850
+ return function distortionRangeToString$LWS() {
9851
+ return distortionEntry$LWS;
9852
+ };
9853
+ }
9854
+ const {
9855
+ isSharedElement: isSharedElement$7$LWS
9856
+ } = rootValidator$LWS;
9857
+ function initDistortionSelectionAnchorNodeGetter$LWS({
9858
+ globalObject: {
9859
+ Selection: Selection$LWS
9860
+ }
9861
+ }) {
9862
+ const originalAnchorNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection$LWS.prototype, 'anchorNode');
9863
+ const distortionEntry$LWS = [originalAnchorNodeGetter$LWS, function anchorNode$LWS() {
9864
+ const node$LWS = ReflectApply$LWS$1(originalAnchorNodeGetter$LWS, this, []);
9865
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9866
+ if (node$LWS && isSharedElement$7$LWS(node$LWS)) {
9867
+ return null;
9868
+ }
9869
+ }
9870
+ return node$LWS;
9871
+ }];
9872
+ return function distortionSelectionAnchorNodeGetter$LWS() {
9873
+ return distortionEntry$LWS;
9874
+ };
9875
+ }
9876
+ const {
9877
+ isSharedElement: isSharedElement$6$LWS
8577
9878
  } = rootValidator$LWS;
8578
9879
  function initDistortionSelectionCollapse$LWS({
8579
9880
  globalObject: {
@@ -8590,7 +9891,7 @@ function initDistortionSelectionCollapse$LWS({
8590
9891
  0: node$LWS
8591
9892
  } = args$LWS;
8592
9893
  // The first arg to Selection.prototype.collapse is "Node | null"
8593
- if (node$LWS && isSharedElement$4$LWS(node$LWS)) {
9894
+ if (node$LWS && isSharedElement$6$LWS(node$LWS)) {
8594
9895
  throw new LockerSecurityError$LWS(`Cannot collapse selection to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8595
9896
  }
8596
9897
  }
@@ -8601,7 +9902,7 @@ function initDistortionSelectionCollapse$LWS({
8601
9902
  };
8602
9903
  }
8603
9904
  const {
8604
- isSharedElement: isSharedElement$3$LWS
9905
+ isSharedElement: isSharedElement$5$LWS
8605
9906
  } = rootValidator$LWS;
8606
9907
  function initDistortionSelectionExtend$LWS({
8607
9908
  globalObject: {
@@ -8617,7 +9918,7 @@ function initDistortionSelectionExtend$LWS({
8617
9918
  const {
8618
9919
  0: node$LWS
8619
9920
  } = args$LWS;
8620
- if (isSharedElement$3$LWS(node$LWS)) {
9921
+ if (isSharedElement$5$LWS(node$LWS)) {
8621
9922
  throw new LockerSecurityError$LWS(`Cannot extend selection to ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8622
9923
  }
8623
9924
  }
@@ -8628,7 +9929,29 @@ function initDistortionSelectionExtend$LWS({
8628
9929
  };
8629
9930
  }
8630
9931
  const {
8631
- isSharedElement: isSharedElement$2$LWS
9932
+ isSharedElement: isSharedElement$4$LWS
9933
+ } = rootValidator$LWS;
9934
+ function initDistortionSelectionFocusNodeGetter$LWS({
9935
+ globalObject: {
9936
+ Selection: Selection$LWS
9937
+ }
9938
+ }) {
9939
+ const originalFocusNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection$LWS.prototype, 'focusNode');
9940
+ const distortionEntry$LWS = [originalFocusNodeGetter$LWS, function focusNode$LWS() {
9941
+ const node$LWS = ReflectApply$LWS$1(originalFocusNodeGetter$LWS, this, []);
9942
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
9943
+ if (node$LWS && isSharedElement$4$LWS(node$LWS)) {
9944
+ return null;
9945
+ }
9946
+ }
9947
+ return node$LWS;
9948
+ }];
9949
+ return function distortionSelectionFocusNodeGetter$LWS() {
9950
+ return distortionEntry$LWS;
9951
+ };
9952
+ }
9953
+ const {
9954
+ isSharedElement: isSharedElement$3$LWS
8632
9955
  } = rootValidator$LWS;
8633
9956
  function initDistortionSelectionSelectAllChildren$LWS({
8634
9957
  globalObject: {
@@ -8644,7 +9967,7 @@ function initDistortionSelectionSelectAllChildren$LWS({
8644
9967
  const {
8645
9968
  0: node$LWS
8646
9969
  } = args$LWS;
8647
- if (isSharedElement$2$LWS(node$LWS)) {
9970
+ if (isSharedElement$3$LWS(node$LWS)) {
8648
9971
  throw new LockerSecurityError$LWS(`Cannot select all children of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8649
9972
  }
8650
9973
  }
@@ -8655,7 +9978,7 @@ function initDistortionSelectionSelectAllChildren$LWS({
8655
9978
  };
8656
9979
  }
8657
9980
  const {
8658
- isSharedElement: isSharedElement$1$LWS
9981
+ isSharedElement: isSharedElement$2$LWS
8659
9982
  } = rootValidator$LWS;
8660
9983
  function initDistortionSelectionSetBaseAndExtent$LWS({
8661
9984
  globalObject: {
@@ -8674,8 +9997,8 @@ function initDistortionSelectionSetBaseAndExtent$LWS({
8674
9997
  0: anchorNode$LWS,
8675
9998
  2: focusNode$LWS
8676
9999
  } = args$LWS;
8677
- const anchorNodeIsShared$LWS = isSharedElement$1$LWS(anchorNode$LWS);
8678
- const focusNodeIsShared$LWS = isSharedElement$1$LWS(focusNode$LWS);
10000
+ const anchorNodeIsShared$LWS = isSharedElement$2$LWS(anchorNode$LWS);
10001
+ const focusNodeIsShared$LWS = isSharedElement$2$LWS(focusNode$LWS);
8679
10002
  if (anchorNodeIsShared$LWS || focusNodeIsShared$LWS) {
8680
10003
  const subject$LWS = anchorNodeIsShared$LWS ? anchorNode$LWS : focusNode$LWS;
8681
10004
  throw new LockerSecurityError$LWS(`Cannot set selection with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, subject$LWS, [])}`);
@@ -8688,7 +10011,7 @@ function initDistortionSelectionSetBaseAndExtent$LWS({
8688
10011
  };
8689
10012
  }
8690
10013
  const {
8691
- isSharedElement: isSharedElement$LWS
10014
+ isSharedElement: isSharedElement$1$LWS
8692
10015
  } = rootValidator$LWS;
8693
10016
  function initDistortionSelectionSetPosition$LWS({
8694
10017
  globalObject: {
@@ -8705,7 +10028,7 @@ function initDistortionSelectionSetPosition$LWS({
8705
10028
  0: node$LWS
8706
10029
  } = args$LWS;
8707
10030
  // The first arg to Selection.prototype.setPosition is "Node | null"
8708
- if (node$LWS && isSharedElement$LWS(node$LWS)) {
10031
+ if (node$LWS && isSharedElement$1$LWS(node$LWS)) {
8709
10032
  throw new LockerSecurityError$LWS(`Cannot set position with ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}`);
8710
10033
  }
8711
10034
  }
@@ -8715,6 +10038,38 @@ function initDistortionSelectionSetPosition$LWS({
8715
10038
  return distortionEntry$LWS;
8716
10039
  };
8717
10040
  }
10041
+ const {
10042
+ isSharedElement: isSharedElement$LWS
10043
+ } = rootValidator$LWS;
10044
+ function initDistortionSelectionToString$LWS({
10045
+ globalObject: {
10046
+ Selection: {
10047
+ prototype: {
10048
+ toString: originalSelectionToString$LWS
10049
+ }
10050
+ }
10051
+ }
10052
+ }) {
10053
+ const originalAnchorNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection.prototype, 'anchorNode');
10054
+ const originalFocusNodeGetter$LWS = ObjectLookupOwnGetter$LWS$1(Selection.prototype, 'focusNode');
10055
+ const distortionEntry$LWS = [originalSelectionToString$LWS, function toString$LWS(...args$LWS) {
10056
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10057
+ const nodes$LWS = [ReflectApply$LWS$1(originalAnchorNodeGetter$LWS, this, []), ReflectApply$LWS$1(originalFocusNodeGetter$LWS, this, [])];
10058
+ for (let i$LWS = 0, {
10059
+ length: length$LWS
10060
+ } = nodes$LWS; i$LWS < length$LWS; i$LWS += 1) {
10061
+ const node$LWS = nodes$LWS[i$LWS];
10062
+ if (node$LWS && isSharedElement$LWS(node$LWS)) {
10063
+ throw new LockerSecurityError$LWS(`Cannot read selection content of ${ReflectApply$LWS$1(NodeProtoNodeNameGetter$LWS, node$LWS, [])}.`);
10064
+ }
10065
+ }
10066
+ }
10067
+ return ReflectApply$LWS$1(originalSelectionToString$LWS, this, args$LWS);
10068
+ }];
10069
+ return function distortionSelectionToString$LWS() {
10070
+ return distortionEntry$LWS;
10071
+ };
10072
+ }
8718
10073
  function initDistortionServiceWorkerContainerProto$LWS({
8719
10074
  globalObject: {
8720
10075
  ServiceWorkerContainer: ServiceWorkerContainer$LWS
@@ -8752,6 +10107,9 @@ function initDistortionShadowRootInnerHTMLSetter$LWS({
8752
10107
  }];
8753
10108
  };
8754
10109
  }
10110
+ const {
10111
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS
10112
+ } = rootValidator$LWS;
8755
10113
  function initDistortionShadowRootSetHTMLUnsafe$LWS({
8756
10114
  document: document$LWS,
8757
10115
  globalObject: {
@@ -8770,12 +10128,16 @@ function initDistortionShadowRootSetHTMLUnsafe$LWS({
8770
10128
  key: key$LWS
8771
10129
  }) {
8772
10130
  return [originalSetHTMLUnsafe$LWS, function setHTMLUnsafe$LWS(value$LWS) {
10131
+ const normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(toSafeStringValue$LWS(value$LWS), key$LWS, ContentType$LWS.HTML);
10132
+ if (isIframeSrcdocScriptAttack$LWS(normalizedValue$LWS)) {
10133
+ throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
10134
+ }
8773
10135
  // This must be called to signal to the virtual
8774
10136
  // CustomElementRegistry that the next thing created
8775
10137
  // MAY CONTAIN a custom element, which must be marked for
8776
10138
  // association to this sandbox.
8777
10139
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
8778
- ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [lwsInternalPolicy$LWS.createHTML(value$LWS, key$LWS, ContentType$LWS.HTML)]);
10140
+ ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
8779
10141
  }];
8780
10142
  };
8781
10143
  }
@@ -9166,6 +10528,27 @@ function initDistortionStorage$LWS({
9166
10528
  }
9167
10529
  const initDistortionLocalStorage$LWS = createDistortionStorageFactoryInitializer$LWS('localStorage');
9168
10530
  const initDistortionSessionStorage$LWS = createDistortionStorageFactoryInitializer$LWS('sessionStorage');
10531
+ function initDistortionSVGAnimatedStringBaseValSetter$LWS({
10532
+ globalObject: {
10533
+ SVGAnimatedString: SVGAnimatedString$LWS
10534
+ }
10535
+ }) {
10536
+ const originalBaseValSetter$LWS = ObjectLookupOwnSetter$LWS(SVGAnimatedString$LWS.prototype, 'baseVal');
10537
+ return function distortionSVGAnimatedStringBaseValSetter$LWS(record$LWS) {
10538
+ const scriptHrefDistortion$LWS = createScriptDistortion$LWS(record$LWS, 'href');
10539
+ const distortionEntry$LWS = [originalBaseValSetter$LWS, function baseVal$LWS(value$LWS) {
10540
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10541
+ const ownerElement$LWS = getSVGAnimatedStringOwner$LWS(this);
10542
+ if (ownerElement$LWS) {
10543
+ ReflectApply$LWS$1(scriptHrefDistortion$LWS, ownerElement$LWS, [value$LWS]);
10544
+ return;
10545
+ }
10546
+ }
10547
+ ReflectApply$LWS$1(originalBaseValSetter$LWS, this, [value$LWS]);
10548
+ }];
10549
+ return distortionEntry$LWS;
10550
+ };
10551
+ }
9169
10552
  function initDistortionSVGAnimateElementAttributeNameAttribute$LWS({
9170
10553
  globalObject: {
9171
10554
  Element: {
@@ -9318,13 +10701,18 @@ function initDistortionSVGScriptElementHrefGetter$LWS({
9318
10701
  const originalHrefGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGScriptElement$LWS.prototype, 'href');
9319
10702
  const distortionEntry$LWS = [originalHrefGetter$LWS, function href$LWS() {
9320
10703
  const url$LWS = getScriptURL$LWS(this);
10704
+ let result$LWS;
9321
10705
  // istanbul ignore else: needs default platform behavior test
9322
10706
  if (typeof url$LWS === 'string') {
9323
10707
  ReflectApply$LWS$1(originalSetAttribute$LWS, script$LWS, ['href', trusted.createScriptURL(url$LWS)]);
9324
- return ReflectApply$LWS$1(originalHrefGetter$LWS, script$LWS, []);
10708
+ result$LWS = ReflectApply$LWS$1(originalHrefGetter$LWS, script$LWS, []);
10709
+ } else {
10710
+ result$LWS = ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
9325
10711
  }
9326
- // istanbul ignore next: needs default platform behavior test
9327
- return ReflectApply$LWS$1(originalHrefGetter$LWS, this, []);
10712
+ if (isGaterEnabledFeature$LWS('changesSince.262')) {
10713
+ trackSVGAnimatedStringOwner$LWS(result$LWS, this);
10714
+ }
10715
+ return result$LWS;
9328
10716
  }];
9329
10717
  return function distortionSVGScriptElementHrefGetter$LWS() {
9330
10718
  return distortionEntry$LWS;
@@ -9479,7 +10867,9 @@ function initDistortionURLCreateObjectURL$LWS({
9479
10867
  // user-code created global objects).
9480
10868
  const {
9481
10869
  isEqualDomString: isEqualDomString$LWS,
9482
- isInherentlyUnsecure: isInherentlyUnsecure$LWS
10870
+ isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
10871
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
10872
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
9483
10873
  } = getValidator$LWS(document$LWS, globalObject$LWS);
9484
10874
  return function distortionURLCreateObjectURL$LWS({
9485
10875
  key: key$LWS
@@ -9526,7 +10916,11 @@ function initDistortionURLCreateObjectURL$LWS({
9526
10916
  }
9527
10917
  const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
9528
10918
  const sanitized$LWS = sanitizer$LWS.sanitize(responseText$LWS);
9529
- if (!isEqualDomString$LWS(trusted.createHTML(responseText$LWS), trusted.createHTML(sanitized$LWS)) || isInherentlyUnsecure$LWS(responseText$LWS)) {
10919
+ if (!isEqualDomString$LWS(trusted.createHTML(responseText$LWS), trusted.createHTML(sanitized$LWS)) || isIframeSrcdocScriptAttack$LWS(responseText$LWS)) {
10920
+ URLRevokeObjectURL$LWS(outURL$LWS);
10921
+ throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
10922
+ }
10923
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(responseText$LWS) || isXMLNamespacedScriptAttack$LWS(responseText$LWS))) {
9530
10924
  URLRevokeObjectURL$LWS(outURL$LWS);
9531
10925
  throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
9532
10926
  }
@@ -9681,7 +11075,7 @@ function initDistortionWindowFetch$LWS({
9681
11075
  url$LWS = parsedURL$LWS.normalizedURL;
9682
11076
  args$LWS[0] = url$LWS;
9683
11077
  }
9684
- if (!isValidURL$LWS(parsedURL$LWS)) {
11078
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
9685
11079
  const {
9686
11080
  normalizedURL: normalizedURL$LWS
9687
11081
  } = parsedURL$LWS;
@@ -9723,7 +11117,7 @@ function initDistortionWindowFetchLater$LWS({
9723
11117
  url$LWS = parsedURL$LWS.normalizedURL;
9724
11118
  args$LWS[0] = url$LWS;
9725
11119
  }
9726
- if (!isValidURL$LWS(parsedURL$LWS)) {
11120
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
9727
11121
  const {
9728
11122
  normalizedURL: normalizedURL$LWS
9729
11123
  } = parsedURL$LWS;
@@ -9963,6 +11357,42 @@ function initDistortionWindowLengthGetter$LWS({
9963
11357
  return distortionEntry$LWS;
9964
11358
  };
9965
11359
  }
11360
+ function initDistortionWindowNameGetter$LWS({
11361
+ globalObject: globalObject$LWS
11362
+ }) {
11363
+ const originalNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(globalObject$LWS, 'name');
11364
+ // istanbul ignore if: currently unreachable via tests
11365
+ if (typeof originalNameGetter$LWS !== 'function') {
11366
+ return noop$LWS$1;
11367
+ }
11368
+ const distortionEntry$LWS = [originalNameGetter$LWS, function name$LWS() {
11369
+ if (this === rootWindow$LWS$1) {
11370
+ return '';
11371
+ }
11372
+ return ReflectApply$LWS$1(originalNameGetter$LWS, this, []);
11373
+ }];
11374
+ return function distortionWindowNameGetter$LWS() {
11375
+ return distortionEntry$LWS;
11376
+ };
11377
+ }
11378
+ function initDistortionWindowNameSetter$LWS({
11379
+ globalObject: globalObject$LWS
11380
+ }) {
11381
+ const originalNameSetter$LWS = ObjectLookupOwnSetter$LWS(globalObject$LWS, 'name');
11382
+ // istanbul ignore if: currently unreachable via tests
11383
+ if (typeof originalNameSetter$LWS !== 'function') {
11384
+ return noop$LWS$1;
11385
+ }
11386
+ const distortionEntry$LWS = [originalNameSetter$LWS, function name$LWS(value$LWS) {
11387
+ if (this === rootWindow$LWS$1) {
11388
+ return;
11389
+ }
11390
+ ReflectApply$LWS$1(originalNameSetter$LWS, this, [value$LWS]);
11391
+ }];
11392
+ return function distortionWindowNameSetter$LWS() {
11393
+ return distortionEntry$LWS;
11394
+ };
11395
+ }
9966
11396
  function initDistortionWindowOnrejectionhandled$LWS({
9967
11397
  globalObject: globalObject$LWS,
9968
11398
  globalObject: {
@@ -10002,25 +11432,32 @@ function initDistortionWindowOpen$LWS({
10002
11432
  }) {
10003
11433
  const distortionEntry$LWS = [originalWindowOpen$LWS, function open$LWS(...args$LWS) {
10004
11434
  const normalizedArgs$LWS = normalizeWindowOpenArguments$LWS(args$LWS);
10005
- const childWindow$LWS = ReflectApply$LWS$1(originalWindowOpen$LWS, this, normalizedArgs$LWS);
11435
+ // istanbul ignore next: resourceUrl default is not reachable via tests
10006
11436
  const {
10007
11437
  0: resourceUrl$LWS = ''
10008
11438
  } = 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
11439
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isAttemptingToExploitURL$LWS(resourceUrl$LWS)) {
11440
+ throw new LockerSecurityError$LWS(`Cannot open: ${resourceUrl$LWS}`);
11441
+ }
11442
+ // Validate that same-origin URLs don't target endpoints that could be exploited
11443
+ // via browsing contexts. Unlike fetch/XHR, browsing contexts (window.open, iframe)
11444
+ // can be manipulated by attackers to inject malicious content.
11445
+ if (isGaterEnabledFeature$LWS('changesSince.262') && isSameOriginURL$LWS(resourceUrl$LWS)) {
11446
+ const parsedURL$LWS = parseURL$LWS(resourceUrl$LWS);
11447
+ if (!isValidBrowsingContextURL$LWS(parsedURL$LWS)) {
11448
+ throw new LockerSecurityError$LWS(`Cannot open disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
11449
+ }
11450
+ }
11451
+ const childWindow$LWS = ReflectApply$LWS$1(originalWindowOpen$LWS, this, normalizedArgs$LWS);
11452
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11453
+ // istanbul ignore else: previous behavior will not be tested in collection coverage
11454
+ if (isGaterEnabledFeature$LWS('changesSince.256')) {
11455
+ if (isSameOriginURL$LWS(resourceUrl$LWS)) {
11456
+ markForUnsafePropertyBlocking$LWS(childWindow$LWS);
11457
+ }
11458
+ } else {
10019
11459
  markForUnsafePropertyBlocking$LWS(childWindow$LWS);
10020
11460
  }
10021
- } else {
10022
- // When the gate is disabled, mark all child windows
10023
- markForUnsafePropertyBlocking$LWS(childWindow$LWS);
10024
11461
  }
10025
11462
  // W-14218118
10026
11463
  // If the target is '_self', '_parent', or '_top', only makes one request
@@ -10093,7 +11530,9 @@ function initDistortionWindowSetInterval$LWS({
10093
11530
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
10094
11531
  }) {
10095
11532
  return [originalSetInterval$LWS, function setInterval$LWS(...args$LWS) {
10096
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setInterval');
11533
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11534
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setInterval');
11535
+ }
10097
11536
  if (args$LWS.length) {
10098
11537
  const {
10099
11538
  0: callback$LWS
@@ -10107,12 +11546,8 @@ function initDistortionWindowSetInterval$LWS({
10107
11546
  // Defer transforming source text asynchronously.
10108
11547
  sandboxEvaluator$LWS(transformSourceText$LWS(sourceText$LWS), UNCOMPILED_CONTEXT$LWS);
10109
11548
  };
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
- }
11549
+ } else if (isGaterEnabledFeature$LWS('changesSince.256')) {
11550
+ throwIfUnsafeCallbackReference$LWS(callback$LWS);
10116
11551
  }
10117
11552
  }
10118
11553
  }
@@ -10131,7 +11566,9 @@ function initDistortionWindowSetTimeout$LWS({
10131
11566
  virtualEnvironmentEvaluator: virtualEnvironmentEvaluator$LWS
10132
11567
  }) {
10133
11568
  return [originalSetTimeout$LWS, function setTimeout$LWS(...args$LWS) {
10134
- throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setTimeout');
11569
+ if (!isGaterEnabledFeature$LWS('changesSince.262')) {
11570
+ throwIfMarkedAsUnsafeInChildWindow$LWS(virtualEnvironmentEvaluator$LWS, 'setTimeout');
11571
+ }
10135
11572
  if (args$LWS.length) {
10136
11573
  const {
10137
11574
  0: callback$LWS
@@ -10145,12 +11582,8 @@ function initDistortionWindowSetTimeout$LWS({
10145
11582
  // Defer transforming source text asynchronously.
10146
11583
  sandboxEvaluator$LWS(transformSourceText$LWS(sourceText$LWS), UNCOMPILED_CONTEXT$LWS);
10147
11584
  };
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
- }
11585
+ } else if (isGaterEnabledFeature$LWS('changesSince.256')) {
11586
+ throwIfUnsafeCallbackReference$LWS(callback$LWS);
10154
11587
  }
10155
11588
  }
10156
11589
  }
@@ -10246,7 +11679,7 @@ function initDistortionXMLHttpRequestOpen$LWS({
10246
11679
  const url$LWS = args$LWS.length > 1 ? args$LWS[1] : undefined;
10247
11680
  if (url$LWS !== null && url$LWS !== undefined) {
10248
11681
  const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(url$LWS));
10249
- if (!isValidURL$LWS(parsedURL$LWS)) {
11682
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
10250
11683
  throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${parsedURL$LWS.normalizedURL}`);
10251
11684
  }
10252
11685
  args$LWS[1] = parsedURL$LWS.normalizedURL;
@@ -10266,12 +11699,17 @@ function replaceDocumentContent$LWS(doc$LWS, content$LWS) {
10266
11699
  }
10267
11700
  function initDistortionXMLHttpRequestResponseGetter$LWS({
10268
11701
  document: document$LWS,
11702
+ globalObject: globalObject$LWS,
10269
11703
  globalObject: {
10270
11704
  Document: Document$LWS,
10271
11705
  XMLHttpRequest: XMLHttpRequest$LWS
10272
11706
  }
10273
11707
  }) {
10274
11708
  const originalResponseGetter$LWS = ObjectLookupOwnGetter$LWS$1(XMLHttpRequest$LWS.prototype, 'response');
11709
+ const {
11710
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11711
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
11712
+ } = getValidator$LWS(document$LWS, globalObject$LWS);
10275
11713
  return function distortionXMLHttpRequestResponseGetter$LWS({
10276
11714
  key: key$LWS
10277
11715
  }) {
@@ -10285,6 +11723,9 @@ function initDistortionXMLHttpRequestResponseGetter$LWS({
10285
11723
  if (rawResponse$LWS instanceof Document$LWS) {
10286
11724
  const docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
10287
11725
  const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
11726
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
11727
+ throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest response using an unsecure ${toSafeTemplateStringValue$LWS(rawResponse$LWS)}.`);
11728
+ }
10288
11729
  return replaceDocumentContent$LWS(rawResponse$LWS, lwsInternalPolicy$LWS.createHTML(content$LWS, key$LWS, ContentType$LWS.HTML));
10289
11730
  }
10290
11731
  return rawResponse$LWS;
@@ -10293,11 +11734,16 @@ function initDistortionXMLHttpRequestResponseGetter$LWS({
10293
11734
  }
10294
11735
  function initDistortionXMLHttpRequestResponseXMLGetter$LWS({
10295
11736
  document: document$LWS,
11737
+ globalObject: globalObject$LWS,
10296
11738
  globalObject: {
10297
11739
  XMLHttpRequest: XMLHttpRequest$LWS
10298
11740
  }
10299
11741
  }) {
10300
11742
  const originalResponseXMLGetter$LWS = ObjectLookupOwnGetter$LWS$1(XMLHttpRequest$LWS.prototype, 'responseXML');
11743
+ const {
11744
+ isXMLEntityAttack: isXMLEntityAttack$LWS,
11745
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
11746
+ } = getValidator$LWS(document$LWS, globalObject$LWS);
10301
11747
  return function distortionXMLHttpRequestResponseXMLGetter$LWS({
10302
11748
  key: key$LWS
10303
11749
  }) {
@@ -10310,6 +11756,9 @@ function initDistortionXMLHttpRequestResponseXMLGetter$LWS({
10310
11756
  setCustomElementsRegistry$LWS(document$LWS, key$LWS);
10311
11757
  const docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponseXML$LWS, []);
10312
11758
  const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
11759
+ if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
11760
+ throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest responseXML using an unsecure ${toSafeTemplateStringValue$LWS(rawResponseXML$LWS)}.`);
11761
+ }
10313
11762
  return replaceDocumentContent$LWS(rawResponseXML$LWS, lwsInternalPolicy$LWS.createHTML(content$LWS, key$LWS, ContentType$LWS.HTML));
10314
11763
  }];
10315
11764
  };
@@ -10329,29 +11778,35 @@ initDistortionBroadcastChannelPostMessage$LWS,
10329
11778
  // CSSStyleRule
10330
11779
  initDistortionCSSStyleRuleStyleGetter$LWS,
10331
11780
  // Document
10332
- initDistortionDocumentDomainSetter$LWS, initDistortionDocumentOnsecuritypolicyviolation$LWS, initDistortionDocumentOpen$LWS,
11781
+ initDistortionDocumentCreateNodeIterator$LWS, initDistortionDocumentCreateTreeWalker$LWS, initDistortionDocumentDomainSetter$LWS, initDistortionDocumentOnsecuritypolicyviolation$LWS, initDistortionDocumentOpen$LWS,
10333
11782
  // Element
10334
- initDistortionElementAttributesGetter$LWS, initDistortionElementGetInnerHTML$LWS, initDistortionElementRemove$LWS, initDistortionElementReplaceChildren$LWS, initDistortionElementReplaceWith$LWS,
11783
+ initDistortionElementAttributesGetter$LWS, initDistortionElementGetInnerHTML$LWS, initDistortionElementInnerHTMLGetter$LWS, initDistortionElementOuterHTMLGetter$LWS, initDistortionElementRemove$LWS, initDistortionElementReplaceChildren$LWS, initDistortionElementReplaceWith$LWS,
10335
11784
  // Function
10336
11785
  initDistortionFunction$LWS,
10337
11786
  // History
10338
11787
  initDistortionHistoryPushState$LWS, initDistortionHistoryReplaceState$LWS,
10339
11788
  // HTMLElement
10340
- initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
11789
+ initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
10341
11790
  // HTMLIFrameElement
10342
11791
  initDistortionIFrameElementContentDocumentGetter$LWS, initDistortionIFrameElementContentWindowGetter$LWS, initDistortionHTMLIFrameElementSandboxGetter$LWS, initDistortionHTMLIFrameElementSandboxSetter$LWS, initDistortionHTMLIFrameElementSrcSetter$LWS,
10343
11792
  // HTMLLinkElement
10344
11793
  initDistortionHTMLLinkElementRelSetter$LWS, initDistortionHTMLLinkElementRelListSetter$LWS,
11794
+ // HTMLMetaElement
11795
+ initDistortionHTMLMetaElementContentGetter$LWS,
10345
11796
  // HTMLObjectElement
10346
11797
  initDistortionHTMLObjectElementDataSetter$LWS,
10347
11798
  // HTMLScriptElement
10348
- initDistortionHTMLScriptElementSrcGetter$LWS, initDistortionHTMLScriptElementTextContentGetter$LWS, initDistortionHTMLScriptElementTextContentSetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
11799
+ initDistortionHTMLScriptElementInnerTextGetter$LWS, initDistortionHTMLScriptElementSrcGetter$LWS, initDistortionHTMLScriptElementTextContentGetter$LWS, initDistortionHTMLScriptElementTextContentSetter$LWS, initDistortionHTMLScriptElementTextGetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
10349
11800
  // IDBObjectStore
10350
11801
  initDistortionIDBObjectStoreAdd$LWS, initDistortionIDBObjectStorePut$LWS,
10351
11802
  // MessagePort
10352
11803
  initDistortionMessagePortPostMessage$LWS,
11804
+ // MutationObserver
11805
+ initDistortionMutationObserverObserve$LWS,
10353
11806
  // Navigator
10354
11807
  initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS,
11808
+ // Observable
11809
+ initDistortionObservableForEach$LWS, initDistortionObservableSubscribe$LWS,
10355
11810
  // Node
10356
11811
  initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
10357
11812
  // Performance
@@ -10359,19 +11814,21 @@ initDistortionPerformanceMark$LWS, initDistortionPerformanceMeasure$LWS,
10359
11814
  // PerformanceMark
10360
11815
  initDistortionPerformanceMarkCtor$LWS,
10361
11816
  // Promise
10362
- initDistortionPromiseTry$LWS,
11817
+ initDistortionPromiseAll$LWS, initDistortionPromiseAllSettled$LWS, initDistortionPromiseAny$LWS, initDistortionPromiseCatch$LWS, initDistortionPromiseFinally$LWS, initDistortionPromiseRace$LWS, initDistortionPromiseReject$LWS, initDistortionPromiseResolve$LWS, initDistortionPromiseThen$LWS, initDistortionPromiseTry$LWS, initDistortionPromiseWithResolvers$LWS,
10363
11818
  // Notification
10364
11819
  initDistortionNotificationCtor$LWS,
10365
11820
  // 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,
11821
+ 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
11822
  // Selection
10368
- initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS,
11823
+ initDistortionSelectionAnchorNodeGetter$LWS, initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionFocusNodeGetter$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS, initDistortionSelectionToString$LWS,
10369
11824
  // ServiceWorkerContainer
10370
11825
  initDistortionServiceWorkerContainerProto$LWS,
10371
11826
  // SharedWorker
10372
11827
  initDistortionSharedWorkerCtor$LWS, initDistortionSharedWorkerProto$LWS,
10373
11828
  // Storage
10374
11829
  initDistortionStorage$LWS, initDistortionStorageClear$LWS, initDistortionStorageGetItem$LWS, initDistortionStorageKey$LWS, initDistortionStorageLength$LWS, initDistortionStorageRemoveItem$LWS, initDistortionStorageSetItem$LWS,
11830
+ // SVGAnimatedString
11831
+ initDistortionSVGAnimatedStringBaseValSetter$LWS,
10375
11832
  // SVGAnimateElement
10376
11833
  initDistortionSVGAnimateElementFromAttribute$LWS, initDistortionSVGAnimateElementToAttribute$LWS, initDistortionSVGAnimateElementValuesAttribute$LWS,
10377
11834
  // SVGElement
@@ -10383,7 +11840,7 @@ initDistortionSVGUseElementHrefAttribute$LWS, initDistortionSVGUseElementXlinkHr
10383
11840
  // TrustedTypePolicyFactory
10384
11841
  initDistortionTrustedTypePolicyFactoryCreatePolicy$LWS,
10385
11842
  // Window
10386
- initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
11843
+ initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowNameGetter$LWS, initDistortionWindowNameSetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
10387
11844
  // Worker
10388
11845
  initDistortionWorkerCtor$LWS, initDistortionWorkerProto$LWS,
10389
11846
  // XHR
@@ -10404,21 +11861,33 @@ initDistortionDocumentCookieGetter$LWS, initDistortionDocumentCookieSetter$LWS,
10404
11861
  // DOMParser
10405
11862
  initDistortionDOMParserParseFromString$LWS,
10406
11863
  // 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,
11864
+ 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
11865
  // Eval
10409
11866
  initDistortionEval$LWS,
10410
11867
  // Event
10411
11868
  initDistortionEventComposedPath$LWS, initDistortionEventPathGetter$LWS,
10412
11869
  // EventTarget
10413
11870
  initDistortionEventTargetAddEventListener$LWS,
11871
+ // HTMLAnchorElement
11872
+ initDistortionHTMLAnchorElementHrefSetter$LWS,
11873
+ // HTMLBaseElement
11874
+ initDistortionHTMLBaseElementHrefSetter$LWS,
10414
11875
  // HTMLBodyElement
10415
11876
  initDistortionHTMLBodyElementOnrejectionhandled$LWS, initDistortionHTMLBodyElementOnstorage$LWS, initDistortionHTMLBodyElementOnunhandledrejection$LWS,
10416
11877
  // HTMLElement
10417
11878
  initDistortionHTMLElementCtor$LWS, initDistortionHTMLElementOnsecuritypolicyviolation$LWS,
11879
+ // HTMLButtonElement
11880
+ initDistortionHTMLButtonElementFormActionSetter$LWS,
11881
+ // HTMLFormElement
11882
+ initDistortionHTMLFormElementActionSetter$LWS,
11883
+ // HTMLInputElement
11884
+ initDistortionHTMLInputElementFormActionSetter$LWS,
10418
11885
  // HTMLFrameSetElement
10419
11886
  initDistortionHTMLFrameSetElementOnrejectionhandled$LWS, initDistortionHTMLFrameSetElementOnstorage$LWS, initDistortionHTMLFrameSetElementOnunhandledrejection$LWS,
10420
11887
  // HTMLScriptElement,
10421
11888
  initDistortionHTMLScriptElementSrcSetter$LWS, initDistortionHTMLScriptElementTextSetter$LWS,
11889
+ // IDBFactory
11890
+ initDistortionIDBFactoryDatabases$LWS, initDistortionIDBFactoryDeleteDatabase$LWS, initDistortionIDBFactoryOpen$LWS,
10422
11891
  // MathMLElement
10423
11892
  initDistortionMathMLElementOnsecuritypolicyviolation$LWS,
10424
11893
  // NamedNodeMap
@@ -10454,7 +11923,7 @@ initDistortionElementAfter$LWS, initDistortionElementAppend$LWS, initDistortionE
10454
11923
  // initDistortionNodeAppendChild,
10455
11924
  initDistortionNodeInsertBefore$LWS]);
10456
11925
  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']]));
11926
+ const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionCacheStorageDelete$LWS, 'caches'], [initDistortionCacheStorageHas$LWS, 'caches'], [initDistortionCacheStorageKeys$LWS, 'caches'], [initDistortionCacheStorageMatch$LWS, 'caches'], [initDistortionCacheStorageOpen$LWS, 'caches'], [initDistortionCookieStoreDelete$LWS, 'cookieStore'], [initDistortionCookieStoreGet$LWS, 'cookieStore'], [initDistortionCookieStoreGetAll$LWS, 'cookieStore'], [initDistortionCookieStoreOnChange$LWS, 'cookieStore'], [initDistortionCookieStoreSet$LWS, 'cookieStore'], [initDistortionCSSStyleRuleStyleGetter$LWS, 'style'], [initDistortionCustomElementRegistryDefine$LWS, 'customElements'], [initDistortionCustomElementRegistryGet$LWS, 'customElements'], [initDistortionCustomElementRegistryUpgrade$LWS, 'customElements'], [initDistortionCustomElementRegistryWhenDefined$LWS, 'customElements'], [initDistortionDocumentCookieGetter$LWS, 'documentCookie'], [initDistortionDocumentCookieSetter$LWS, 'documentCookie'], [initDistortionDocumentDomainSetter$LWS, 'documentDomain'], [initDistortionDocumentExecCommand$LWS, 'documentExecCommand'], [initDistortionDOMParserParseFromString$LWS, 'domParserParseFromString'], [initDistortionElementAfter$LWS, 'element'], [initDistortionElementAppend$LWS, 'element'], [initDistortionElementAttributesGetter$LWS, 'attributes'], [initDistortionElementBefore$LWS, 'element'], [initDistortionElementGetInnerHTML$LWS, 'innerHTML'], [initDistortionElementInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionElementInsertAdjacentElement$LWS, 'element'], [initDistortionElementInsertAdjacentHTML$LWS, 'element'], [initDistortionElementOuterHTMLSetter$LWS, 'element'], [initDistortionElementPrepend$LWS, 'element'], [initDistortionElementRemove$LWS, 'element'], [initDistortionElementReplaceChildren$LWS, 'element'], [initDistortionElementReplaceWith$LWS, 'element'], [initDistortionElementGetAttribute$LWS, 'attributes'], [initDistortionElementGetAttributeNode$LWS, 'attributes'], [initDistortionElementGetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementGetAttributeNS$LWS, 'attributes'], [initDistortionElementSetAttribute$LWS, 'attributes'], [initDistortionElementSetAttributeNode$LWS, 'attributes'], [initDistortionElementSetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementSetAttributeNS$LWS, 'attributes'], [initDistortionElementSetHTML$LWS, 'element'], [initDistortionElementToggleAttribute$LWS, 'attributes'], [initDistortionHTMLButtonElementFormActionSetter$LWS, 'form'], [initDistortionHTMLFormElementActionSetter$LWS, 'form'], [initDistortionHTMLInputElementFormActionSetter$LWS, 'form'], [initDistortionHistoryPushState$LWS, 'history'], [initDistortionHistoryReplaceState$LWS, 'history'], [initDistortionHTMLElementDatasetGetter$LWS, 'dataset'], [initDistortionHTMLElementStyleGetter$LWS, 'style'], [initDistortionHTMLScriptElementInnerTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBFactoryDatabases$LWS, 'indexedDB'], [initDistortionIDBFactoryDeleteDatabase$LWS, 'indexedDB'], [initDistortionIDBFactoryOpen$LWS, 'indexedDB'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionObservableForEach$LWS, 'observable'], [initDistortionObservableSubscribe$LWS, 'observable'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeRemoveChild$LWS, 'node'], [initDistortionNodeReplaceChild$LWS, 'node'], [initDistortionNodeTextContentGetter$LWS, 'node'], [initDistortionNodeTextContentSetter$LWS, 'node'], [initDistortionNodeValueSetter$LWS, 'node'], [initDistortionNotificationCtor$LWS, 'notification'], [initDistortionPerformanceMark$LWS, 'performance'], [initDistortionPerformanceMarkCtor$LWS, 'performance'], [initDistortionPerformanceMeasure$LWS, 'performance'], [initDistortionRangeCloneContents$LWS, 'range'], [initDistortionRangeCloneRange$LWS, 'range'], [initDistortionRangeCreateContextualFragment$LWS, 'range'], [initDistortionRangeDeleteContents$LWS, 'range'], [initDistortionRangeExtractContents$LWS, 'range'], [initDistortionRangeGetBoundingClientRect$LWS, 'range'], [initDistortionRangeInsertNode$LWS, 'range'], [initDistortionRangeSelectNode$LWS, 'range'], [initDistortionRangeSelectNodeContents$LWS, 'range'], [initDistortionRangeSetEnd$LWS, 'range'], [initDistortionRangeSetEndAfter$LWS, 'range'], [initDistortionRangeSetEndBefore$LWS, 'range'], [initDistortionRangeSetStart$LWS, 'range'], [initDistortionRangeSetStartAfter$LWS, 'range'], [initDistortionRangeSetStartBefore$LWS, 'range'], [initDistortionRangeSurroundContents$LWS, 'range'], [initDistortionRangeToString$LWS, 'range'], [initDistortionSelectionAnchorNodeGetter$LWS, 'selection'], [initDistortionSelectionCollapse$LWS, 'selection'], [initDistortionSelectionExtend$LWS, 'selection'], [initDistortionSelectionFocusNodeGetter$LWS, 'selection'], [initDistortionSelectionSelectAllChildren$LWS, 'selection'], [initDistortionSelectionSetBaseAndExtent$LWS, 'selection'], [initDistortionSelectionSetPosition$LWS, 'selection'], [initDistortionSelectionToString$LWS, 'selection'], [initDistortionSessionStorage$LWS, 'storage'], [initDistortionShadowRootInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionStorage$LWS, 'storage'], [initDistortionStorageClear$LWS, 'storage'], [initDistortionStorageGetItem$LWS, 'storage'], [initDistortionStorageKey$LWS, 'storage'], [initDistortionStorageLength$LWS, 'storage'], [initDistortionStorageRemoveItem$LWS, 'storage'], [initDistortionStorageSetItem$LWS, 'storage'], [initDistortionSVGElementDatasetGetter$LWS, 'dataset'], [initDistortionSVGElementStyleGetter$LWS, 'style'], [initDistortionSVGAnimatedStringBaseValSetter$LWS, 'script'], [initDistortionSVGScriptElementHrefGetter$LWS, 'script'], [initDistortionSVGScriptElementHrefSetter$LWS, 'script'], [initDistortionWindowFetch$LWS, 'windowFetch'], [initDistortionWindowFetchLater$LWS, 'windowFetchLater'], [initDistortionWindowFramesGetter$LWS, 'windowFrames'], [initDistortionWindowGetComputedStyle$LWS, 'style'], [initDistortionWindowLengthGetter$LWS, 'windowFrames'], [initDistortionWindowNameGetter$LWS, 'windowName'], [initDistortionWindowNameSetter$LWS, 'windowName'], [initDistortionWindowPostMessage$LWS, 'postMessage'], [initDistortionWindowSetInterval$LWS, 'setInterval'], [initDistortionWindowSetTimeout$LWS, 'setTimeout'], [initDistortionXMLHttpRequestResponseGetter$LWS, 'xhr'], [initDistortionXMLHttpRequestResponseXMLGetter$LWS, 'xhr']]));
10458
11927
  const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
10459
11928
  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
11929
  const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
@@ -10474,7 +11943,7 @@ const SVGElementProtoBlockedProperties$LWS = ['nonce'];
10474
11943
  const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
10475
11944
  const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
10476
11945
  const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
10477
- /*! version: 0.26.4 */
11946
+ /*! version: 0.27.7 */
10478
11947
 
10479
11948
  /*!
10480
11949
  * Copyright (C) 2021 salesforce.com, inc.
@@ -10483,7 +11952,7 @@ let pdpSchema$LWS;
10483
11952
  function getPdpSchema$LWS() {
10484
11953
  return pdpSchema$LWS;
10485
11954
  }
10486
- /*! version: 0.26.4 */
11955
+ /*! version: 0.27.7 */
10487
11956
 
10488
11957
  /*!
10489
11958
  * Copyright (C) 2019 salesforce.com, inc.
@@ -10682,15 +12151,10 @@ function createDistortionEntries$LWS(record$LWS, factories$LWS) {
10682
12151
  let distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS = proxyMaskedFunctionDistortion$LWS;
10683
12152
  if (ENABLE_DISTORTION_TOGGLE_SWITCHES$LWS && toggleSwitchName$LWS) {
10684
12153
  distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS = createDistortionToggleSwitchWrapper$LWS(record$LWS.key, toggleSwitchName$LWS, proxyMaskedFunctionDistortion$LWS, originalValue$LWS);
10685
- // If the distorted API originated in a window created via window.open or
10686
- // document.open, it may be marked as an unsafe property. If so, we need
10687
- // to transfer the original value's marker to the wrapped toggle switch
10688
- // function to ensure that the distortion itself can find the marker when
10689
- // checking if it needs to be blocked.
10690
- if (originalValue$LWS[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
10691
- const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(originalValue$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS);
10692
- ReflectDefineProperty$LWS$1(distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, descriptor$LWS);
10693
- }
12154
+ }
12155
+ if (!isGaterEnabledFeature$LWS('changesSince.262') && originalValue$LWS[CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS]) {
12156
+ const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(originalValue$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS);
12157
+ ReflectDefineProperty$LWS$1(distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS, CHILD_WINDOW_BLOCKED_PROPERTY_SYMBOL$LWS, descriptor$LWS);
10694
12158
  }
10695
12159
  entries$LWS[entries$LWS.length] = [originalValue$LWS, toggleSwitchName$LWS ? distortionToggleSwitchWrapperOrProxyMaskedFunction$LWS : proxyMaskedFunctionDistortion$LWS];
10696
12160
  } else {
@@ -15835,7 +17299,7 @@ function toSourceText$LWS(value$LWS, sourceType$LWS) {
15835
17299
  // tools from mistaking the regexp or the replacement string for an
15836
17300
  // actual source mapping URL.
15837
17301
  /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
15838
- sourceText$LWS = `\n//# LWS Version = "0.26.4"\n${sourceText$LWS}`;
17302
+ sourceText$LWS = `\n//# LWS Version = "0.27.7"\n${sourceText$LWS}`;
15839
17303
  return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
15840
17304
  // Append "'use strict'" to the extracted function body so it is
15841
17305
  // evaluated in strict mode.
@@ -15849,6 +17313,14 @@ const IFRAME_KEEP_ALIVE_FLAG$LWS = LOCKER_UNMINIFIED_FLAG$LWS$1 && !false;
15849
17313
  // created distortion map.
15850
17314
  const rootDistortionMapSeedEntries$LWS = [[rootDocument$LWS, rootDocument$LWS], [rootWindowLocation$LWS, rootWindowLocation$LWS], [rootWindow$LWS$1, rootWindow$LWS$1]];
15851
17315
  const seenGlobalObjects$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
17316
+ // Tracks child windows and the last document for which distortions were
17317
+ // created. Unlike the non-iterable WeakSet above, this Map can be walked in
17318
+ // distortionCallback to eagerly detect navigations that the event-based
17319
+ // detection (unload → microtask → DOMContentLoaded) may have missed due to
17320
+ // timing: the microtask can run before the browser has replaced the document,
17321
+ // causing the check to bail out and the DOMContentLoaded listener to never be
17322
+ // attached.
17323
+ const childWindowDocuments$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
15852
17324
  function createGetVirtualEnvironment$LWS(record$LWS) {
15853
17325
  let virtualEnvironment$LWS;
15854
17326
  return () => {
@@ -15947,9 +17419,73 @@ function createVirtualEnvironment$LWS(record$LWS) {
15947
17419
  distortionCallback(originalTarget$LWS) {
15948
17420
  const distortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
15949
17421
  if (distortedTarget$LWS) {
17422
+ // The WindowProxy maintains identity across navigations, but
17423
+ // each navigation replaces the inner window and all its
17424
+ // realm-specific prototypes. Detect this by checking whether
17425
+ // the WindowProxy's current document has been registered in
17426
+ // the distortion map. If not, the inner window has been
17427
+ // replaced and we must create a secondary sandbox record for
17428
+ // the new realm before its undistorted prototypes can be
17429
+ // reached by sandboxed code.
17430
+ if (isGaterEnabledFeature$LWS('changesSince.262') && distortedTarget$LWS === originalTarget$LWS && seenGlobalObjects$LWS.has(originalTarget$LWS)) {
17431
+ try {
17432
+ const currentDoc$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
17433
+ if (!distortions$LWS.has(currentDoc$LWS)) {
17434
+ createSecondaryWindowSandboxRecord$LWS({
17435
+ context: EMPTY_OBJECT$LWS,
17436
+ document: currentDoc$LWS,
17437
+ globalObject: originalTarget$LWS,
17438
+ key: key$LWS,
17439
+ type: type$LWS
17440
+ }, _root$LWS);
17441
+ }
17442
+ } catch (_unused1$LWS) {
17443
+ // Cross-origin window — document access throws.
17444
+ // Opaque sandbox record was already created on first
17445
+ // encounter; nothing more to do.
17446
+ }
17447
+ }
15950
17448
  return distortedTarget$LWS;
15951
17449
  }
15952
17450
  if (typeof originalTarget$LWS === 'function') {
17451
+ // When a child window navigates, the browser replaces the
17452
+ // inner window and all its realm-specific built-ins (eval,
17453
+ // Function, Document.prototype, etc.). Near-membrane caches
17454
+ // the WindowProxy's proxy pointer, so distortionCallback is
17455
+ // never re-invoked for the WindowProxy itself — but the NEW
17456
+ // built-ins ARE seen as unknown objects here. Walk the child
17457
+ // window map and, for any window whose document has changed
17458
+ // since we last created distortions, eagerly create a
17459
+ // secondary sandbox record. This populates the distortion
17460
+ // map with entries for the new realm's objects so the
17461
+ // re-lookup below can succeed.
17462
+ if (isGaterEnabledFeature$LWS('changesSince.262') && childWindowDocuments$LWS.size > 0) {
17463
+ for (const [childGlobalObject$LWS, lastDocument$LWS] of childWindowDocuments$LWS) {
17464
+ // Only process child windows belonging to this
17465
+ // sandbox (each sandbox has its own distortion map).
17466
+ if (!distortions$LWS.has(childGlobalObject$LWS)) {
17467
+ continue;
17468
+ }
17469
+ try {
17470
+ const currentDoc$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, childGlobalObject$LWS, []);
17471
+ if (currentDoc$LWS !== lastDocument$LWS) {
17472
+ createSecondaryWindowSandboxRecord$LWS({
17473
+ context: EMPTY_OBJECT$LWS,
17474
+ document: currentDoc$LWS,
17475
+ globalObject: childGlobalObject$LWS,
17476
+ key: key$LWS,
17477
+ type: type$LWS
17478
+ }, _root$LWS);
17479
+ const newDistortedTarget$LWS = distortions$LWS.get(originalTarget$LWS);
17480
+ if (newDistortedTarget$LWS) {
17481
+ return newDistortedTarget$LWS;
17482
+ }
17483
+ }
17484
+ } catch (_unused35$LWS) {
17485
+ // Cross-origin window — document access throws.
17486
+ }
17487
+ }
17488
+ }
15953
17489
  return originalTarget$LWS;
15954
17490
  }
15955
17491
  // Perform the first own property check in a try-catch to avoid
@@ -15962,7 +17498,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15962
17498
  if (!ObjectHasOwn$LWS$1(originalTarget$LWS, 'location')) {
15963
17499
  return originalTarget$LWS;
15964
17500
  }
15965
- } catch (_unused1$LWS) {
17501
+ } catch (_unused36$LWS) {
15966
17502
  // Likely an opaque object of a cross-origin window.
15967
17503
  // istanbul ignore next: an access of property iframe.contentWindow.location.href on an opaque window, that should reach this catch clause IS tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
15968
17504
  return originalTarget$LWS;
@@ -15978,7 +17514,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15978
17514
  // not a window object, or if it is an opaque cross-origin window.
15979
17515
  originalTargetDocument$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
15980
17516
  originalTargetWindow$LWS = originalTarget$LWS;
15981
- } catch (_unused35$LWS) {
17517
+ } catch (_unused37$LWS) {
15982
17518
  try {
15983
17519
  // istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
15984
17520
  if (ReflectApply$LWS$1(WindowLocationGetter$LWS, originalTarget$LWS, [])) {
@@ -15990,7 +17526,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
15990
17526
  return originalTarget$LWS;
15991
17527
  }
15992
17528
  // eslint-disable-next-line no-empty
15993
- } catch (_unused36$LWS) {}
17529
+ } catch (_unused38$LWS) {}
15994
17530
  }
15995
17531
  // Check if originalTarget is a document and get its defaultView.
15996
17532
  } else if ('defaultView' in originalTarget$LWS) {
@@ -16004,7 +17540,7 @@ function createVirtualEnvironment$LWS(record$LWS) {
16004
17540
  // This will throw if `originalTarget` is not a document object.
16005
17541
  defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, originalTarget$LWS, []);
16006
17542
  // eslint-disable-next-line no-empty
16007
- } catch (_unused37$LWS) {}
17543
+ } catch (_unused39$LWS) {}
16008
17544
  if (defaultView$LWS) {
16009
17545
  originalTargetDocument$LWS = originalTarget$LWS;
16010
17546
  originalTargetWindow$LWS = defaultView$LWS;
@@ -16240,6 +17776,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16240
17776
  // virtual environment distortion callback by adding them to the root window's
16241
17777
  // distortion map.
16242
17778
  distortions$LWS.set(document$LWS, document$LWS);
17779
+ childWindowDocuments$LWS.set(globalObject$LWS, document$LWS);
16243
17780
  distortions$LWS.set(location$LWS, location$LWS);
16244
17781
  const seenGlobalObject$LWS = seenGlobalObjects$LWS.has(globalObject$LWS);
16245
17782
  if (!seenGlobalObject$LWS) {
@@ -16293,7 +17830,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16293
17830
  type: type$LWS
16294
17831
  }, _root$LWS);
16295
17832
  }
16296
- } catch (_unused38$LWS) {
17833
+ } catch (_unused40$LWS) {
16297
17834
  // istanbul ignore next: this is a safety precaution that is unreachable via tests
16298
17835
  createOpaqueSecondaryWindowSandboxRecord$LWS({
16299
17836
  globalObject: globalObject$LWS,
@@ -16332,7 +17869,7 @@ function createSecondaryWindowSandboxRecord$LWS({
16332
17869
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
16333
17870
  // istanbul ignore next: currently unreachable via tests
16334
17871
  ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
16335
- } catch (_unused39$LWS) {
17872
+ } catch (_unused41$LWS) {
16336
17873
  // istanbul ignore next: this is a safety precaution that is unreachable via tests
16337
17874
  createOpaqueSecondaryWindowSandboxRecord$LWS({
16338
17875
  globalObject: globalObject$LWS,
@@ -16558,7 +18095,7 @@ function wrapPlatformResourceLoader$LWS(dep$LWS, key$LWS) {
16558
18095
  depRegistry$LWS.set(dep$LWS, secureDep$LWS);
16559
18096
  return secureDep$LWS;
16560
18097
  }
16561
- /*! version: 0.26.4 */
18098
+ /*! version: 0.27.7 */
16562
18099
 
16563
18100
  const loaderDefine = (globalThis ).LWR.define;
16564
18101