@locker/cli 0.29.0 → 0.29.1

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.
@@ -1018,6 +1018,10 @@
1018
1018
  const {
1019
1019
  parse: JSONParse$LWS
1020
1020
  } = JSON;
1021
+ // Used by '@locker/near-membrane-dom'.
1022
+ const {
1023
+ stringify: JSONStringify$LWS$1
1024
+ } = JSON;
1021
1025
  function getNearMembraneProxySerializedValue$LWS$1(object$LWS) {
1022
1026
  if (typeof object$LWS === 'object' && object$LWS !== null || typeof object$LWS === 'function') {
1023
1027
  // To extract the serialized value of a blue near-membrane proxy we must
@@ -1370,7 +1374,7 @@
1370
1374
  // reads identically to what isGaterEnabledFeature stores (register and
1371
1375
  // deregister also accept the short form via fullName above). Frozen so a
1372
1376
  // consumer cannot mutate the shared array.
1373
- Object.freeze([`${FEATURE_NAME_PREFIX$LWS}changesSince.260`, `${FEATURE_NAME_PREFIX$LWS}changesSince.262`, `${FEATURE_NAME_PREFIX$LWS}changesSince.264`, `${FEATURE_NAME_PREFIX$LWS}changesSince.266`, `${FEATURE_NAME_PREFIX$LWS}htmlAnchorElementHrefValidation`, `${FEATURE_NAME_PREFIX$LWS}enableSandboxedSameOriginIframe`, `${FEATURE_NAME_PREFIX$LWS}xmlEntityAttackPrologScan`]);
1377
+ Object.freeze([`${FEATURE_NAME_PREFIX$LWS}changesSince.260`, `${FEATURE_NAME_PREFIX$LWS}changesSince.262`, `${FEATURE_NAME_PREFIX$LWS}changesSince.264`, `${FEATURE_NAME_PREFIX$LWS}changesSince.266`, `${FEATURE_NAME_PREFIX$LWS}htmlAnchorElementHrefValidation`, `${FEATURE_NAME_PREFIX$LWS}enableSandboxedSameOriginIframe`, `${FEATURE_NAME_PREFIX$LWS}iframeSrcSameOriginPreflightCheck`, `${FEATURE_NAME_PREFIX$LWS}xmlEntityAttackPrologScan`]);
1374
1378
  function registerGaterEnabledFeatures$LWS(lockerGaterEnabledFeatures$LWS) {
1375
1379
  if (ArrayIsArray$LWS$1(lockerGaterEnabledFeatures$LWS)) {
1376
1380
  lockerGaterEnabledFeatures$LWS.forEach(feature$LWS => gaterEnabledFeatures$LWS.add(fullName$LWS(feature$LWS)));
@@ -1555,7 +1559,7 @@
1555
1559
  const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
1556
1560
  const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
1557
1561
  toSafeSet$LWS(new SetCtor$LWS$1());
1558
- /*! version: 0.29.0 */
1562
+ /*! version: 0.29.1 */
1559
1563
 
1560
1564
  /*!
1561
1565
  * Copyright (C) 2019 salesforce.com, inc.
@@ -2125,9 +2129,19 @@
2125
2129
  }
2126
2130
  const NodeProtoOwnerDocumentGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'ownerDocument');
2127
2131
  ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'parentNode');
2128
- ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
2132
+ const {
2133
+ get: NodeProtoTextContentGetter$LWS,
2134
+ set: NodeProtoTextContentSetter$LWS
2135
+ } = ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
2129
2136
  const rootDocumentDetachedFragment$LWS = ReflectApply$LWS$1(DocumentProtoCreateDocumentFragment$LWS, rootDocument$LWS, []);
2130
2137
  const rootDocumentDetachedContainer$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['div']);
2138
+ // Inert parse surface for the hidden-<script> heuristic (changesSince.266,
2139
+ // W-23595929). Template contents are parsed into an inert template-owner
2140
+ // document: custom elements are never upgraded, scripts never execute, and
2141
+ // resource-loading attributes never fire — so setting innerHTML here decodes
2142
+ // entities/obfuscation exactly like a live parse but has no observable side
2143
+ // effects in the shared realm.
2144
+ const rootDocumentDetachedTemplate$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['template']);
2131
2145
  // Regex to match null bytes and zero-width characters that browsers may strip or ignore
2132
2146
  // \x00 - Null byte
2133
2147
  // \u00AD - Soft Hyphen
@@ -2329,23 +2343,55 @@
2329
2343
  if (!hasScript$LWS) {
2330
2344
  return false;
2331
2345
  }
2346
+ // changesSince.266 (W-23595929): decide the hidden-<script> verdict by
2347
+ // parsing into an inert <template>, never a live <div> owned by the shared
2348
+ // root document. Setting innerHTML on a rootDocument-owned element runs the
2349
+ // HTML fragment parser in the shared realm, and that parse upgrades any
2350
+ // custom element it encounters — running the element's constructor
2351
+ // SYNCHRONOUSLY, before this inspection returns the verdict that would
2352
+ // reject the input. An attacker who replays a leaked `lskey` registry token
2353
+ // can route that upgrade to a sandbox-defined constructor and have it run in
2354
+ // the host realm as a side effect of this supposedly-inert text check (the
2355
+ // clone-a-live-<script> escape). Template contents are inert, so the parse
2356
+ // still decodes entities/obfuscation for an accurate innerHTML-vs-text
2357
+ // comparison but cannot upgrade custom elements, execute scripts, or fire
2358
+ // resource-loading attributes. Mirrors the ContentType.SVG template fix in
2359
+ // @locker/internal-policy.
2360
+ if (isGaterEnabledFeature$LWS('changesSince.266')) {
2361
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, [normalizedInput$LWS]);
2362
+ // Element.prototype.innerHTML on a <template> reflects the serialized
2363
+ // template contents, but textContent must be read off the content
2364
+ // fragment: the parsed nodes live there, not as children of the
2365
+ // <template> element itself (template.textContent would be '').
2366
+ const innerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedTemplate$LWS, []);
2367
+ const content$LWS = ReflectApply$LWS$1(HTMLTemplateElementProtoContentGetter$LWS, rootDocumentDetachedTemplate$LWS, []);
2368
+ const textContent$LWS = toSafeStringValue$LWS(ReflectApply$LWS$1(NodeProtoTextContentGetter$LWS, content$LWS, []));
2369
+ // Release the parsed nodes so nothing lingers on the shared template
2370
+ // between calls.
2371
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, ['']);
2372
+ // The legacy detached-<div> path reads innerText from an unrendered
2373
+ // element, which per spec is that element's textContent — the same value
2374
+ // read above. Strip < > : so a decoded entity such as &lt;script&gt; in
2375
+ // visible text cannot mask a genuinely hidden <script> (same rationale as
2376
+ // the changesSince.262 strip in the legacy path below).
2377
+ const checkableText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, textContent$LWS, [/[<>:]/g, '']);
2378
+ return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableText$LWS, 'script');
2379
+ }
2332
2380
  // This is obnoxious... jsdom doesn't implement HTMLElement.prototype.innerText
2333
2381
  if (!HTMLElementProtoInnerTextGetter$LWS) {
2334
2382
  return true;
2335
2383
  }
2336
- // If the input contained the word "script", then we need to confirm that the string
2337
- // that was seen is actually markup.
2338
- //
2339
- // IMPORTANT: We CANNOT reuse this.template.left/right for this check. Template elements
2340
- // do not return innerText or textContent, which makes the following innerHTML/innerText
2341
- // check useless.
2342
- ReflectApply$LWS$1(DocumentFragmentProtoAppend$LWS, rootDocumentDetachedFragment$LWS, [rootDocumentDetachedContainer$LWS]);
2343
- ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedContainer$LWS, [normalizedInput$LWS]);
2344
- // This MUST BE CHECKED AFTER IT IS RENDERED. The nature of these attacks requires
2345
- // the actual source to be set to the innerHTML to allow the browser to render
2346
- const innerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedContainer$LWS, []);
2347
- const innerText$LWS = ReflectApply$LWS$1(HTMLElementProtoInnerTextGetter$LWS, rootDocumentDetachedContainer$LWS, []);
2348
- ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
2384
+ // The input contains the word "script"; confirm it is actually markup by
2385
+ // rendering it on the shared detached container and comparing the parsed
2386
+ // innerHTML against the visible innerText. IMPORTANT: We CANNOT reuse
2387
+ // this._templates.left/right here — template elements return neither
2388
+ // innerText nor textContent, which would make the comparison useless. The
2389
+ // values MUST be read after rendering: the browser has to parse the source
2390
+ // for the hidden-script shape to surface.
2391
+ const {
2392
+ innerHTML: innerHTML$LWS,
2393
+ innerText: innerText$LWS
2394
+ } = htmlParserRoundTrip$LWS(normalizedInput$LWS);
2349
2395
  // If innerHTML contains "script", but innerText does not, then the string
2350
2396
  // was hiding a script element through some kind of obfuscation, and is unsecure.
2351
2397
  let checkableInnerText$LWS = innerText$LWS;
@@ -2357,6 +2403,41 @@
2357
2403
  }
2358
2404
  return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableInnerText$LWS, 'script');
2359
2405
  };
2406
+ // Detect a <script> that the HTML parser hides inside a raw-text / RCDATA
2407
+ // element (textarea, title, style, xmp, ...) but the XML parser exposes as
2408
+ // a live element. XMLDocument-owned elements are parsed with the XML parser,
2409
+ // which has NO raw-text elements: <textarea><script>...</script></textarea>
2410
+ // is inert escaped text under HTML, but a live, clonable HTMLScriptElement
2411
+ // under XML. cloneNode + adoption into the HTML document then promotes it to
2412
+ // an executing script (W-23486666).
2413
+ //
2414
+ // isIframeSrcdocScriptAttack cannot see this: it renders through the HTML
2415
+ // parser, where the swallowed <script> becomes `&lt;script&gt;` text and no
2416
+ // live tag survives, so its `hasTag(innerHTML, 'script')` clause is false.
2417
+ // We instead flag the HTML-vs-XML divergence directly: the source text
2418
+ // contains a <script> tag, yet an HTML round-trip does NOT preserve it as a
2419
+ // live <script>. A bare or foster-parented <script> survives the round-trip
2420
+ // (and is already rejected by isIframeSrcdocScriptAttack); only one absorbed
2421
+ // into raw text disappears — the XML-only exploit. Intended for the
2422
+ // XMLDocument-owned branch of the HTML-injection sinks; HTML-owned elements
2423
+ // genuinely treat that content as inert text and must not reach this check.
2424
+ // eslint-disable-next-line class-methods-use-this
2425
+ this.isXMLScriptInRawTextElementAttack = input$LWS => {
2426
+ const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
2427
+ // No <script> in the source text: nothing an XML parser could make live.
2428
+ if (!hasTag$LWS(normalizedInput$LWS, 'script')) {
2429
+ return false;
2430
+ }
2431
+ // Round-trip through the HTML parser (the same shared detached container
2432
+ // isIframeSrcdocScriptAttack uses). If the <script> survives as a live tag
2433
+ // it is caught by isIframeSrcdocScriptAttack; if it vanished, the HTML
2434
+ // parser absorbed it into a raw-text / RCDATA element where the XML parser
2435
+ // would not.
2436
+ const {
2437
+ innerHTML: innerHTML$LWS
2438
+ } = htmlParserRoundTrip$LWS(normalizedInput$LWS);
2439
+ return !hasTag$LWS(innerHTML$LWS, 'script');
2440
+ };
2360
2441
  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, []);
2361
2442
  // Detects whether `node` belongs to a document that an attacker
2362
2443
  // could have populated with content bypassing LWS distortions.
@@ -2447,6 +2528,25 @@
2447
2528
  }
2448
2529
  return false;
2449
2530
  }
2531
+ // Render `normalizedInput` once through the HTML parser on the shared detached
2532
+ // container and return both its serialized innerHTML and its rendered innerText.
2533
+ // isIframeSrcdocScriptAttack (hidden-script: innerHTML has a script, innerText
2534
+ // does not) and isXMLScriptInRawTextElementAttack (HTML-vs-XML divergence: source
2535
+ // has a script, the round-tripped innerHTML does not) both derive their answer
2536
+ // from this single parse, so they share one setter invocation instead of two.
2537
+ // innerText is '' when the engine lacks the getter (jsdom); the only consumer of
2538
+ // innerText already short-circuits before reaching here in that case.
2539
+ function htmlParserRoundTrip$LWS(normalizedInput$LWS) {
2540
+ ReflectApply$LWS$1(DocumentFragmentProtoAppend$LWS, rootDocumentDetachedFragment$LWS, [rootDocumentDetachedContainer$LWS]);
2541
+ ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedContainer$LWS, [normalizedInput$LWS]);
2542
+ const innerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedContainer$LWS, []);
2543
+ const innerText$LWS = HTMLElementProtoInnerTextGetter$LWS ? ReflectApply$LWS$1(HTMLElementProtoInnerTextGetter$LWS, rootDocumentDetachedContainer$LWS, []) : '';
2544
+ ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
2545
+ return {
2546
+ innerHTML: innerHTML$LWS,
2547
+ innerText: innerText$LWS
2548
+ };
2549
+ }
2450
2550
  function hasTag$LWS(input$LWS, tag$LWS) {
2451
2551
  // Input is already lowercased and invisible chars stripped by caller
2452
2552
  const checkableInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, input$LWS, [/\s+/g, ' ']);
@@ -2833,7 +2933,7 @@
2833
2933
  const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
2834
2934
  const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
2835
2935
  ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
2836
- /*! version: 0.29.0 */
2936
+ /*! version: 0.29.1 */
2837
2937
 
2838
2938
  /*!
2839
2939
  * Copyright (C) 2019 salesforce.com, inc.
@@ -3049,7 +3149,7 @@
3049
3149
  }
3050
3150
  return sanitized$LWS;
3051
3151
  }
3052
- /*! version: 0.29.0 */
3152
+ /*! version: 0.29.1 */
3053
3153
 
3054
3154
  /*!
3055
3155
  * Copyright (C) 2023 salesforce.com, inc.
@@ -3125,7 +3225,7 @@
3125
3225
  // swallow
3126
3226
  }
3127
3227
  const trusted = createPolicy('trusted', policyOptions);
3128
- /*! version: 0.29.0 */
3228
+ /*! version: 0.29.1 */
3129
3229
 
3130
3230
  /*!
3131
3231
  * Copyright (C) 2019 salesforce.com, inc.
@@ -3434,7 +3534,7 @@
3434
3534
  }
3435
3535
  return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
3436
3536
  }
3437
- /*! version: 0.29.0 */
3537
+ /*! version: 0.29.1 */
3438
3538
 
3439
3539
  /*!
3440
3540
  * Copyright (C) 2023 salesforce.com, inc.
@@ -3648,13 +3748,39 @@
3648
3748
  // signed value and we are ok or we don't and the browser throws an error. We
3649
3749
  // want our 404 URL to be set and trigger the event handlers, hence we have to sign.
3650
3750
  setScriptURL$LWS('blob:http://localhost/not-found');
3651
- // This error event handler will get triggered after we set our 404 blob URL.
3652
- const errorEventHandler$LWS = () => {
3653
- // Similar to our wrappedEvaluator, we leave no traces.
3654
- setScriptURL$LWS(cachedURL$LWS);
3655
- ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, targetElement$LWS, ['error', errorEventHandler$LWS]);
3656
- };
3657
- ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, targetElement$LWS, ['error', errorEventHandler$LWS]);
3751
+ // changesSince.266 (W-23596014, Bug Bounty / H1): on the reject path we
3752
+ // no longer restore the developer's raw url to the NATIVE src content
3753
+ // attribute. That restoration was purely cosmetic ("leave no traces"),
3754
+ // but the browser's native "prepare a script element" algorithm reads
3755
+ // the src *content attribute* directly — it never routes through any
3756
+ // JS-level getter/setter, so no LWS distortion observes it. Unlike the
3757
+ // onFulfill path (which restores the raw url only AFTER the browser has
3758
+ // already run our injected safe blob, i.e. the script has "already
3759
+ // started" and can never re-run), a rejected fetch means the script was
3760
+ // NEVER sandbox-evaluated. Restoring a raw, never-evaluated url is thus
3761
+ // a native-execution primitive: an attacker aborts the first async
3762
+ // fetch with a second `.src=` write, then dispatches a synthetic `error`
3763
+ // while the script is still disconnected — firing this handler, writing
3764
+ // the raw attacker url into the native attribute — and appends the
3765
+ // element, so the browser's own loader fetches and executes it in the
3766
+ // MAIN realm with an undistorted document.cookie. (The sibling
3767
+ // SVGScriptElement/href path shares this code and the same fix.) The 404
3768
+ // placeholder set above still fires genuine developer `error` handlers;
3769
+ // only the raw-url restoration is dropped, since cosmetic DOM parity is
3770
+ // never worth an executable raw url.
3771
+ //
3772
+ // Gated OFF so a mechanical gate-cleanup removes the hole, not the
3773
+ // guard: DELETE THIS ENTIRE `if (!isGaterEnabledFeature(...))` BLOCK
3774
+ // when changesSince.266 graduates.
3775
+ if (!isGaterEnabledFeature$LWS('changesSince.266')) {
3776
+ // This error event handler will get triggered after we set our 404 blob URL.
3777
+ const errorEventHandler$LWS = () => {
3778
+ // Similar to our wrappedEvaluator, we leave no traces.
3779
+ setScriptURL$LWS(cachedURL$LWS);
3780
+ ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, targetElement$LWS, ['error', errorEventHandler$LWS]);
3781
+ };
3782
+ ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, targetElement$LWS, ['error', errorEventHandler$LWS]);
3783
+ }
3658
3784
  };
3659
3785
  ReflectApply$LWS$1(PromiseProtoThen$LWS, asyncRequest$LWS, [onFulfill$LWS, onReject$LWS]);
3660
3786
  return '';
@@ -3685,7 +3811,7 @@
3685
3811
  ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
3686
3812
  };
3687
3813
  }
3688
- /*! version: 0.29.0 */
3814
+ /*! version: 0.29.1 */
3689
3815
 
3690
3816
  /*!
3691
3817
  * Copyright (C) 2019 salesforce.com, inc.
@@ -4448,6 +4574,24 @@
4448
4574
  const DataTransferProtoBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
4449
4575
  const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
4450
4576
  const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4577
+ const blockedTagInfoByCtor$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
4578
+ // Associate a blocked attribute on `Ctor` with the HTML tag name a foreign
4579
+ // generic node would carry when it specializes into `Ctor`'s interface on HTML
4580
+ // reparse. Called from the block-list wiring for the interfaces that have a
4581
+ // single canonical tag (iframe, embed, script). Idempotent across sandboxes.
4582
+ function registerBlockedAttributeTagName$LWS(Ctor$LWS, tagName$LWS, attributeName$LWS) {
4583
+ const loweredTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
4584
+ const loweredAttributeName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attributeName$LWS, []);
4585
+ let info$LWS = blockedTagInfoByCtor$LWS.get(Ctor$LWS);
4586
+ if (info$LWS === undefined) {
4587
+ info$LWS = {
4588
+ tagName: loweredTagName$LWS,
4589
+ attributeNames: toSafeSet$LWS(new SetCtor$LWS$1())
4590
+ };
4591
+ blockedTagInfoByCtor$LWS.set(Ctor$LWS, info$LWS);
4592
+ }
4593
+ info$LWS.attributeNames.add(loweredAttributeName$LWS);
4594
+ }
4451
4595
  // =============================================================================
4452
4596
  // Prototype-independent, realm-generic element-kind matching
4453
4597
  // (W-23729707 + W-23768065)
@@ -4490,7 +4634,7 @@
4490
4634
  // Gated changesSince.266; when the gate is off the fallback is inert and
4491
4635
  // selection is byte-identical to the pre-fix instanceof-only behavior.
4492
4636
  // =============================================================================
4493
- function elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS) {
4637
+ function elementMatchesCtor$LWS(element$LWS, Ctor$LWS, attributeName$LWS, allowBrandCheck$LWS) {
4494
4638
  // Fast path (all gates): an intact prototype chain answers definitively and
4495
4639
  // matches the pre-fix behavior exactly.
4496
4640
  if (element$LWS instanceof Ctor$LWS) {
@@ -4508,7 +4652,27 @@
4508
4652
  if (!allowBrandCheck$LWS || !isGaterEnabledFeature$LWS('changesSince.266')) {
4509
4653
  return false;
4510
4654
  }
4511
- return isElementOfInterface$LWS(element$LWS, Ctor$LWS);
4655
+ if (isElementOfInterface$LWS(element$LWS, Ctor$LWS)) {
4656
+ return true;
4657
+ }
4658
+ // Tag-name fallback (W-23590867): `element` is not (yet) an instance of
4659
+ // Ctor's interface and carries none of its slots, but if its tag name
4660
+ // matches Ctor's blocked HTML tag name — for one of the attributes recorded
4661
+ // as blocked on that tag — an HTML reparse would specialize it into the real
4662
+ // interface, inheriting the attribute value set on the generic node. Match
4663
+ // by tag name so the block fires before that promotion can occur.
4664
+ const blockedTagInfo$LWS = blockedTagInfoByCtor$LWS.get(Ctor$LWS);
4665
+ if (blockedTagInfo$LWS === undefined || !blockedTagInfo$LWS.attributeNames.has(attributeName$LWS)) {
4666
+ return false;
4667
+ }
4668
+ let tagName$LWS;
4669
+ try {
4670
+ tagName$LWS = ReflectApply$LWS$1(ElementProtoTagNameGetter$LWS, element$LWS, []);
4671
+ } catch (_unused2$LWS) {
4672
+ // Not a genuine Element (e.g. a forged receiver) — no reparse risk.
4673
+ return false;
4674
+ }
4675
+ return ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []) === blockedTagInfo$LWS.tagName;
4512
4676
  }
4513
4677
  function finalizeAttributeSetterDistortions$LWS(record$LWS) {
4514
4678
  const attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS);
@@ -4549,7 +4713,8 @@
4549
4713
  if (attributeDistortionRegistry$LWS === undefined) {
4550
4714
  return undefined;
4551
4715
  }
4552
- const elementCtorMapByAttributeNamespaceRegistry$LWS = attributeDistortionRegistry$LWS[ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attrName$LWS, [])];
4716
+ const loweredAttrName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attrName$LWS, []);
4717
+ const elementCtorMapByAttributeNamespaceRegistry$LWS = attributeDistortionRegistry$LWS[loweredAttrName$LWS];
4553
4718
  if (elementCtorMapByAttributeNamespaceRegistry$LWS === undefined) {
4554
4719
  return undefined;
4555
4720
  }
@@ -4567,8 +4732,10 @@
4567
4732
  // elementMatchesCtor uses instanceof as the fast path and, when
4568
4733
  // allowBrandCheck is set (same-document element, changesSince.266), a
4569
4734
  // tamper-resistant brand-check fallback so a repointed [[Prototype]]
4570
- // cannot deselect this distortion.
4571
- if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS)) {
4735
+ // cannot deselect this distortion, plus a tag-name fallback so a foreign
4736
+ // generic node that would reparse into this interface (W-23590867) is
4737
+ // still matched for its blocked attributes.
4738
+ if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, loweredAttrName$LWS, allowBrandCheck$LWS)) {
4572
4739
  return distortion$LWS;
4573
4740
  }
4574
4741
  }
@@ -4637,6 +4804,23 @@
4637
4804
  function normalizeNamespace$LWS(ns$LWS) {
4638
4805
  return ns$LWS === null || ns$LWS === undefined || ns$LWS === '' ? NAMESPACE_DEFAULT$LWS : ns$LWS;
4639
4806
  }
4807
+ // W-23486664: An Attr minted via createAttributeNS carries a *qualified* name
4808
+ // (e.g. 'foo:href') whose localName the browser still resolves as 'href'. The
4809
+ // attribute-distortion registry keys on the canonical name, so a qualified
4810
+ // name has to be normalized before lookup or getAttributeSetterDistortion
4811
+ // misses the registered 'href' entry and the raw value reaches the native
4812
+ // slot unsanitized. The setAttribute* family already normalizes inline; this
4813
+ // helper gives the remaining Attr-value sinks (Attr.value, Node.nodeValue,
4814
+ // Node.textContent, NamedNodeMap.setNamedItem) the same normalization. It is
4815
+ // deliberately scoped to those sinks rather than folded into
4816
+ // getAttributeSetterDistortion because that function is also reached by
4817
+ // toggleAttribute and the SVG attributeName distortions, which must keep
4818
+ // their raw-name behavior. Gated on the active train so pre-266 sandboxes
4819
+ // preserve their existing lookup behavior; the read side already normalizes
4820
+ // unconditionally inside getAttributeGetterDistortion.
4821
+ function normalizeAttributeName$LWS(attrName$LWS) {
4822
+ return isGaterEnabledFeature$LWS('changesSince.266') ? normalizeNamespacedAttributeName$LWS(attrName$LWS) : attrName$LWS;
4823
+ }
4640
4824
  function registerAttributeSetterDistortion$LWS(record$LWS, ElementCtor$LWS, attributeName$LWS, attributeNamespace$LWS, distortion$LWS) {
4641
4825
  let attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS);
4642
4826
  if (attributeFactories$LWS === undefined) {
@@ -4698,7 +4882,8 @@
4698
4882
  if (registry$LWS === undefined) {
4699
4883
  return undefined;
4700
4884
  }
4701
- const byNamespace$LWS = registry$LWS[ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attrName$LWS, [])];
4885
+ const loweredAttrName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attrName$LWS, []);
4886
+ const byNamespace$LWS = registry$LWS[loweredAttrName$LWS];
4702
4887
  if (byNamespace$LWS === undefined) {
4703
4888
  return undefined;
4704
4889
  }
@@ -4713,9 +4898,11 @@
4713
4898
  } of it$LWS) {
4714
4899
  // Prototype-independent selection, mirroring the setter registry: a
4715
4900
  // repointed [[Prototype]] must not deselect a read-side (e.g. nonce)
4716
- // getter distortion either. allowBrandCheck is scoped to same-document
4901
+ // getter distortion either, and a foreign generic node whose tag name
4902
+ // would reparse into this interface (W-23590867) is matched for its
4903
+ // blocked attributes. allowBrandCheck is scoped to same-document
4717
4904
  // elements by the caller. See elementMatchesCtor.
4718
- if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS)) {
4905
+ if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, loweredAttrName$LWS, allowBrandCheck$LWS)) {
4719
4906
  return getter$LWS;
4720
4907
  }
4721
4908
  }
@@ -4826,20 +5013,35 @@
4826
5013
  const originalAttrValueSetter$LWS = ObjectLookupOwnSetter$LWS(Attr$LWS.prototype, 'value');
4827
5014
  return function distortionAttrValueSetter$LWS(record$LWS) {
4828
5015
  return [originalAttrValueSetter$LWS, function value$LWS(val$LWS) {
5016
+ // W-23596015: coerce `val` to a string EXACTLY ONCE, up front —
5017
+ // before reading `ownerElement` — to close a reentrant TOCTOU.
5018
+ // A `{ toString() {...} }` argument would otherwise reach the
5019
+ // native setter unconverted, and native WebIDL DOMString
5020
+ // coercion runs the attacker's `toString()` AFTER LWS has
5021
+ // committed to its routing decision. That reentrant call can
5022
+ // attach this (until now detached) Attr to a <script> via
5023
+ // `setAttributeNode`, so when the native setter finally writes
5024
+ // the real URL the Attr is connected — yet LWS is never
5025
+ // re-entered, and the URL lands through a raw native write that
5026
+ // skips the script-`src` distortion. Coercing first makes any
5027
+ // such reentrant attach visible to the `ownerElement` read
5028
+ // below, so the resolved string is routed through the
5029
+ // registered distortion instead of a raw native write.
5030
+ const coercedVal$LWS = isGaterEnabledFeature$LWS('changesSince.266') ? toSafeStringValue$LWS(val$LWS) : val$LWS;
4829
5031
  const ownerElement$LWS = ReflectApply$LWS$1(AttrProtoOwnerElementGetter$LWS, this, []);
4830
5032
  // istanbul ignore else: needs default platform behavior test
4831
5033
  if (ownerElement$LWS) {
4832
- const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []);
5034
+ const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []));
4833
5035
  const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, this, []);
4834
5036
  const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
4835
5037
  const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, ownerElement$LWS, attrName$LWS, normalizedNamespace$LWS);
4836
5038
  // istanbul ignore if: coverage missing, needs investigation
4837
5039
  if (distortion$LWS) {
4838
- ReflectApply$LWS$1(distortion$LWS, ownerElement$LWS, [val$LWS]);
5040
+ ReflectApply$LWS$1(distortion$LWS, ownerElement$LWS, [coercedVal$LWS]);
4839
5041
  return;
4840
5042
  }
4841
5043
  }
4842
- ReflectApply$LWS$1(originalAttrValueSetter$LWS, this, [val$LWS]);
5044
+ ReflectApply$LWS$1(originalAttrValueSetter$LWS, this, [coercedVal$LWS]);
4843
5045
  }];
4844
5046
  };
4845
5047
  }
@@ -6282,7 +6484,7 @@
6282
6484
  const element$LWS = namedNodeMapToElementCache$LWS.get(nodeNameMap$LWS);
6283
6485
  // istanbul ignore else: nothing to do if there's no element
6284
6486
  if (element$LWS) {
6285
- const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, attr$LWS, []);
6487
+ const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, attr$LWS, []));
6286
6488
  const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, attr$LWS, []);
6287
6489
  const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
6288
6490
  const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, element$LWS, attrName$LWS, normalizedNamespace$LWS);
@@ -6618,7 +6820,8 @@
6618
6820
  }
6619
6821
  const {
6620
6822
  isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$7$LWS,
6621
- isSharedElement: isSharedElement$y$LWS
6823
+ isSharedElement: isSharedElement$y$LWS,
6824
+ isXMLScriptInRawTextElementAttack: isXMLScriptInRawTextElementAttack$1$LWS
6622
6825
  } = rootValidator$LWS;
6623
6826
  function initDistortionElementInnerHTMLSetter$LWS({
6624
6827
  document: document$LWS,
@@ -6672,7 +6875,13 @@
6672
6875
  // malicious markup on a later engine coercion (see toSafeStringValue() docs).
6673
6876
  value$LWS = toSafeStringValue$LWS(value$LWS);
6674
6877
  }
6675
- if (isIframeSrcdocScriptAttack$7$LWS(value$LWS)) {
6878
+ // isOwnerXMLDocument && !isSVGElement is exactly the permissive branch above: it
6879
+ // skips createHTML and is parsed by the XML parser, which has no raw-text / RCDATA
6880
+ // elements. A <script> nested in <textarea>/<title>/etc. is inert text under the
6881
+ // HTML parser (so isIframeSrcdocScriptAttack alone misses it) but a live, clonable
6882
+ // script under XML — cloneNode + adoption into the HTML document then executes it
6883
+ // (W-23486666).
6884
+ if (isIframeSrcdocScriptAttack$7$LWS(value$LWS) || isOwnerXMLDocument$LWS && !isSVGElement$LWS && isGaterEnabledFeature$LWS('changesSince.266') && isXMLScriptInRawTextElementAttack$1$LWS(value$LWS)) {
6676
6885
  throw new LockerSecurityError$LWS(`Cannot set 'innerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
6677
6886
  }
6678
6887
  ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [value$LWS]);
@@ -7260,7 +7469,8 @@
7260
7469
  }
7261
7470
  const {
7262
7471
  isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$3$LWS,
7263
- isSharedElement: isSharedElement$p$LWS
7472
+ isSharedElement: isSharedElement$p$LWS,
7473
+ isXMLScriptInRawTextElementAttack: isXMLScriptInRawTextElementAttack$LWS
7264
7474
  } = rootValidator$LWS;
7265
7475
  function initDistortionElementSetHTMLUnsafe$LWS({
7266
7476
  document: document$LWS,
@@ -7320,7 +7530,13 @@
7320
7530
  const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
7321
7531
  normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
7322
7532
  }
7323
- if (isIframeSrcdocScriptAttack$3$LWS(normalizedValue$LWS)) {
7533
+ // isOwnerXMLDocument && !isSVGElement is exactly the permissive branch above: it
7534
+ // skips createHTML and is parsed by the XML parser, which has no raw-text / RCDATA
7535
+ // elements. A <script> nested in <textarea>/<title>/etc. is inert text under the
7536
+ // HTML parser (so isIframeSrcdocScriptAttack alone misses it) but a live, clonable
7537
+ // script under XML — cloneNode + adoption into the HTML document then executes it
7538
+ // (W-23486666).
7539
+ if (isIframeSrcdocScriptAttack$3$LWS(normalizedValue$LWS) || isOwnerXMLDocument$LWS && !isSVGElement$LWS && isGaterEnabledFeature$LWS('changesSince.266') && isXMLScriptInRawTextElementAttack$LWS(normalizedValue$LWS)) {
7324
7540
  throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
7325
7541
  }
7326
7542
  ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
@@ -7569,7 +7785,7 @@
7569
7785
  let frameElement$LWS;
7570
7786
  try {
7571
7787
  frameElement$LWS = ReflectApply$LWS$1(WindowFrameElementGetter$LWS, globalObject$LWS, []);
7572
- } catch (_unused2$LWS) {
7788
+ } catch (_unused3$LWS) {
7573
7789
  // Cross-origin / non-window realm: not our target.
7574
7790
  return undefined;
7575
7791
  }
@@ -8114,6 +8330,335 @@
8114
8330
  return [originalActionSetter$LWS, originalActionSetter$LWS];
8115
8331
  };
8116
8332
  }
8333
+
8334
+ // Per-frame bookkeeping for the HTMLFrameElement.src async pre-flight
8335
+ const pendingURLs$1$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8336
+ const inflightControllers$1$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
8337
+ // Frames whose pre-flight detected an attack pattern in the fetched
8338
+ // response body. The setter checks this set at entry and throws
8339
+ // synchronously on any subsequent write attempt, so the violation is
8340
+ // observable from sandboxed code on the *next* sync touchpoint after
8341
+ // the async pre-flight resolved hostile.
8342
+ const poisonedFrames$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
8343
+ // Cross-frame URL rejection cache. When a pre-flight detects hostile,
8344
+ // the URL's pathname is added here. Any subsequent frame.src assignment
8345
+ // to a URL with the same pathname (regardless of the frame instance,
8346
+ // query string, or fragment) throws synchronously without re-fetching.
8347
+ // Pathname-keyed (not full URL) so query-string rotation can't evade
8348
+ // the cache.
8349
+ //
8350
+ // Like the iframe pipeline's equivalent cache, this Set is module-scoped
8351
+ // (shared across every sandbox) and entries are never evicted for the
8352
+ // process lifetime. The accepted tradeoff, shared with the iframe
8353
+ // pipeline: a validator false positive would keep every sandbox
8354
+ // rejecting that pathname until the page reloads. This is deemed
8355
+ // acceptable because a resource classified as carrying an attack pattern
8356
+ // is not expected to become benign within a session, and the fail-closed
8357
+ // direction favors security over availability.
8358
+ const rejectedPathnames$1$LWS = toSafeSet$LWS(new SetCtor$LWS$1());
8359
+ function getPendingURL$1$LWS(frame$LWS) {
8360
+ return pendingURLs$1$LWS.get(frame$LWS);
8361
+ }
8362
+ function setPendingURL$1$LWS(frame$LWS, url$LWS) {
8363
+ pendingURLs$1$LWS.set(frame$LWS, url$LWS);
8364
+ }
8365
+ function clearPendingURL$1$LWS(frame$LWS) {
8366
+ pendingURLs$1$LWS.delete(frame$LWS);
8367
+ }
8368
+ function abortInflightPreflight$1$LWS(frame$LWS) {
8369
+ const controller$LWS = inflightControllers$1$LWS.get(frame$LWS);
8370
+ if (controller$LWS !== undefined) {
8371
+ ReflectApply$LWS$1(AbortControllerProtoAbort$LWS, controller$LWS, []);
8372
+ inflightControllers$1$LWS.delete(frame$LWS);
8373
+ }
8374
+ }
8375
+ function trackInflightPreflight$1$LWS(frame$LWS, controller$LWS) {
8376
+ inflightControllers$1$LWS.set(frame$LWS, controller$LWS);
8377
+ }
8378
+ function clearInflightPreflight$1$LWS(frame$LWS) {
8379
+ inflightControllers$1$LWS.delete(frame$LWS);
8380
+ }
8381
+ // Compare-and-delete: drop the tracked controller only when it is still
8382
+ // the one this request installed. A superseded request's fetch settles
8383
+ // (or rejects from its own abort) AFTER a replacement request has already
8384
+ // stored its controller here; an unconditional delete from that stale
8385
+ // handler would evict the replacement's controller, leaving the newer
8386
+ // pre-flight untracked. An untracked pre-flight can no longer be aborted
8387
+ // by a subsequent assignment, so it could commit a superseded (stale)
8388
+ // URL. Deleting only on identity match keeps every clear scoped to the
8389
+ // request that owns it.
8390
+ function clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS) {
8391
+ if (inflightControllers$1$LWS.get(frame$LWS) === controller$LWS) {
8392
+ inflightControllers$1$LWS.delete(frame$LWS);
8393
+ }
8394
+ }
8395
+ function poisonFrame$LWS(frame$LWS) {
8396
+ poisonedFrames$LWS.add(frame$LWS);
8397
+ }
8398
+ function isPoisonedFrame$LWS(frame$LWS) {
8399
+ return poisonedFrames$LWS.has(frame$LWS);
8400
+ }
8401
+ function rejectPathname$1$LWS(pathname$LWS) {
8402
+ rejectedPathnames$1$LWS.add(pathname$LWS);
8403
+ }
8404
+ function isRejectedPathname$1$LWS(pathname$LWS) {
8405
+ return rejectedPathnames$1$LWS.has(pathname$LWS);
8406
+ }
8407
+
8408
+ // HTMLFrameElement.src getter distortion. Returns the pending URL
8409
+ // recorded by the src setter's same-origin pre-flight pipeline (see
8410
+ // src-setter.ts) when one exists, otherwise falls through to the native
8411
+ // getter.
8412
+ //
8413
+ // The same getter is registered into the read-side attribute getter
8414
+ // registry under (HTMLFrameElement, 'src'), so frame.getAttribute('src'),
8415
+ // frame.getAttributeNS, frame.attributes['src'].value, etc. all surface
8416
+ // the pending URL during the pre-flight inspection window.
8417
+ function initDistortionHTMLFrameElementSrcGetter$LWS({
8418
+ globalObject: {
8419
+ HTMLFrameElement: HTMLFrameElement$LWS
8420
+ }
8421
+ }) {
8422
+ const originalSrcGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLFrameElement$LWS.prototype, 'src');
8423
+ return function distortionHTMLFrameElementSrcGetter$LWS(record$LWS) {
8424
+ function src$LWS() {
8425
+ if (isGaterEnabledFeature$LWS('changesSince.266')) {
8426
+ const pending$LWS = getPendingURL$1$LWS(this);
8427
+ if (pending$LWS !== undefined) {
8428
+ return pending$LWS;
8429
+ }
8430
+ }
8431
+ return ReflectApply$LWS$1(originalSrcGetter$LWS, this, []);
8432
+ }
8433
+ // The pending-URL pipeline that backs this getter is gate-266
8434
+ // work; only register into the read-side attribute getter registry
8435
+ // when the gate is on, otherwise ungated sandboxes pay the
8436
+ // registry-consultation cost on every frame.src read with no
8437
+ // behavior change to show for it.
8438
+ if (isGaterEnabledFeature$LWS('changesSince.266')) {
8439
+ registerAttributeGetterDistortion$LWS(record$LWS, HTMLFrameElement$LWS, 'src', NAMESPACE_DEFAULT$LWS, src$LWS);
8440
+ }
8441
+ return [originalSrcGetter$LWS, src$LWS];
8442
+ };
8443
+ }
8444
+
8445
+ // HTMLFrameElement.src coverage (W-23475830). Before this distortion,
8446
+ const {
8447
+ isIframeSrcdocAttack: isIframeSrcdocAttack$1$LWS,
8448
+ isXMLEntityAttack: isXMLEntityAttack$1$LWS,
8449
+ isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$1$LWS
8450
+ } = rootValidator$LWS;
8451
+ const ABOUT_BLANK_TOKEN$1$LWS = 'about:blank';
8452
+ function initDistortionHTMLFrameElementSrcSetter$LWS({
8453
+ globalObject: {
8454
+ HTMLFrameElement: HTMLFrameElement$LWS,
8455
+ fetch: originalFetch$LWS
8456
+ }
8457
+ }) {
8458
+ const originalSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLFrameElement$LWS.prototype, 'src');
8459
+ return function distortionHTMLFrameElementSrcSetter$LWS(record$LWS) {
8460
+ function src$LWS(value$LWS) {
8461
+ // Brand-new distortion: the entire distorted behavior is
8462
+ // gated on the active train. When the gate is off, fall
8463
+ // through to the pristine native setter so ungated orgs see
8464
+ // the pre-existing (native) behavior.
8465
+ if (!isGaterEnabledFeature$LWS('changesSince.266')) {
8466
+ ReflectApply$LWS$1(originalSrcSetter$LWS, this, [value$LWS]);
8467
+ return;
8468
+ }
8469
+ // If a prior async pre-flight on this frame detected an
8470
+ // attack pattern in the fetched body, the frame is
8471
+ // permanently poisoned: any subsequent synchronous write
8472
+ // throws, so the security violation surfaces at the call
8473
+ // site of the FOLLOWING `frame.src = ...` (or
8474
+ // setAttribute('src', ...)) even though we cannot
8475
+ // synchronously propagate the original hostile detection
8476
+ // back to its triggering setter call.
8477
+ if (isPoisonedFrame$LWS(this)) {
8478
+ throw new LockerSecurityError$LWS('HTMLFrameElement is poisoned: a prior src assignment fetched a body containing an attack pattern. The frame cannot be reused.');
8479
+ }
8480
+ const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
8481
+ // This must run on the raw value before sanitization, because
8482
+ // sanitization can remove the exploit pattern.
8483
+ if (isAttemptingToExploitURL$LWS(normalizedSrcValue$LWS)) {
8484
+ throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(normalizedSrcValue$LWS)}"`);
8485
+ }
8486
+ // Sanitize non-empty values for assignment; leave the empty
8487
+ // string as-is.
8488
+ const urlString$LWS = normalizedSrcValue$LWS !== '' ? sanitizeURLForElement$LWS(normalizedSrcValue$LWS) : '';
8489
+ // Scheme allowlist. This is the gate that closes the reported
8490
+ // vector: `blob:` and `javascript:` are not valid schemes, so
8491
+ // a self-closing-root XML blob (or a javascript: URL) is
8492
+ // refused here before it can ever load.
8493
+ if (urlString$LWS && !isValidURLScheme$LWS(urlString$LWS)) {
8494
+ throw new LockerSecurityError$LWS('HTMLFrameElement.src supports http://, https:// schemes, relative urls and about:blank.');
8495
+ }
8496
+ const parsedURL$LWS = parseURL$LWS(urlString$LWS);
8497
+ if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
8498
+ const {
8499
+ normalizedURL: normalizedURL$LWS
8500
+ } = parsedURL$LWS;
8501
+ throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
8502
+ }
8503
+ // Same-origin URLs go through an async pre-flight that fetches
8504
+ // the resource and runs its body through the rootValidator
8505
+ // attack-pattern checks (XML entity smuggling, iframe+srcdoc
8506
+ // combos, and XML-namespaced script payloads). Same-origin
8507
+ // guarantees the pre-flight body is byte-identical to what the
8508
+ // frame load would receive (attacker-controllable content
8509
+ // surfaces in this threat model are deployable static
8510
+ // resources, which serve identical bytes for every request).
8511
+ // Cross-origin URLs proceed through the synchronous path
8512
+ // unchanged because the JS layer cannot inspect cross-origin
8513
+ // response bodies and SOP already contains the cross-origin
8514
+ // contentDocument.
8515
+ //
8516
+ // isSameOriginURL parses the URL and can throw on
8517
+ // pathological inputs. A parse failure means we cannot prove
8518
+ // the URL is same-origin, so we fall through to the
8519
+ // non-pre-flight write path (the same path a cross-origin
8520
+ // URL takes) rather than surfacing a raw parser error to
8521
+ // sandboxed code. Mirrors the try/catch guard the iframe
8522
+ // pipeline puts around its own isSameOriginURL call.
8523
+ let isSameOrigin$LWS = false;
8524
+ try {
8525
+ isSameOrigin$LWS = isSameOriginURL$LWS(urlString$LWS);
8526
+ } catch (_unused4$LWS) {
8527
+ isSameOrigin$LWS = false;
8528
+ }
8529
+ if (urlString$LWS !== '' && urlString$LWS !== ABOUT_BLANK_TOKEN$1$LWS && isSameOrigin$LWS) {
8530
+ // Cross-frame rejection cache: if any prior pre-flight
8531
+ // detected an attack pattern at this URL's pathname,
8532
+ // refuse synchronously without re-fetching. Pathname-keyed
8533
+ // so query-string rotation can't evade it.
8534
+ if (isRejectedPathname$1$LWS(parsedURL$LWS.pathname)) {
8535
+ throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(urlString$LWS)}": pathname previously rejected as containing an attack pattern.`);
8536
+ }
8537
+ preflightSameOriginAndCommit$LWS(this, urlString$LWS, parsedURL$LWS.pathname);
8538
+ return;
8539
+ }
8540
+ // Any non-pre-flight write (cross-origin, empty, about:blank)
8541
+ // supersedes a pending pre-flight: abort it, clear pending
8542
+ // state, then write native.
8543
+ abortInflightPreflight$1$LWS(this);
8544
+ clearPendingURL$1$LWS(this);
8545
+ clearInflightPreflight$1$LWS(this);
8546
+ ReflectApply$LWS$1(originalSrcSetter$LWS, this, [urlString$LWS]);
8547
+ }
8548
+ // Same-origin async pre-flight. The setter stays synchronous from
8549
+ // sandboxed code's perspective: it returns after recording the
8550
+ // pending URL and kicking off the fetch. The native attribute is
8551
+ // NOT written until the pre-flight approves the body, so the
8552
+ // browser does not begin navigating until then. Read-after-write
8553
+ // surfaces (frame.src, getAttribute('src')) see the pending URL
8554
+ // during the inspection window via the src getter distortion +
8555
+ // read-side attribute getter registry.
8556
+ function preflightSameOriginAndCommit$LWS(frame$LWS, urlString$LWS, pathname$LWS) {
8557
+ // Re-assignment cancels any prior pre-flight in flight on this
8558
+ // frame and replaces it with the new URL.
8559
+ abortInflightPreflight$1$LWS(frame$LWS);
8560
+ setPendingURL$1$LWS(frame$LWS, urlString$LWS);
8561
+ const controller$LWS = new AbortControllerCtor$LWS();
8562
+ const signal$LWS = ReflectApply$LWS$1(AbortControllerProtoSignalGetter$LWS, controller$LWS, []);
8563
+ trackInflightPreflight$1$LWS(frame$LWS, controller$LWS);
8564
+ const isSupersededOrAborted$LWS = () => signal$LWS.aborted;
8565
+ const onSafe$LWS = () => {
8566
+ if (isSupersededOrAborted$LWS()) {
8567
+ return;
8568
+ }
8569
+ clearPendingURL$1$LWS(frame$LWS);
8570
+ clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
8571
+ ReflectApply$LWS$1(originalSrcSetter$LWS, frame$LWS, [urlString$LWS]);
8572
+ };
8573
+ const onHostile$LWS = () => {
8574
+ if (isSupersededOrAborted$LWS()) {
8575
+ return;
8576
+ }
8577
+ clearPendingURL$1$LWS(frame$LWS);
8578
+ clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
8579
+ // Native src is intentionally left unwritten; the frame
8580
+ // never navigates to the hostile URL. Mark it poisoned so
8581
+ // the next synchronous write throws, and add the pathname
8582
+ // to the cross-frame rejection cache so any future frame
8583
+ // whose src lands at the same pathname throws synchronously
8584
+ // without re-fetching.
8585
+ poisonFrame$LWS(frame$LWS);
8586
+ rejectPathname$1$LWS(pathname$LWS);
8587
+ };
8588
+ const onAborted$LWS = () => {
8589
+ // This handler runs for a request that was superseded, so
8590
+ // by the time it fires a replacement request has typically
8591
+ // already stored ITS controller. Clear on identity match
8592
+ // only: an unconditional delete here would evict the
8593
+ // replacement's controller, leaving the newer pre-flight
8594
+ // untracked (and therefore un-abortable by a later
8595
+ // assignment, which could then let a stale URL commit).
8596
+ clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
8597
+ };
8598
+ // Fail-closed handler for a pre-flight fetch that rejected
8599
+ // (network error, or — the security-critical case — a CSP
8600
+ // `connect-src` block). A same-origin `fetch` is governed by
8601
+ // `connect-src`, while a `<frame>` navigation is governed by
8602
+ // `frame-src` / `child-src`: a deployment can block the fetch
8603
+ // yet still permit the frame to navigate. Committing here would
8604
+ // hand the frame an UNVALIDATED same-origin body — the exact
8605
+ // escape this pipeline exists to close. Because the frame
8606
+ // setter never writes native `src` eagerly, failing closed is
8607
+ // simply "do not write": clear the pending/in-flight
8608
+ // bookkeeping and leave the frame un-navigated. We do NOT
8609
+ // poison — a transport failure is not proof of an attack
8610
+ // pattern, so a later assignment of the same URL may re-attempt
8611
+ // the pre-flight. (Deliberate divergence from the iframe
8612
+ // pipeline, which commits on fetch failure because it writes
8613
+ // native eagerly for detached iframes and cannot cleanly
8614
+ // withhold the write; `<frame>` never writes eagerly, so it
8615
+ // can.)
8616
+ const onUninspectable$LWS = () => {
8617
+ clearPendingURL$1$LWS(frame$LWS);
8618
+ clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
8619
+ };
8620
+ ReflectApply$LWS$1(originalFetch$LWS, undefined, [urlString$LWS, {
8621
+ __proto__: null,
8622
+ credentials: 'same-origin',
8623
+ signal: signal$LWS
8624
+ }])
8625
+ // Read the body regardless of HTTP status: a same-origin
8626
+ // 4xx/5xx whose error-page body carries a hostile pattern
8627
+ // must still poison the frame, because the browser would
8628
+ // render that error-page body into the frame too. (Only a
8629
+ // rejected fetch — network error, CSP `connect-src` block,
8630
+ // or abort — reaches .catch below; a non-abort rejection
8631
+ // fails closed there, leaving `src` unwritten rather than
8632
+ // committing an un-inspected body.)
8633
+ .then(response$LWS => response$LWS.text()).then(body$LWS => {
8634
+ if (isSupersededOrAborted$LWS()) {
8635
+ onAborted$LWS();
8636
+ return;
8637
+ }
8638
+ if (isIframeSrcdocAttack$1$LWS(body$LWS) || isXMLEntityAttack$1$LWS(body$LWS) || isXMLNamespacedScriptAttack$1$LWS(body$LWS)) {
8639
+ onHostile$LWS();
8640
+ } else {
8641
+ onSafe$LWS();
8642
+ }
8643
+ }).catch(() => {
8644
+ if (isSupersededOrAborted$LWS()) {
8645
+ onAborted$LWS();
8646
+ return;
8647
+ }
8648
+ // The pre-flight fetch rejected, so the body was never
8649
+ // inspected. Fail closed: leave native `src` unwritten
8650
+ // (see onUninspectable). We must NOT commit here — a CSP
8651
+ // `connect-src` block can reject the fetch while
8652
+ // `frame-src` still permits the navigation, so
8653
+ // committing would navigate the frame to an unvalidated
8654
+ // body and reopen the escape path.
8655
+ onUninspectable$LWS();
8656
+ });
8657
+ }
8658
+ registerAttributeSetterDistortion$LWS(record$LWS, HTMLFrameElement$LWS, 'src', NAMESPACE_DEFAULT$LWS, src$LWS);
8659
+ return [originalSrcSetter$LWS, src$LWS];
8660
+ };
8661
+ }
8117
8662
  function initDistortionHTMLFrameSetElementOnrejectionhandled$LWS({
8118
8663
  globalObject: {
8119
8664
  HTMLFrameSetElement: HTMLFrameSetElement$LWS
@@ -8343,7 +8888,7 @@
8343
8888
  if (!isSameOriginURL$LWS(srcValue$LWS)) {
8344
8889
  return;
8345
8890
  }
8346
- } catch (_unused3$LWS) {
8891
+ } catch (_unused5$LWS) {
8347
8892
  /* empty */
8348
8893
  }
8349
8894
  if (!ReflectApply$LWS$1(DOMTokenListProtoContains$LWS, sandboxTokenList$LWS, [ALLOW_SCRIPTS_TOKEN$LWS])) {
@@ -8382,7 +8927,7 @@
8382
8927
  // FOLLOWING `iframe.src = ...` (or setAttribute('src',...) etc.)
8383
8928
  // even though we cannot synchronously propagate the original
8384
8929
  // hostile-detection back to its triggering setter call.
8385
- if (isGaterEnabledFeature$LWS('changesSince.264') && isPoisonedIframe$LWS(this)) {
8930
+ if (isGaterEnabledFeature$LWS('iframeSrcSameOriginPreflightCheck') && isPoisonedIframe$LWS(this)) {
8386
8931
  throw new LockerSecurityError$LWS('HTMLIFrameElement is poisoned: a prior src assignment fetched a body containing an attack pattern. The iframe cannot be reused.');
8387
8932
  }
8388
8933
  const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
@@ -8433,7 +8978,7 @@
8433
8978
  // resolves. Pending URL is recorded normally so read paths
8434
8979
  // (iframe.src, getAttribute('src'), attributes['src'].value)
8435
8980
  // surface what sandbox code wrote.
8436
- if (isGaterEnabledFeature$LWS('changesSince.264') && urlString$LWS !== '' && urlString$LWS !== ABOUT_BLANK_TOKEN$LWS && isSameOriginURL$LWS(urlString$LWS)) {
8981
+ if (isGaterEnabledFeature$LWS('iframeSrcSameOriginPreflightCheck') && urlString$LWS !== '' && urlString$LWS !== ABOUT_BLANK_TOKEN$LWS && isSameOriginURL$LWS(urlString$LWS)) {
8437
8982
  // Cross-iframe rejection cache: if any prior pre-flight
8438
8983
  // (on this iframe or any other) detected an attack
8439
8984
  // pattern at this URL's pathname, refuse the assignment
@@ -9034,7 +9579,14 @@
9034
9579
  };
9035
9580
  }
9036
9581
  const descriptorCaches$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
9037
- function createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS) {
9582
+ function createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS, blockedTagName$LWS) {
9583
+ // When the interface has a single canonical HTML tag name (iframe, embed,
9584
+ // script), record it so a foreign generic node that would reparse into this
9585
+ // interface is still matched for this blocked attribute. See W-23590867 and
9586
+ // elementMatchesCtor's tag-name fallback.
9587
+ if (blockedTagName$LWS !== undefined) {
9588
+ registerBlockedAttributeTagName$LWS(Ctor$LWS, blockedTagName$LWS, attributeName$LWS);
9589
+ }
9038
9590
  return function initDistortionBlockedAttribute$LWS() {
9039
9591
  const enquotedAttributeName$LWS = enquote$LWS(attributeName$LWS);
9040
9592
  const distortionName$LWS = `blocked${capitalizeFirstChar$LWS(attributeName$LWS)}Attribute`;
@@ -9093,14 +9645,14 @@
9093
9645
  return valueThrowerDistortionFactory$LWS;
9094
9646
  };
9095
9647
  }
9096
- function addBlockedAttributeSetterDistortionFactoryInitializers$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS, factoryInitializers$LWS) {
9648
+ function addBlockedAttributeSetterDistortionFactoryInitializers$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS, factoryInitializers$LWS, blockedTagName$LWS) {
9097
9649
  let {
9098
9650
  length: factoryInitializersOffset$LWS
9099
9651
  } = factoryInitializers$LWS;
9100
9652
  for (let i$LWS = 0, {
9101
9653
  length: length$LWS
9102
9654
  } = attributes$LWS; i$LWS < length$LWS; i$LWS += 1) {
9103
- factoryInitializers$LWS[factoryInitializersOffset$LWS++] = createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS[i$LWS]);
9655
+ factoryInitializers$LWS[factoryInitializersOffset$LWS++] = createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS[i$LWS], blockedTagName$LWS);
9104
9656
  }
9105
9657
  }
9106
9658
  // Read-side counterpart of createBlockedAttributeSetterDistortionFactoryInitializer:
@@ -10033,6 +10585,22 @@
10033
10585
  const originalNodeValueSetter$LWS = ObjectLookupOwnSetter$LWS(Node$LWS.prototype, 'nodeValue');
10034
10586
  return function distortionNodeValueSetter$LWS(record$LWS) {
10035
10587
  return [originalNodeValueSetter$LWS, function nodeValue$LWS(value$LWS) {
10588
+ // W-23596015: `nodeValue` aliases `Attr.prototype.value`, so it
10589
+ // shares the same reentrant Attr owner-state TOCTOU. Coerce
10590
+ // `value` to a string EXACTLY ONCE, up front — before reading
10591
+ // `ownerElement` — so the routing decision is made against the
10592
+ // resolved string. Otherwise a `{ toString() {...} }` value
10593
+ // reaches the native setter unconverted, and native WebIDL
10594
+ // DOMString coercion runs the attacker's `toString()` AFTER LWS
10595
+ // has committed to a route (native passthrough for a detached
10596
+ // Attr, or a no-distortion element); that reentrant call can
10597
+ // attach the Attr to a <script> so the final value lands via a
10598
+ // raw native write that skips the script-`src` distortion.
10599
+ // Coercing first makes any such reentrant attach visible to the
10600
+ // `ownerElement` read below. `null`/`undefined` pass through
10601
+ // untouched so the native setter keeps its nullable-`DOMString?`
10602
+ // "treat as the empty string" behavior.
10603
+ const coercedValue$LWS = isGaterEnabledFeature$LWS('changesSince.266') && value$LWS !== null && value$LWS !== undefined ? toSafeStringValue$LWS(value$LWS) : value$LWS;
10036
10604
  // W-10476944 Window access via nodeValue/textContent:
10037
10605
  // This distortion sanitizes the given text to prevent window
10038
10606
  // access from being achieved via the nodeValue property.
@@ -10040,21 +10608,21 @@
10040
10608
  if (this instanceof Attr$LWS) {
10041
10609
  const ownerEl$LWS = ReflectApply$LWS$1(AttrProtoOwnerElementGetter$LWS, this, []);
10042
10610
  if (ownerEl$LWS === null) {
10043
- ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [value$LWS]);
10611
+ ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [coercedValue$LWS]);
10044
10612
  return;
10045
10613
  }
10046
- const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []);
10614
+ const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []));
10047
10615
  const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, this, []);
10048
10616
  const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
10049
10617
  const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, ownerEl$LWS, attrName$LWS, normalizedNamespace$LWS);
10050
10618
  // istanbul ignore next: needs default platform behavior test
10051
10619
  if (distortion$LWS) {
10052
- ReflectApply$LWS$1(distortion$LWS, ownerEl$LWS, [value$LWS]);
10620
+ ReflectApply$LWS$1(distortion$LWS, ownerEl$LWS, [coercedValue$LWS]);
10053
10621
  return;
10054
10622
  }
10055
10623
  }
10056
10624
  // istanbul ignore next: needs default platform behavior test
10057
- ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [value$LWS]);
10625
+ ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [coercedValue$LWS]);
10058
10626
  }];
10059
10627
  };
10060
10628
  }
@@ -10237,7 +10805,24 @@
10237
10805
  sandboxEvaluator: sandboxEvaluator$LWS
10238
10806
  } = record$LWS;
10239
10807
  return [originalTextContentSetter$LWS, function textContent$LWS(value$LWS) {
10240
- const valueAsString$LWS = trusted.createScript(value$LWS);
10808
+ // W-23596015: `textContent` aliases `Attr.prototype.value` on an
10809
+ // Attr, so it shares the same reentrant Attr owner-state TOCTOU.
10810
+ // `trusted.createScript` only performs a DOMString coercion on
10811
+ // engines that support Trusted Types; on a TT-less engine the
10812
+ // fallback policy returns its argument unchanged, so a
10813
+ // `{ toString() {...} }` value would reach the native setter
10814
+ // unconverted and native WebIDL DOMString coercion would run the
10815
+ // attacker's `toString()` AFTER LWS committed to a route,
10816
+ // letting it reentrantly attach the Attr to a <script> and land
10817
+ // the final value via a raw native write that skips the
10818
+ // script-`src` distortion. Coerce `value` to a string EXACTLY
10819
+ // ONCE, up front, so the coercion is DOMString-strength on every
10820
+ // engine and any reentrant attach is visible to the
10821
+ // `ownerElement` read below. `null`/`undefined` pass through
10822
+ // untouched so the native setter keeps its nullable-`DOMString?`
10823
+ // "treat as the empty string" behavior.
10824
+ const coercedValue$LWS = isGaterEnabledFeature$LWS('changesSince.266') && value$LWS !== null && value$LWS !== undefined ? toSafeStringValue$LWS(value$LWS) : value$LWS;
10825
+ const valueAsString$LWS = trusted.createScript(coercedValue$LWS);
10241
10826
  // There are two existence of the attribute textContent, one on
10242
10827
  // Attr and one on Node. This first if statement is checking to
10243
10828
  // figure out which distortion should be applied. The instanceof
@@ -10254,7 +10839,7 @@
10254
10839
  ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
10255
10840
  return;
10256
10841
  }
10257
- const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []);
10842
+ const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []));
10258
10843
  const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, this, []);
10259
10844
  const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
10260
10845
  const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, ownerEl$LWS, attrName$LWS, normalizedNamespace$LWS);
@@ -11891,7 +12476,7 @@
11891
12476
  }
11892
12477
  current$LWS = ReflectGetPrototypeOf$LWS$1(current$LWS);
11893
12478
  }
11894
- } catch (_unused4$LWS) {
12479
+ } catch (_unused6$LWS) {
11895
12480
  // Not the confused-deputy path: defer to native below.
11896
12481
  }
11897
12482
  if (distortedGetter$LWS !== undefined) {
@@ -11966,6 +12551,57 @@
11966
12551
  return distortionEntry$LWS;
11967
12552
  };
11968
12553
  }
12554
+
12555
+ // W-23526613. `Response.json(data)` is an un-distorted, blue-realm native that
12556
+ // serializes `data` to JSON using the engine's own value-to-JSON-bytes walk.
12557
+ // That walk enumerates the argument's real own properties in native code,
12558
+ // below the near-membrane's `get`/`ownKeys` traps, so handing it a raw host
12559
+ // object (e.g. `document`) lets HTML's named-element-access algorithm fall back
12560
+ // to `Document.prototype.cookie` and leak the raw, un-namespaced cookie -- a
12561
+ // bypass of the property-access filtering the sandbox applies to ordinary
12562
+ // sandboxed JS reads.
12563
+ //
12564
+ // A `JSON.stringify` replacer neutralizes the leak. Values the sandbox itself
12565
+ // created round-trip to the blue realm as near-membrane proxies, whose native
12566
+ // walk goes through the membrane's proxy traps and is therefore already
12567
+ // filtered; any other object reachable from `data` is a raw blue host
12568
+ // reference the sandbox merely holds, and is replaced with an empty object so
12569
+ // the native serializer never enumerates it. The replacer runs before native
12570
+ // enumeration of each node, so it closes both the reported top-level
12571
+ // `Response.json(document)` call and nested carriers such as
12572
+ // `Response.json({ leak: document })`.
12573
+ function neutralizeHostObjectReplacer$LWS(_key$LWS, value$LWS) {
12574
+ if (value$LWS !== null && typeof value$LWS === 'object' && !isNearMembraneProxy$LWS$1(value$LWS)) {
12575
+ return {};
12576
+ }
12577
+ return value$LWS;
12578
+ }
12579
+ function initDistortionResponseJson$LWS({
12580
+ globalObject: {
12581
+ Response: Response$LWS
12582
+ }
12583
+ }) {
12584
+ const originalJson$LWS = Response$LWS == null ? void 0 : Response$LWS.json;
12585
+ // istanbul ignore if: Response.json is unavailable in some coverage environments
12586
+ if (typeof originalJson$LWS !== 'function') {
12587
+ return noop$LWS$1;
12588
+ }
12589
+ const distortionEntry$LWS = [originalJson$LWS, function json$LWS(...args$LWS) {
12590
+ if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length) {
12591
+ const safeString$LWS = JSONStringify$LWS$1(args$LWS[0], neutralizeHostObjectReplacer$LWS);
12592
+ // A top-level value that JSON serialization drops (undefined, a
12593
+ // function, a symbol) produces no bytes. Delegate to the native
12594
+ // implementation with `undefined` -- never the raw argument --
12595
+ // so it throws its own TypeError without a raw host object ever
12596
+ // reaching the native serializer.
12597
+ args$LWS[0] = safeString$LWS === undefined ? undefined : JSONParse$LWS(safeString$LWS);
12598
+ }
12599
+ return ReflectApply$LWS$1(originalJson$LWS, this, args$LWS);
12600
+ }];
12601
+ return function distortionResponseJson$LWS() {
12602
+ return distortionEntry$LWS;
12603
+ };
12604
+ }
11969
12605
  const {
11970
12606
  isSharedElement: isSharedElement$7$LWS
11971
12607
  } = rootValidator$LWS;
@@ -12548,7 +13184,7 @@
12548
13184
  try {
12549
13185
  originalStorageObject$LWS = globalObject$LWS[storageName$LWS];
12550
13186
  // eslint-disable-next-line no-empty
12551
- } catch (_unused5$LWS) {}
13187
+ } catch (_unused7$LWS) {}
12552
13188
  // istanbul ignore if: currently unreachable via tests
12553
13189
  if (!isObject$LWS$1(originalStorageObject$LWS)) {
12554
13190
  return noop$LWS$1;
@@ -12776,6 +13412,63 @@
12776
13412
  registerAttributeSetterDistortion$LWS(record$LWS, SVGAnimateElement$LWS, 'values', NAMESPACE_DEFAULT$LWS, values$LWS);
12777
13413
  };
12778
13414
  }
13415
+
13416
+ // W-23525040: SMIL animation of a script element's `href`/`xlink:href` is a
13417
+ // script-execution primitive that bypasses LWS's script-URL gate. LWS routes
13418
+ // every JS-level script-href write (attribute setter, property setter,
13419
+ // `SVGAnimatedString.baseVal`) through `createScriptDistortion` ->
13420
+ // `lwsInternalPolicy.createScriptURL`. Starting a SMIL animation via
13421
+ // `beginElement()`/`beginElementAt()` makes the engine write the target's
13422
+ // animated `href` inside its own implementation, never surfacing as a
13423
+ // JS-observable attribute mutation, so none of those gates ever see it and the
13424
+ // resolved URL loads and executes outside the membrane.
13425
+ //
13426
+ // A `<script>` is the only SVG element whose `href` is executable, and there is
13427
+ // no legitimate reason to SMIL-animate a script element, so both programmatic
13428
+ // begin methods refuse to start when the resolved animation target is a script
13429
+ // element. This is scheme-agnostic: legitimate script loading (including
13430
+ // `blob:` URLs) continues to work through the normal, gated `href` setter.
13431
+ const CANNOT_ANIMATE_SCRIPT_ELEMENT$LWS = 'Cannot begin an SVG animation that targets a script element.';
13432
+ // `beginElement()` and `beginElementAt(offset)` are the two programmatic SMIL
13433
+ // begin methods, and both need the identical guard: refuse to start when the
13434
+ // resolved animation target is a script element. `makeGuard` builds the init
13435
+ // function for either one so the guard exists as a single audited code path --
13436
+ // keeping future extensions (e.g. `endElement`/`endElementAt`, or the
13437
+ // declarative-trigger surface called out in the commit message) in lockstep
13438
+ // instead of drifting across copy-pasted bodies.
13439
+ function makeGuard$LWS(methodName$LWS) {
13440
+ return function initDistortionSVGAnimationElementBegin$LWS({
13441
+ globalObject: {
13442
+ SVGAnimationElement: SVGAnimationElement$LWS
13443
+ }
13444
+ }) {
13445
+ const SVGAnimationElementProto$LWS = SVGAnimationElement$LWS == null ? void 0 : SVGAnimationElement$LWS.prototype;
13446
+ // Defensive: if a future engine drops the begin method or the
13447
+ // `targetElement` getter off the prototype, install no distortion
13448
+ // rather than capture `undefined` and later crash on invocation.
13449
+ // Consistent with the `typeof ... !== 'function'` init guards used by
13450
+ // the CookieStore / Notification / TrustedTypePolicy distortions.
13451
+ if (!SVGAnimationElementProto$LWS) {
13452
+ return noop$LWS$1;
13453
+ }
13454
+ const originalBegin$LWS = SVGAnimationElementProto$LWS[methodName$LWS];
13455
+ const originalTargetElementGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGAnimationElementProto$LWS, 'targetElement');
13456
+ if (typeof originalBegin$LWS !== 'function' || typeof originalTargetElementGetter$LWS !== 'function') {
13457
+ return noop$LWS$1;
13458
+ }
13459
+ const distortionEntry$LWS = [originalBegin$LWS, function begin$LWS(...args$LWS) {
13460
+ if (isGaterEnabledFeature$LWS('changesSince.266') && isScriptElement$LWS(ReflectApply$LWS$1(originalTargetElementGetter$LWS, this, []))) {
13461
+ throw new LockerSecurityError$LWS(CANNOT_ANIMATE_SCRIPT_ELEMENT$LWS);
13462
+ }
13463
+ ReflectApply$LWS$1(originalBegin$LWS, this, args$LWS);
13464
+ }];
13465
+ return function distortionSVGAnimationElementBegin$LWS() {
13466
+ return distortionEntry$LWS;
13467
+ };
13468
+ };
13469
+ }
13470
+ const initDistortionSVGAnimationElementBeginElement$LWS = makeGuard$LWS('beginElement');
13471
+ const initDistortionSVGAnimationElementBeginElementAt$LWS = makeGuard$LWS('beginElementAt');
12779
13472
  function initDistortionSVGElementDatasetGetter$LWS({
12780
13473
  globalObject: {
12781
13474
  SVGElement: SVGElement$LWS
@@ -12974,7 +13667,7 @@
12974
13667
  try {
12975
13668
  // istanbul ignore next: needs default platform behavior test
12976
13669
  return ReflectApply$LWS$1(originalCreatePolicy$LWS, this, args$LWS);
12977
- } catch (_unused6$LWS) {
13670
+ } catch (_unused8$LWS) {
12978
13671
  // istanbul ignore next: this is tested, but currently cannot be tested in the coverage environment
12979
13672
  consoleWarn$LWS(`${createTrustedTypesExceptionMessage$LWS(name$LWS)} Substituting with Lightning Web Security policy.`);
12980
13673
  }
@@ -13101,15 +13794,25 @@
13101
13794
  }
13102
13795
  const loweredBlobType$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, blobType$LWS, []);
13103
13796
  if (HTML_MIME_TYPES_LIST$LWS.includes(loweredBlobType$LWS)) {
13797
+ // The `includes` gate above is an exact-string match against
13798
+ // HTML_MIME_TYPES_LIST, whose entries carry no parameters
13799
+ // (`text/html`, `image/svg+xml`, `text/xml`). A blob type that
13800
+ // arrived with a `;charset=` parameter (e.g.
13801
+ // `text/html;charset=utf-16`) fails that exact match and never
13802
+ // reaches this branch, so `loweredBlobType` here is always bare
13803
+ // and appending `;charset=utf-8` cannot produce a doubled
13804
+ // charset parameter. Both the validation slice and the
13805
+ // re-issued Blob reuse this one normalized content type.
13806
+ const normalizedContentType$LWS = `${loweredBlobType$LWS};charset=utf-8`;
13104
13807
  const blobSize$LWS = ReflectApply$LWS$1(BlobProtoSizeGetter$LWS, blobObject$LWS, []);
13105
- const normalizedBlob$LWS = ReflectApply$LWS$1(BlobProtoSlice$LWS, blobObject$LWS, [0, blobSize$LWS, `${loweredBlobType$LWS};charset=utf-8`]);
13808
+ const normalizedBlob$LWS = ReflectApply$LWS$1(BlobProtoSlice$LWS, blobObject$LWS, [0, blobSize$LWS, normalizedContentType$LWS]);
13106
13809
  URLRevokeObjectURL$LWS(outURL$LWS);
13107
13810
  outURL$LWS = ReflectApply$LWS$1(originalCreateObjectURL$LWS, this, [normalizedBlob$LWS]);
13108
13811
  const xhr$LWS = new XhrCtor$LWS();
13109
13812
  ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', outURL$LWS, false]);
13110
13813
  try {
13111
13814
  ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
13112
- } catch (_unused7$LWS) {
13815
+ } catch (_unused9$LWS) {
13113
13816
  throw new LockerSecurityError$LWS(`Unable to verify ${toSafeTemplateStringValue$LWS(blobObject$LWS)} is secure.`);
13114
13817
  }
13115
13818
  const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
@@ -13122,6 +13825,27 @@
13122
13825
  URLRevokeObjectURL$LWS(outURL$LWS);
13123
13826
  throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
13124
13827
  }
13828
+ // W-23558036: the validated bytes were read from a URL over
13829
+ // `normalizedBlob`, which is a `slice()` of the caller's
13830
+ // original Blob/File. For a filesystem-backed File (e.g. an
13831
+ // OPFS-derived File on WebKit) that slice can stay bound to
13832
+ // the live on-disk resource rather than an immutable snapshot,
13833
+ // so the bytes the URL resolves to can be swapped AFTER this
13834
+ // validation returns — the classic time-of-check/time-of-use
13835
+ // gap. Re-issue the URL over a fresh in-memory Blob built from
13836
+ // the exact `responseText` we just validated. An in-memory Blob
13837
+ // has no backing filesystem path to mutate, so the returned URL
13838
+ // is anchored to the validated bytes regardless of how the
13839
+ // input Blob/File was obtained (OPFS, <input type=file>,
13840
+ // drag-drop, etc.).
13841
+ if (isGaterEnabledFeature$LWS('changesSince.266')) {
13842
+ URLRevokeObjectURL$LWS(outURL$LWS);
13843
+ const validatedBlob$LWS = new BlobCtor$LWS([responseText$LWS], {
13844
+ __proto__: null,
13845
+ type: normalizedContentType$LWS
13846
+ });
13847
+ outURL$LWS = ReflectApply$LWS$1(originalCreateObjectURL$LWS, this, [validatedBlob$LWS]);
13848
+ }
13125
13849
  return outURL$LWS;
13126
13850
  }
13127
13851
  if (isMIMETypeAllowed$LWS(loweredBlobType$LWS)) {
@@ -14019,6 +14743,53 @@
14019
14743
  return distortionEntry$LWS;
14020
14744
  };
14021
14745
  }
14746
+
14747
+ // A genuine `Document` (from any realm) carries the internal slot that backs
14748
+ // `Document.prototype.documentElement`, so reading it through the raw getter
14749
+ // succeeds; every other value (plain object, primitive, null, a foreign sink
14750
+ // object) throws and is treated as not-a-Document. This is also exactly the
14751
+ // set of objects for which the exploit is live: the Streams sink protocol
14752
+ // invokes the captured `write` algorithm with the sink as its `this`, so only
14753
+ // an object that actually owns the `Document` internal slot can drive the
14754
+ // native `Document.write`.
14755
+ function isDocument$LWS(value$LWS) {
14756
+ try {
14757
+ ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, value$LWS, []);
14758
+ return true;
14759
+ } catch (_unused0$LWS) {
14760
+ return false;
14761
+ }
14762
+ }
14763
+ function initDistortionWritableStreamCtor$LWS({
14764
+ globalObject: {
14765
+ WritableStream: originalWritableStreamCtor$LWS
14766
+ }
14767
+ }) {
14768
+ // istanbul ignore if: WritableStream is always available in coverage environments
14769
+ if (typeof originalWritableStreamCtor$LWS !== 'function') {
14770
+ return noop$LWS$1;
14771
+ }
14772
+ function WritableStream$LWS(...args$LWS) {
14773
+ // A `WritableStream` extracts its `start`/`write`/`close`/`abort` sink
14774
+ // algorithms off the underlying sink object at construction time, via
14775
+ // WebIDL member reads on the raw host object that happen outside the
14776
+ // near-membrane's call-interception layer. Passing a `Document` as the
14777
+ // sink captures the native `Document.prototype.write` (which LWS blocks
14778
+ // with a value-thrower on the method itself) as the stream's write
14779
+ // algorithm; each later `writer.write(chunk)` then runs the raw
14780
+ // `Document.write` through the browser's internal stream machinery,
14781
+ // never re-entering the thrower. Refuse a `Document` sink so the blocked
14782
+ // method cannot be laundered into a live reference.
14783
+ if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length && isDocument$LWS(args$LWS[0])) {
14784
+ throw new LockerSecurityError$LWS('Cannot create WritableStream with a Document sink.');
14785
+ }
14786
+ return ReflectConstruct$LWS(originalWritableStreamCtor$LWS, args$LWS);
14787
+ }
14788
+ const distortionEntry$LWS = [originalWritableStreamCtor$LWS, WritableStream$LWS];
14789
+ return function distortionWritableStreamCtor$LWS() {
14790
+ return distortionEntry$LWS;
14791
+ };
14792
+ }
14022
14793
  function initDistortionXMLHttpRequestOpen$LWS({
14023
14794
  globalObject: {
14024
14795
  XMLHttpRequest: {
@@ -14094,7 +14865,7 @@
14094
14865
  try {
14095
14866
  docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
14096
14867
  isDocument$LWS = true;
14097
- } catch (_unused8$LWS) {
14868
+ } catch (_unused1$LWS) {
14098
14869
  isDocument$LWS = false;
14099
14870
  }
14100
14871
  }
@@ -14166,6 +14937,8 @@
14166
14937
  initDistortionHistoryPushState$LWS, initDistortionHistoryReplaceState$LWS,
14167
14938
  // HTMLElement
14168
14939
  initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
14940
+ // HTMLFrameElement
14941
+ initDistortionHTMLFrameElementSrcGetter$LWS, initDistortionHTMLFrameElementSrcSetter$LWS,
14169
14942
  // HTMLIFrameElement
14170
14943
  initDistortionIFrameElementContentDocumentGetter$LWS, initDistortionIFrameElementContentWindowGetter$LWS, initDistortionHTMLIFrameElementSandboxGetter$LWS, initDistortionHTMLIFrameElementSandboxSetter$LWS, initDistortionHTMLIFrameElementSrcGetter$LWS, initDistortionHTMLIFrameElementSrcSetter$LWS,
14171
14944
  // HTMLImageElement
@@ -14220,6 +14993,8 @@
14220
14993
  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,
14221
14994
  // Reflect
14222
14995
  initDistortionReflectApply$LWS, initDistortionReflectConstruct$LWS, initDistortionReflectDefineProperty$LWS, initDistortionReflectGet$LWS,
14996
+ // Response
14997
+ initDistortionResponseJson$LWS,
14223
14998
  // Selection
14224
14999
  initDistortionSelectionAnchorNodeGetter$LWS, initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionFocusNodeGetter$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS, initDistortionSelectionToString$LWS,
14225
15000
  // ServiceWorkerContainer
@@ -14232,6 +15007,8 @@
14232
15007
  initDistortionSVGAnimatedStringBaseValSetter$LWS,
14233
15008
  // SVGAnimateElement
14234
15009
  initDistortionSVGAnimateElementFromAttribute$LWS, initDistortionSVGAnimateElementToAttribute$LWS, initDistortionSVGAnimateElementValuesAttribute$LWS,
15010
+ // SVGAnimationElement
15011
+ initDistortionSVGAnimationElementBeginElement$LWS, initDistortionSVGAnimationElementBeginElementAt$LWS,
14235
15012
  // SVGElement
14236
15013
  initDistortionSVGElementDatasetGetter$LWS, initDistortionSVGElementStyleGetter$LWS,
14237
15014
  // SVGSetElement
@@ -14248,6 +15025,8 @@
14248
15025
  initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowNameGetter$LWS, initDistortionWindowNameSetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
14249
15026
  // Worker
14250
15027
  initDistortionWorkerCtor$LWS, initDistortionWorkerProto$LWS,
15028
+ // WritableStream
15029
+ initDistortionWritableStreamCtor$LWS,
14251
15030
  // XHR
14252
15031
  initDistortionXMLHttpRequestOpen$LWS];
14253
15032
  const internalKeyedDistortionFactoryInitializers$LWS = [
@@ -14328,7 +15107,7 @@
14328
15107
  // initDistortionNodeAppendChild,
14329
15108
  initDistortionNodeInsertBefore$LWS]);
14330
15109
  const externalKeyedDistortionFactoryInitializers$LWS = internalKeyedDistortionFactoryInitializers$LWS;
14331
- const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionBroadcastChannelCtor$LWS, 'broadcastChannel'], [initDistortionBroadcastChannelNameGetter$LWS, 'broadcastChannel'], [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'], [initDistortionDOMTokenListAdd$LWS, 'domTokenList'], [initDistortionDOMTokenListReplace$LWS, 'domTokenList'], [initDistortionDOMTokenListToggle$LWS, 'domTokenList'], [initDistortionDOMTokenListValueSetter$LWS, 'domTokenList'], [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'], [initDistortionElementRemoveAttribute$LWS, 'attributes'], [initDistortionElementRemoveAttributeNS$LWS, 'attributes'], [initDistortionElementRemoveAttributeNode$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'], [initDistortionHTMLImageElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLImageElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLLinkElementHrefSetter$LWS, 'networkSrc'], [initDistortionHTMLMediaElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLTrackElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLScriptElementInnerTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementInnerTextSetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBFactoryDatabases$LWS, 'indexedDB'], [initDistortionIDBFactoryDeleteDatabase$LWS, 'indexedDB'], [initDistortionIDBFactoryOpen$LWS, 'indexedDB'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionIntersectionObserverObserve$LWS, 'observers'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionPerformanceObserverObserve$LWS, 'observers'], [initDistortionResizeObserverObserve$LWS, 'observers'], [initDistortionAttrValueGetter$LWS, 'attributes'], [initDistortionAttrValueSetter$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionObservableCatch$LWS, 'observable'], [initDistortionObservableEvery$LWS, 'observable'], [initDistortionObservableFilter$LWS, 'observable'], [initDistortionObservableFinally$LWS, 'observable'], [initDistortionObservableFind$LWS, 'observable'], [initDistortionObservableFlatMap$LWS, 'observable'], [initDistortionObservableForEach$LWS, 'observable'], [initDistortionObservableInspect$LWS, 'observable'], [initDistortionObservableMap$LWS, 'observable'], [initDistortionObservableReduce$LWS, 'observable'], [initDistortionObservableSome$LWS, 'observable'], [initDistortionObservableSubscribe$LWS, 'observable'], [initDistortionObservableSwitchMap$LWS, 'observable'], [initDistortionNodeGetRootNode$LWS, 'node'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeParentElementGetter$LWS, 'node'], [initDistortionNodeParentNodeGetter$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']]));
15110
+ const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionBroadcastChannelCtor$LWS, 'broadcastChannel'], [initDistortionBroadcastChannelNameGetter$LWS, 'broadcastChannel'], [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'], [initDistortionDOMTokenListAdd$LWS, 'domTokenList'], [initDistortionDOMTokenListReplace$LWS, 'domTokenList'], [initDistortionDOMTokenListToggle$LWS, 'domTokenList'], [initDistortionDOMTokenListValueSetter$LWS, 'domTokenList'], [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'], [initDistortionElementRemoveAttribute$LWS, 'attributes'], [initDistortionElementRemoveAttributeNS$LWS, 'attributes'], [initDistortionElementRemoveAttributeNode$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'], [initDistortionHTMLImageElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLImageElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLLinkElementHrefSetter$LWS, 'networkSrc'], [initDistortionHTMLMediaElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLTrackElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLScriptElementInnerTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementInnerTextSetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBFactoryDatabases$LWS, 'indexedDB'], [initDistortionIDBFactoryDeleteDatabase$LWS, 'indexedDB'], [initDistortionIDBFactoryOpen$LWS, 'indexedDB'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionIntersectionObserverObserve$LWS, 'observers'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionPerformanceObserverObserve$LWS, 'observers'], [initDistortionResizeObserverObserve$LWS, 'observers'], [initDistortionAttrValueGetter$LWS, 'attributes'], [initDistortionAttrValueSetter$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionObservableCatch$LWS, 'observable'], [initDistortionObservableEvery$LWS, 'observable'], [initDistortionObservableFilter$LWS, 'observable'], [initDistortionObservableFinally$LWS, 'observable'], [initDistortionObservableFind$LWS, 'observable'], [initDistortionObservableFlatMap$LWS, 'observable'], [initDistortionObservableForEach$LWS, 'observable'], [initDistortionObservableInspect$LWS, 'observable'], [initDistortionObservableMap$LWS, 'observable'], [initDistortionObservableReduce$LWS, 'observable'], [initDistortionObservableSome$LWS, 'observable'], [initDistortionObservableSubscribe$LWS, 'observable'], [initDistortionObservableSwitchMap$LWS, 'observable'], [initDistortionNodeGetRootNode$LWS, 'node'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeParentElementGetter$LWS, 'node'], [initDistortionNodeParentNodeGetter$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'], [initDistortionSVGAnimationElementBeginElement$LWS, 'script'], [initDistortionSVGAnimationElementBeginElementAt$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']]));
14332
15111
  const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
14333
15112
  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'];
14334
15113
  const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
@@ -14338,6 +15117,9 @@
14338
15117
  const HTMLEmbedElementBlockedAttributes$LWS = ['src'];
14339
15118
  const HTMLEmbedElementProtoBlockedProperties$LWS = ['getSVGDocument', 'src'];
14340
15119
 
15120
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame
15121
+ const HTMLFrameElementBlockedAttributes$LWS = ['srcdoc'];
15122
+
14341
15123
  // https://www.w3schools.com/tags/tag_iframe.asp
14342
15124
  const HTMLIFrameElementBlockedAttributes$LWS = ['srcdoc'];
14343
15125
  const HTMLIFrameElementProtoBlockedProperties$LWS = ['getSVGDocument', 'srcdoc'];
@@ -14357,7 +15139,7 @@
14357
15139
  const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
14358
15140
  const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
14359
15141
  const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
14360
- /*! version: 0.29.0 */
15142
+ /*! version: 0.29.1 */
14361
15143
 
14362
15144
  /*!
14363
15145
  * Copyright (C) 2021 salesforce.com, inc.
@@ -14366,7 +15148,7 @@
14366
15148
  function getPdpSchema$LWS() {
14367
15149
  return pdpSchema$LWS;
14368
15150
  }
14369
- /*! version: 0.29.0 */
15151
+ /*! version: 0.29.1 */
14370
15152
 
14371
15153
  /*!
14372
15154
  * Copyright (C) 2019 salesforce.com, inc.
@@ -14617,6 +15399,7 @@
14617
15399
  Element: Element$LWS,
14618
15400
  Event: Event$LWS,
14619
15401
  HTMLElement: HTMLElement$LWS,
15402
+ HTMLFrameElement: HTMLFrameElement$LWS,
14620
15403
  HTMLIFrameElement: HTMLIFrameElement$LWS,
14621
15404
  HTMLScriptElement: HTMLScriptElement$LWS,
14622
15405
  SVGElement: SVGElement$LWS,
@@ -14627,9 +15410,16 @@
14627
15410
  // instanbul ignore next: coverage is collected on the external sandbox test run
14628
15411
  ArrayConcat$LWS(internalDistortionFactoryInitializers$LWS, internalKeyedDistortionFactoryInitializers$LWS) : ArrayConcat$LWS(externalDistortionFactoryInitializers$LWS, externalKeyedDistortionFactoryInitializers$LWS);
14629
15412
  addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLElement$LWS, 'HTMLElement', HTMLElementBlockedAttributes$LWS, initializers$LWS);
14630
- addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLEmbedElement, 'HTMLEmbedElement', HTMLEmbedElementBlockedAttributes$LWS, initializers$LWS);
14631
- addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS);
14632
- addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS);
15413
+ addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLEmbedElement, 'HTMLEmbedElement', HTMLEmbedElementBlockedAttributes$LWS, initializers$LWS, 'embed');
15414
+ addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS, 'iframe');
15415
+ // A legacy `<frame>` is an HTMLFrameElement (sibling of HTMLIFrameElement),
15416
+ // never `instanceof HTMLIFrameElement`, so the iframe `srcdoc` block above
15417
+ // does not cover it. Without this, `setAttribute('srcdoc', ...)` on a
15418
+ // `<frame>` reparses into an unmembraned same-origin browsing context.
15419
+ if (isGaterEnabledFeature$LWS('changesSince.266')) {
15420
+ addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLFrameElement$LWS, 'HTMLFrameElement', HTMLFrameElementBlockedAttributes$LWS, initializers$LWS);
15421
+ }
15422
+ addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS, 'script');
14633
15423
  addBlockedAttributeSetterDistortionFactoryInitializers$LWS(SVGElement$LWS, 'SVGElement', SVGElementBlockedAttributes$LWS, initializers$LWS);
14634
15424
  // Read-side block list: only the subset of write-blocked attributes that
14635
15425
  // ALSO must not be readable. Today this is `nonce` only; attributes like
@@ -20063,7 +20853,7 @@
20063
20853
  // tools from mistaking the regexp or the replacement string for an
20064
20854
  // actual source mapping URL.
20065
20855
  /\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
20066
- sourceText$LWS = `\n//# LWS Version = "0.29.0"\n${sourceText$LWS}`;
20856
+ sourceText$LWS = `\n//# LWS Version = "0.29.1"\n${sourceText$LWS}`;
20067
20857
  return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
20068
20858
  // Append "'use strict'" to the extracted function body so it is
20069
20859
  // evaluated in strict mode.
@@ -20085,6 +20875,15 @@
20085
20875
  // causing the check to bail out and the DOMContentLoaded listener to never be
20086
20876
  // attached.
20087
20877
  const childWindowDocuments$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
20878
+ // Sentinel "last document" recorded in childWindowDocuments for opaque child
20879
+ // windows whose real document cannot be read (cross-origin access throws). It
20880
+ // is a fresh object identity, so it is guaranteed distinct from any real
20881
+ // Document. The first same-origin document observed after an
20882
+ // opaque→same-origin transition therefore fails the `currentDoc !==
20883
+ // lastDocument` check in distortionCallback, causing a fresh secondary record
20884
+ // to be created for the new realm before its raw built-ins can be handed to
20885
+ // sandboxed code.
20886
+ const OPAQUE_CHILD_WINDOW_DOCUMENT_SENTINEL$LWS = {};
20088
20887
  function createGetVirtualEnvironment$LWS(record$LWS) {
20089
20888
  let virtualEnvironment$LWS;
20090
20889
  return () => {
@@ -20239,6 +21038,13 @@
20239
21038
  // map with entries for the new realm's objects so the
20240
21039
  // re-lookup below can succeed.
20241
21040
  if (isGaterEnabledFeature$LWS('changesSince.262') && childWindowDocuments$LWS.size > 0) {
21041
+ // `lastDocument` is typed Document but may be
21042
+ // OPAQUE_CHILD_WINDOW_DOCUMENT_SENTINEL (a fresh `{}` cast to
21043
+ // Document) for an opaque child window whose real document
21044
+ // could not be read. It is a type-lie: only ever compare it
21045
+ // by identity (below); never read a property off it, or a
21046
+ // sentinel entry would fault instead of tripping the swap
21047
+ // check. See createOpaqueSecondaryWindowSandboxRecord.
20242
21048
  for (const [childGlobalObject$LWS, lastDocument$LWS] of childWindowDocuments$LWS) {
20243
21049
  // Only process child windows belonging to this
20244
21050
  // sandbox (each sandbox has its own distortion map).
@@ -20476,6 +21282,31 @@
20476
21282
  if (!seenGlobalObjects$LWS.has(globalObject$LWS)) {
20477
21283
  distortions$LWS.set(globalObject$LWS, globalObject$LWS);
20478
21284
  }
21285
+ // W-23475955: Track this opaque child window for document-swap detection,
21286
+ // mirroring the same-origin path in createSecondaryWindowSandboxRecord.
21287
+ // Without this, an opaque→same-origin transition (a cross-origin/opaque
21288
+ // browsing context later navigated to a same-origin document) is invisible
21289
+ // to the swap-detection loop in distortionCallback, which only walks
21290
+ // windows present in childWindowDocuments. The near-membrane caches the
21291
+ // WindowProxy's proxy pointer, so distortionCallback is never re-invoked
21292
+ // for the WindowProxy itself; the loop is the mechanism that eagerly
21293
+ // creates a secondary record for the new realm before its undistorted
21294
+ // built-ins can be reached. The opaque document is unreadable
21295
+ // (cross-origin access throws), so a sentinel is stored; the first
21296
+ // same-origin document observed after the transition differs from it and
21297
+ // trips the loop. The globalObject is not added to seenGlobalObjects here
21298
+ // so that, upon transition, createSecondaryWindowSandboxRecord still wires
21299
+ // up event-based navigation detection for the now-same-origin realm.
21300
+ //
21301
+ // Note on map growth: childWindowDocuments is a strong Map with no delete
21302
+ // path (pre-existing since the same-origin producer below, added in #2078).
21303
+ // This line adds one more producer of entries and inherits that same
21304
+ // characteristic — it does not change the growth profile. Bounding the map
21305
+ // is a separate, cross-cutting concern that also covers the same-origin
21306
+ // producer and is out of scope for this record-tracking fix.
21307
+ if (isGaterEnabledFeature$LWS('changesSince.266')) {
21308
+ childWindowDocuments$LWS.set(globalObject$LWS, OPAQUE_CHILD_WINDOW_DOCUMENT_SENTINEL$LWS);
21309
+ }
20479
21310
  // Add opaque window postMessage distortion for the child window to the root
20480
21311
  // window's distortion map.
20481
21312
  const opaqueWindowPostMessageDistortionFactory$LWS = getOpaqueWindowPostMessageDistortionFactory$LWS(record$LWS);
@@ -20762,7 +21593,7 @@
20762
21593
  // surrounding-whitespace variant of the two known separators back onto the
20763
21594
  // sandbox-scoped facade.
20764
21595
  toSafeSet$LWS(new SetCtor$LWS$1(['lightning/platformresourceloader', 'lightning:platformresourceloader', 'lightningmobileruntime/platformresourceloader', 'lightningmobileruntime:platformresourceloader']));
20765
- /*! version: 0.29.0 */
21596
+ /*! version: 0.29.1 */
20766
21597
 
20767
21598
  // Expose evaluateInSandbox on the window global so the browser harness page
20768
21599
  // (eval.html / component.html) can invoke it against source delivered by the