@locker/cli 0.29.1 → 0.29.2
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs.js +1 -1
- package/dist/lwc-engine.js +371 -283
- package/dist/lws-sandbox.js +933 -257
- package/package.json +8 -8
- package/src/compile-lwc.mjs +4 -1
package/dist/lws-sandbox.js
CHANGED
|
@@ -59,6 +59,14 @@
|
|
|
59
59
|
function ObjectLookupOwnGetter$LWS$1(object$LWS, key$LWS) {
|
|
60
60
|
return object$LWS === null || object$LWS === undefined || !ObjectHasOwn$LWS$1(object$LWS, key$LWS) ? undefined : ReflectApply$LWS$1(ObjectProtoLookupGetter$LWS$1, object$LWS, [key$LWS]);
|
|
61
61
|
}
|
|
62
|
+
// Like ObjectLookupOwnGetter but without the own-property guard, so it resolves
|
|
63
|
+
// a getter defined anywhere on the prototype chain (__lookupGetter__ walks up).
|
|
64
|
+
// Use this when an accessor may live on a base interface's prototype rather than
|
|
65
|
+
// on `object` itself, e.g. an accessor the platform relocates between interface
|
|
66
|
+
// prototypes across browser versions.
|
|
67
|
+
function ObjectLookupGetter$LWS(object$LWS, key$LWS) {
|
|
68
|
+
return object$LWS === null || object$LWS === undefined ? undefined : ReflectApply$LWS$1(ObjectProtoLookupGetter$LWS$1, object$LWS, [key$LWS]);
|
|
69
|
+
}
|
|
62
70
|
function ObjectLookupOwnSetter$LWS(object$LWS, key$LWS) {
|
|
63
71
|
return object$LWS === null || object$LWS === undefined || !ObjectHasOwn$LWS$1(object$LWS, key$LWS) ? undefined : ReflectApply$LWS$1(ObjectProtoLookupSetter$LWS$1, object$LWS, [key$LWS]);
|
|
64
72
|
}
|
|
@@ -1374,7 +1382,7 @@
|
|
|
1374
1382
|
// reads identically to what isGaterEnabledFeature stores (register and
|
|
1375
1383
|
// deregister also accept the short form via fullName above). Frozen so a
|
|
1376
1384
|
// consumer cannot mutate the shared array.
|
|
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`]);
|
|
1385
|
+
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`, `${FEATURE_NAME_PREFIX$LWS}blockWindowOpenSameOriginSameContext`, `${FEATURE_NAME_PREFIX$LWS}walkRangeProtoChainForMethods`]);
|
|
1378
1386
|
function registerGaterEnabledFeatures$LWS(lockerGaterEnabledFeatures$LWS) {
|
|
1379
1387
|
if (ArrayIsArray$LWS$1(lockerGaterEnabledFeatures$LWS)) {
|
|
1380
1388
|
lockerGaterEnabledFeatures$LWS.forEach(feature$LWS => gaterEnabledFeatures$LWS.add(fullName$LWS(feature$LWS)));
|
|
@@ -1383,6 +1391,7 @@
|
|
|
1383
1391
|
function isGaterEnabledFeature$LWS(featureName$LWS) {
|
|
1384
1392
|
return gaterEnabledFeatures$LWS.has(fullName$LWS(featureName$LWS));
|
|
1385
1393
|
}
|
|
1394
|
+
const COUNT_DISPATCH_EVENT_DETAIL_REFERENCES_GATE$LWS = 'countDispatchEventDetailReferences';
|
|
1386
1395
|
const ENABLE_MAX_PERF_MODE_GATE$LWS = 'enableMaxPerfMode';
|
|
1387
1396
|
const ENABLE_SANDBOX_CREATED_INSTRUMENTATION_GATE$LWS = 'enableSandboxCreatedInstrumentation';
|
|
1388
1397
|
const ENABLE_SANDBOXED_SAMEORIGIN_IFRAME_GATE$LWS = 'enableSandboxedSameOriginIframe';
|
|
@@ -1559,7 +1568,7 @@
|
|
|
1559
1568
|
const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
|
|
1560
1569
|
const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
|
|
1561
1570
|
toSafeSet$LWS(new SetCtor$LWS$1());
|
|
1562
|
-
/*! version: 0.29.
|
|
1571
|
+
/*! version: 0.29.2 */
|
|
1563
1572
|
|
|
1564
1573
|
/*!
|
|
1565
1574
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -2185,11 +2194,49 @@
|
|
|
2185
2194
|
// bounded the token but left the regex free to roam the whole 30 KB–2 MB slice.)
|
|
2186
2195
|
const PROLOG_DOCTYPE_INTERNAL_SUBSET_REGEX$LWS = /^<!doctype\s+[^>\s]+\s*\[/;
|
|
2187
2196
|
const PROLOG_DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS = /^<!doctype\s+[^>\s]+\s+(?:system|public)\s/;
|
|
2197
|
+
// Two regexes together detect a namespaced <script> that an HTML parser leaves
|
|
2198
|
+
// inert but an XML parser makes executable once its namespace resolves.
|
|
2199
|
+
//
|
|
2200
|
+
// (1) NAMESPACED_SCRIPT_XMLNS_REGEX — the xmlns declaration sits INSIDE the
|
|
2201
|
+
// script start tag. Matches <script or <prefix:script (the leading [<:]), then a
|
|
2202
|
+
// whitespace or `/` separator so decoy tags like <scripting> or <scriptx> are
|
|
2203
|
+
// not matched, then scans the start tag up to xmlns. The gap alternation treats
|
|
2204
|
+
// quoted attribute values as opaque ("[^"]*" and '[^']*') so a `>` inside an
|
|
2205
|
+
// attribute value (e.g. title=">") cannot prematurely end the start tag and let
|
|
2206
|
+
// the real xmlns escape the scan. This is the self-declared shape:
|
|
2207
|
+
// <script xmlns="..."> or <prefix:script ... xmlns:prefix="...">.
|
|
2208
|
+
//
|
|
2209
|
+
// (2) PREFIXED_SCRIPT_TAG_REGEX — a namespace-PREFIXED <prefix:script> tag,
|
|
2210
|
+
// whatever its attributes. XML namespaces are inherited down the tree, so the
|
|
2211
|
+
// xmlns:prefix binding can sit on an ANCESTOR — the idiomatic
|
|
2212
|
+
// <svg xmlns:a="..."><a:script/></svg> shape — rather than on the script tag
|
|
2213
|
+
// itself, where regex (1) would never see it (the declaration precedes the
|
|
2214
|
+
// script in document order). isXMLNamespacedScriptAttack pairs a match here with
|
|
2215
|
+
// a body-wide "xmlns" lookup: a prefixed script whose prefix is bound anywhere
|
|
2216
|
+
// in scope can execute. The prefixed form does not occur in benign HTML (an HTML
|
|
2217
|
+
// parser treats <a:script> as an unknown, inert element), so this reintroduces
|
|
2218
|
+
// the ancestor-inheritance vector without reviving the "plain <script> + an
|
|
2219
|
+
// unrelated 'xmlns' string" false positives that motivated narrowing regex (1) —
|
|
2220
|
+
// those bodies carry no prefixed script tag. The [^\s/>]+ prefix requires at
|
|
2221
|
+
// least one non-whitespace, non-`/`, non-`>` character before `:script`, which
|
|
2222
|
+
// is what keeps a plain <script> (no prefix) from matching.
|
|
2223
|
+
const NAMESPACED_SCRIPT_XMLNS_REGEX$LWS = /[<:]script[\s/](?:[^>"']|"[^"]*"|'[^']*')*xmlns/;
|
|
2224
|
+
const PREFIXED_SCRIPT_TAG_REGEX$LWS = /<[^\s/>]+:script[\s/>]/;
|
|
2188
2225
|
const DOCTYPE_OPENER$LWS = '<!doctype';
|
|
2189
2226
|
const PI_OPENER$LWS = '<?';
|
|
2190
2227
|
const PI_CLOSER$LWS = '?>';
|
|
2191
2228
|
const COMMENT_OPENER$LWS = '<!--';
|
|
2192
2229
|
const COMMENT_CLOSER$LWS = '-->';
|
|
2230
|
+
const CDATA_OPENER$LWS = '<![cdata[';
|
|
2231
|
+
const CDATA_CLOSER$LWS = ']]>';
|
|
2232
|
+
// A processing instruction whose target is exactly `xml-stylesheet`. Written as
|
|
2233
|
+
// the PI opener plus the target so the whole-input walk below can match it in one
|
|
2234
|
+
// StartsWith and then confirm the target boundary.
|
|
2235
|
+
const XML_STYLESHEET_PI_TARGET$LWS = `${PI_OPENER$LWS}xml-stylesheet`;
|
|
2236
|
+
// The `type` pseudo-attribute values Chromium's XSLT engine recognizes on an
|
|
2237
|
+
// `xml-stylesheet` PI. A stylesheet PI declaring any other type (e.g. text/css)
|
|
2238
|
+
// is a styling directive, not a script-execution vector, so it is left alone.
|
|
2239
|
+
const XSL_TYPE_TOKENS$LWS = ['text/xsl', 'application/xslt+xml'];
|
|
2193
2240
|
// Locate a DOCTYPE that sits in the document prolog — the only position where a
|
|
2194
2241
|
// DTD is actually parsed and where entity definitions can take effect. A DTD is
|
|
2195
2242
|
// only meaningful before the root element's start tag; anything after the root
|
|
@@ -2248,6 +2295,77 @@
|
|
|
2248
2295
|
}
|
|
2249
2296
|
return null;
|
|
2250
2297
|
}
|
|
2298
|
+
// Locate an `xml-stylesheet` processing instruction that declares an XSLT
|
|
2299
|
+
// stylesheet (W-23657156). Unlike a DTD, such a PI is dangerous wherever the XML
|
|
2300
|
+
// parser materializes it as a node — the prolog, element content, or the epilog
|
|
2301
|
+
// — because the attacker does not use it in place: they read the parsed PI node
|
|
2302
|
+
// out of the (context-less, inert) DOMParser document and append it to the LIVE
|
|
2303
|
+
// document, where Chromium's native XSLT engine fetches the stylesheet and
|
|
2304
|
+
// commits a transform whose output script runs in the host realm. So this scans
|
|
2305
|
+
// the WHOLE input, not just the prolog, skipping only comment (`<!-- -->`) and
|
|
2306
|
+
// CDATA (`<![CDATA[ ]]>`) spans — the two regions where `<?xml-stylesheet` is
|
|
2307
|
+
// inert character data the parser never turns into a PI node.
|
|
2308
|
+
//
|
|
2309
|
+
// Only a PI whose target is exactly `xml-stylesheet` and whose data carries an
|
|
2310
|
+
// XSL `type` token matches Chromium's XSLT trigger. PI data is NOT
|
|
2311
|
+
// entity-decoded by the XML parser, so a literal substring test on the PI's own
|
|
2312
|
+
// `<? ... ?>` span is faithful — an obfuscated `text/xsl` is read verbatim
|
|
2313
|
+
// and never fires. A text/css stylesheet PI has no XSL type token and is left
|
|
2314
|
+
// alone.
|
|
2315
|
+
function hasXSLStylesheetProcessingInstruction$LWS(normalizedInput$LWS) {
|
|
2316
|
+
const {
|
|
2317
|
+
length: length$LWS
|
|
2318
|
+
} = normalizedInput$LWS;
|
|
2319
|
+
let index$LWS = 0;
|
|
2320
|
+
while (index$LWS < length$LWS) {
|
|
2321
|
+
// Skip comment spans: <!-- ... --> is inert text, never a PI node.
|
|
2322
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [COMMENT_OPENER$LWS, index$LWS])) {
|
|
2323
|
+
const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [COMMENT_CLOSER$LWS, index$LWS + COMMENT_OPENER$LWS.length]);
|
|
2324
|
+
// Unterminated comment: everything after it is inert; no live PI follows.
|
|
2325
|
+
if (closerOffset$LWS === -1) {
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
index$LWS = closerOffset$LWS + COMMENT_CLOSER$LWS.length;
|
|
2329
|
+
continue;
|
|
2330
|
+
}
|
|
2331
|
+
// Skip CDATA spans: <![CDATA[ ... ]]> is inert text, never a PI node.
|
|
2332
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [CDATA_OPENER$LWS, index$LWS])) {
|
|
2333
|
+
const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [CDATA_CLOSER$LWS, index$LWS + CDATA_OPENER$LWS.length]);
|
|
2334
|
+
if (closerOffset$LWS === -1) {
|
|
2335
|
+
return false;
|
|
2336
|
+
}
|
|
2337
|
+
index$LWS = closerOffset$LWS + CDATA_CLOSER$LWS.length;
|
|
2338
|
+
continue;
|
|
2339
|
+
}
|
|
2340
|
+
// A processing instruction: <? ... ?>. Classify it, then advance past it.
|
|
2341
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [PI_OPENER$LWS, index$LWS])) {
|
|
2342
|
+
const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [PI_CLOSER$LWS, index$LWS + PI_OPENER$LWS.length]);
|
|
2343
|
+
// Unterminated PI: the parser produces no node from it.
|
|
2344
|
+
if (closerOffset$LWS === -1) {
|
|
2345
|
+
return false;
|
|
2346
|
+
}
|
|
2347
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [XML_STYLESHEET_PI_TARGET$LWS, index$LWS])) {
|
|
2348
|
+
// Confirm the target ends exactly at `xml-stylesheet`; the next
|
|
2349
|
+
// character must be PI whitespace or the closing `?`, so a longer
|
|
2350
|
+
// target such as `xml-stylesheetfoo` (which Chromium would not fire)
|
|
2351
|
+
// is not misread as the stylesheet PI.
|
|
2352
|
+
const boundaryChar$LWS = ReflectApply$LWS$1(StringProtoCharAt$LWS, normalizedInput$LWS, [index$LWS + XML_STYLESHEET_PI_TARGET$LWS.length]);
|
|
2353
|
+
if (boundaryChar$LWS === ' ' || boundaryChar$LWS === '\t' || boundaryChar$LWS === '\n' || boundaryChar$LWS === '\r' || boundaryChar$LWS === '?') {
|
|
2354
|
+
const piData$LWS = ReflectApply$LWS$1(StringProtoSlice$LWS$1, normalizedInput$LWS, [index$LWS, closerOffset$LWS]);
|
|
2355
|
+
for (let i$LWS = 0; i$LWS < XSL_TYPE_TOKENS$LWS.length; i$LWS += 1) {
|
|
2356
|
+
if (ReflectApply$LWS$1(StringProtoIncludes$LWS, piData$LWS, [XSL_TYPE_TOKENS$LWS[i$LWS]])) {
|
|
2357
|
+
return true;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
index$LWS = closerOffset$LWS + PI_CLOSER$LWS.length;
|
|
2363
|
+
continue;
|
|
2364
|
+
}
|
|
2365
|
+
index$LWS += 1;
|
|
2366
|
+
}
|
|
2367
|
+
return false;
|
|
2368
|
+
}
|
|
2251
2369
|
/* eslint-disable no-underscore-dangle */
|
|
2252
2370
|
class Validator$LWS {
|
|
2253
2371
|
constructor(document$LWS, {
|
|
@@ -2294,11 +2412,50 @@
|
|
|
2294
2412
|
// when the namespace is XHTML or SVG. The namespace URL itself can be
|
|
2295
2413
|
// obfuscated with XML character entities in attribute values, but the
|
|
2296
2414
|
// xmlns attribute name cannot, so checking for "xmlns" is reliable.
|
|
2415
|
+
//
|
|
2416
|
+
// With the iframeSrcSameOriginPreflightCheck gate on, a plain <script> plus
|
|
2417
|
+
// the substring "xmlns" elsewhere in the body is no longer enough; the xmlns
|
|
2418
|
+
// must actually be able to namespace a script. Two shapes qualify:
|
|
2419
|
+
// (1) the xmlns declaration sits inside the script start tag itself
|
|
2420
|
+
// (<script xmlns="..."> / <prefix:script ... xmlns:prefix="...">), or
|
|
2421
|
+
// (2) a namespace-PREFIXED <prefix:script> whose xmlns:prefix binding sits
|
|
2422
|
+
// on an ancestor — XML inherits namespaces down the tree, so the
|
|
2423
|
+
// declaration need not be on the script tag (the idiomatic
|
|
2424
|
+
// <svg xmlns:a="..."><a:script/></svg> shape). This pairs the prefixed
|
|
2425
|
+
// form (never emitted by benign HTML) with a body-wide "xmlns" lookup.
|
|
2426
|
+
// The legacy form (gate off) only checked for a <script> tag and the
|
|
2427
|
+
// substring "xmlns" anywhere in the body; that false-positived on benign
|
|
2428
|
+
// HTML that carries a plain <script> and also mentions "xmlns" in an
|
|
2429
|
+
// unrelated place (a sanitizer's attribute allowlist, an SVG child element,
|
|
2430
|
+
// a string literal). Shape (1) alone would miss ancestor-declared namespace
|
|
2431
|
+
// inheritance (W-23924612 review, verified in Deno and Bun); shape (2)
|
|
2432
|
+
// restores it without reviving the plain-<script> false positives. This is
|
|
2433
|
+
// the 264-patch narrowing (W-23591510, #2218) forward-ported to 266 under
|
|
2434
|
+
// the same gate that gates the iframe.src pre-flight feature, so the two
|
|
2435
|
+
// trains agree on both the check and the gate that controls it.
|
|
2297
2436
|
// eslint-disable-next-line class-methods-use-this
|
|
2298
2437
|
this.isXMLNamespacedScriptAttack = input$LWS => {
|
|
2438
|
+
if (isGaterEnabledFeature$LWS('iframeSrcSameOriginPreflightCheck')) {
|
|
2439
|
+
const normalizedInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, normalizeInput$LWS(input$LWS), [/\s+/g, ' ']);
|
|
2440
|
+
// (1) Self-declared: xmlns inside the script start tag.
|
|
2441
|
+
if (ReflectApply$LWS$1(RegExpProtoTest$LWS$1, NAMESPACED_SCRIPT_XMLNS_REGEX$LWS, [normalizedInput$LWS])) {
|
|
2442
|
+
return true;
|
|
2443
|
+
}
|
|
2444
|
+
// (2) Inherited: a prefixed <prefix:script> plus an xmlns declaration
|
|
2445
|
+
// anywhere in the body, which can bind the prefix from an ancestor.
|
|
2446
|
+
return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, PREFIXED_SCRIPT_TAG_REGEX$LWS, [normalizedInput$LWS]) && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
|
|
2447
|
+
}
|
|
2299
2448
|
const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
|
|
2300
2449
|
return hasTag$LWS(normalizedInput$LWS, 'script') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
|
|
2301
2450
|
};
|
|
2451
|
+
// Detect an `xml-stylesheet` processing instruction that declares an XSLT
|
|
2452
|
+
// stylesheet (W-23657156). See hasXSLStylesheetProcessingInstruction for the
|
|
2453
|
+
// full attack chain. Applied to the XML/XHTML/SVG parse paths of
|
|
2454
|
+
// DOMParser.parseFromString, which hand their input to the native parser
|
|
2455
|
+
// unsanitized and would otherwise mint a live, relocatable PI node that
|
|
2456
|
+
// sandboxed code can append to the live document to fire native XSLT.
|
|
2457
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2458
|
+
this.isXMLStylesheetProcessingInstructionAttack = input$LWS => hasXSLStylesheetProcessingInstruction$LWS(normalizeInput$LWS(input$LWS));
|
|
2302
2459
|
// Detects the iframe+srcdoc substring combination in raw input.
|
|
2303
2460
|
// Any HTML or XML containing both <iframe> and the substring
|
|
2304
2461
|
// 'srcdoc' is considered hostile, regardless of where the
|
|
@@ -2428,11 +2585,35 @@
|
|
|
2428
2585
|
if (!hasTag$LWS(normalizedInput$LWS, 'script')) {
|
|
2429
2586
|
return false;
|
|
2430
2587
|
}
|
|
2431
|
-
//
|
|
2432
|
-
//
|
|
2433
|
-
//
|
|
2434
|
-
//
|
|
2435
|
-
//
|
|
2588
|
+
// changesSince.266 (W-23657409): decide the HTML-vs-XML divergence by
|
|
2589
|
+
// parsing into the inert <template>, never the live shared <div>. This is
|
|
2590
|
+
// the same shared-realm-upgrade hazard the changesSince.266 fix above
|
|
2591
|
+
// closed for isIframeSrcdocScriptAttack (W-23595929): setting innerHTML on
|
|
2592
|
+
// the rootDocument-owned <div> runs the HTML fragment parser in the shared
|
|
2593
|
+
// realm and upgrades any registered custom element the markup contains,
|
|
2594
|
+
// running a sandbox-defined constructor SYNCHRONOUSLY against a host-realm
|
|
2595
|
+
// element (its this.parentNode is the shared container, whose ownerDocument
|
|
2596
|
+
// and defaultView are the host document and window) — a full membrane
|
|
2597
|
+
// breach, and before this check even returns its verdict. This path is
|
|
2598
|
+
// reachable at the gate whenever the <script> is hidden in a raw-text /
|
|
2599
|
+
// RCDATA element (<textarea><script>...), because that shape makes
|
|
2600
|
+
// isIframeSrcdocScriptAttack return false and fall through to here. Template
|
|
2601
|
+
// contents are inert (no upgrade, no script execution, no resource loads)
|
|
2602
|
+
// and the HTML fragment parser's raw-text/RCDATA handling is identical, so
|
|
2603
|
+
// the <script>-survival verdict is unchanged. With the gate off the legacy
|
|
2604
|
+
// shared-container round-trip is preserved.
|
|
2605
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
2606
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, [normalizedInput$LWS]);
|
|
2607
|
+
const templateInnerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedTemplate$LWS, []);
|
|
2608
|
+
// Release the parsed nodes so nothing lingers on the shared template
|
|
2609
|
+
// between calls.
|
|
2610
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, ['']);
|
|
2611
|
+
return !hasTag$LWS(templateInnerHTML$LWS, 'script');
|
|
2612
|
+
}
|
|
2613
|
+
// Legacy (gate off): round-trip through the shared live container. If the
|
|
2614
|
+
// <script> survives as a live tag it is caught by isIframeSrcdocScriptAttack;
|
|
2615
|
+
// if it vanished, the HTML parser absorbed it into a raw-text / RCDATA
|
|
2616
|
+
// element where the XML parser would not.
|
|
2436
2617
|
const {
|
|
2437
2618
|
innerHTML: innerHTML$LWS
|
|
2438
2619
|
} = htmlParserRoundTrip$LWS(normalizedInput$LWS);
|
|
@@ -2605,13 +2786,18 @@
|
|
|
2605
2786
|
const DOMTokenListProtoLengthGetter$LWS = ObjectLookupOwnGetter$LWS$1(DOMTokenListProto$LWS, 'length');
|
|
2606
2787
|
const DOMTokenListProtoValueGetter$LWS = ObjectLookupOwnGetter$LWS$1(DOMTokenListProto$LWS, 'value');
|
|
2607
2788
|
const DOMTokenListProtoValueSetter$LWS = ObjectLookupOwnSetter$LWS(DOMTokenListProto$LWS, 'value');
|
|
2789
|
+
const CustomEventCtor$LWS = CustomEvent;
|
|
2608
2790
|
const EventCtor$LWS = Event;
|
|
2791
|
+
const {
|
|
2792
|
+
prototype: CustomEventProto$LWS
|
|
2793
|
+
} = CustomEventCtor$LWS;
|
|
2609
2794
|
const {
|
|
2610
2795
|
prototype: EventProto$LWS
|
|
2611
2796
|
} = EventCtor$LWS;
|
|
2612
2797
|
const {
|
|
2613
2798
|
stopPropagation: EventProtoStopPropagation$LWS
|
|
2614
2799
|
} = EventProto$LWS;
|
|
2800
|
+
const CustomEventProtoDetailGetter$LWS = ObjectLookupOwnGetter$LWS$1(CustomEventProto$LWS, 'detail');
|
|
2615
2801
|
const EventProtoCurrentTargetGetter$LWS = ObjectLookupOwnGetter$LWS$1(EventProto$LWS, 'currentTarget');
|
|
2616
2802
|
const EventProtoTypeGetter$LWS = ObjectLookupOwnGetter$LWS$1(EventProto$LWS, 'type');
|
|
2617
2803
|
const {
|
|
@@ -2933,7 +3119,7 @@
|
|
|
2933
3119
|
const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
|
|
2934
3120
|
const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
|
|
2935
3121
|
ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
|
|
2936
|
-
/*! version: 0.29.
|
|
3122
|
+
/*! version: 0.29.2 */
|
|
2937
3123
|
|
|
2938
3124
|
/*!
|
|
2939
3125
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -3149,7 +3335,7 @@
|
|
|
3149
3335
|
}
|
|
3150
3336
|
return sanitized$LWS;
|
|
3151
3337
|
}
|
|
3152
|
-
/*! version: 0.29.
|
|
3338
|
+
/*! version: 0.29.2 */
|
|
3153
3339
|
|
|
3154
3340
|
/*!
|
|
3155
3341
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -3225,7 +3411,7 @@
|
|
|
3225
3411
|
// swallow
|
|
3226
3412
|
}
|
|
3227
3413
|
const trusted = createPolicy('trusted', policyOptions);
|
|
3228
|
-
/*! version: 0.29.
|
|
3414
|
+
/*! version: 0.29.2 */
|
|
3229
3415
|
|
|
3230
3416
|
/*!
|
|
3231
3417
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -3534,7 +3720,7 @@
|
|
|
3534
3720
|
}
|
|
3535
3721
|
return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
|
|
3536
3722
|
}
|
|
3537
|
-
/*! version: 0.29.
|
|
3723
|
+
/*! version: 0.29.2 */
|
|
3538
3724
|
|
|
3539
3725
|
/*!
|
|
3540
3726
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -3811,7 +3997,7 @@
|
|
|
3811
3997
|
ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
|
|
3812
3998
|
};
|
|
3813
3999
|
}
|
|
3814
|
-
/*! version: 0.29.
|
|
4000
|
+
/*! version: 0.29.2 */
|
|
3815
4001
|
|
|
3816
4002
|
/*!
|
|
3817
4003
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -6199,7 +6385,8 @@
|
|
|
6199
6385
|
const {
|
|
6200
6386
|
isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
|
|
6201
6387
|
isXMLEntityAttack: isXMLEntityAttack$LWS,
|
|
6202
|
-
isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
|
|
6388
|
+
isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS,
|
|
6389
|
+
isXMLStylesheetProcessingInstructionAttack: isXMLStylesheetProcessingInstructionAttack$LWS
|
|
6203
6390
|
} = getValidator$LWS(document$LWS, globalObject$LWS);
|
|
6204
6391
|
// DOMParser.prototype.parseFromString can only be called with
|
|
6205
6392
|
// exactly two arguments. If it receives one argument, it will fail.
|
|
@@ -6236,6 +6423,22 @@
|
|
|
6236
6423
|
throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
|
|
6237
6424
|
}
|
|
6238
6425
|
}
|
|
6426
|
+
// changesSince.266 (W-23657156): reject an XSLT `xml-stylesheet`
|
|
6427
|
+
// processing instruction in any XML-family input. Generic XML is
|
|
6428
|
+
// handed to the native parser unsanitized, so the PI survives as a
|
|
6429
|
+
// live ProcessingInstruction node; sandboxed code reads it out of
|
|
6430
|
+
// this (context-less, inert) document and appends it to the LIVE
|
|
6431
|
+
// document. Node.prototype.appendChild is not distorted and the PI
|
|
6432
|
+
// lands on the Document node — which isSharedElement does not cover
|
|
6433
|
+
// — so the insertion is unguarded, and Chromium then fires native
|
|
6434
|
+
// XSLT: it fetches the attacker stylesheet and commits a transform
|
|
6435
|
+
// whose output script runs in the host realm, outside the sandbox.
|
|
6436
|
+
// SVG is included alongside XML/XHTML because it is XML-parsed and
|
|
6437
|
+
// can carry the same document-level PI. Rejecting at the parse
|
|
6438
|
+
// source prevents the PI node from ever existing.
|
|
6439
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && (contentType$LWS === ContentType$LWS.XML || contentType$LWS === ContentType$LWS.XHTML || contentType$LWS === ContentType$LWS.SVG) && isXMLStylesheetProcessingInstructionAttack$LWS(string$LWS)) {
|
|
6440
|
+
throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
|
|
6441
|
+
}
|
|
6239
6442
|
// This must be called to signal to the virtual
|
|
6240
6443
|
// CustomElementRegistry that the next thing created
|
|
6241
6444
|
// MAY CONTAIN a custom element, which must be marked for
|
|
@@ -7713,11 +7916,48 @@
|
|
|
7713
7916
|
return [originalAddEventListener$LWS, addEventListener$LWS];
|
|
7714
7917
|
};
|
|
7715
7918
|
}
|
|
7716
|
-
|
|
7919
|
+
const DISPATCH_DETAIL_REFERENCE_METRIC$LWS = 'lws.dispatchEvent.detailReference';
|
|
7920
|
+
const DISPATCH_TOTAL_METRIC$LWS = 'lws.dispatchEvent.total';
|
|
7717
7921
|
// @W-18977628 — Reserved event types that sandboxed code must never dispatch.
|
|
7718
7922
|
// These are internal Aura framework events whose listeners run outside the
|
|
7719
7923
|
// sandbox and pass privileged unsandboxed references to the caller.
|
|
7720
7924
|
const BLOCKED_DISPATCH_EVENT_TYPES$LWS = toSafeSet$LWS(new SetCtor$LWS$1(['aurainteropfindowner']));
|
|
7925
|
+
function isDomElementOrFunction$LWS(value$LWS) {
|
|
7926
|
+
return typeof value$LWS === 'function' || isElement$LWS(value$LWS);
|
|
7927
|
+
}
|
|
7928
|
+
function detailContainsReference$LWS(detail$LWS) {
|
|
7929
|
+
if (isDomElementOrFunction$LWS(detail$LWS)) {
|
|
7930
|
+
return true;
|
|
7931
|
+
}
|
|
7932
|
+
if (isObject$LWS$1(detail$LWS)) {
|
|
7933
|
+
const keys$LWS = ObjectKeys$LWS$1(detail$LWS);
|
|
7934
|
+
for (let i$LWS = 0, {
|
|
7935
|
+
length: length$LWS
|
|
7936
|
+
} = keys$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
7937
|
+
if (isDomElementOrFunction$LWS(detail$LWS[keys$LWS[i$LWS]])) {
|
|
7938
|
+
return true;
|
|
7939
|
+
}
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
return false;
|
|
7943
|
+
}
|
|
7944
|
+
function recordDispatchEventMetrics$LWS(instrumentation$LWS, event$LWS) {
|
|
7945
|
+
if (typeof (instrumentation$LWS == null ? void 0 : instrumentation$LWS.incrementCounter) !== 'function') {
|
|
7946
|
+
return;
|
|
7947
|
+
}
|
|
7948
|
+
// Denominator: every gated dispatch, so detailReference can be read as a rate.
|
|
7949
|
+
instrumentation$LWS.incrementCounter(DISPATCH_TOTAL_METRIC$LWS, 1, false);
|
|
7950
|
+
let hasReference$LWS = false;
|
|
7951
|
+
try {
|
|
7952
|
+
// The detail getter throws on a non-CustomEvent event; hostile detail can too.
|
|
7953
|
+
hasReference$LWS = detailContainsReference$LWS(ReflectApply$LWS$1(CustomEventProtoDetailGetter$LWS, event$LWS, []));
|
|
7954
|
+
} catch (_unused3$LWS) {
|
|
7955
|
+
return;
|
|
7956
|
+
}
|
|
7957
|
+
if (hasReference$LWS) {
|
|
7958
|
+
instrumentation$LWS.incrementCounter(DISPATCH_DETAIL_REFERENCE_METRIC$LWS, 1, false);
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7721
7961
|
function initDistortionEventTargetDispatchEvent$LWS({
|
|
7722
7962
|
globalObject: {
|
|
7723
7963
|
EventTarget: {
|
|
@@ -7727,7 +7967,12 @@
|
|
|
7727
7967
|
}
|
|
7728
7968
|
}
|
|
7729
7969
|
}) {
|
|
7730
|
-
|
|
7970
|
+
// Read `instrumentation` from the inner factory's record, not this
|
|
7971
|
+
// initializer's: the initializer result is memoized per document and shared
|
|
7972
|
+
// across sandboxes, so capturing it here would freeze to the first sandbox.
|
|
7973
|
+
return function distortionEventTargetDispatchEvent$LWS({
|
|
7974
|
+
instrumentation: instrumentation$LWS
|
|
7975
|
+
}) {
|
|
7731
7976
|
function dispatchEvent$LWS(...args$LWS) {
|
|
7732
7977
|
const {
|
|
7733
7978
|
length: length$LWS
|
|
@@ -7741,12 +7986,41 @@
|
|
|
7741
7986
|
throw new LockerSecurityError$LWS(`Cannot dispatch '${eventType$LWS}' event.`);
|
|
7742
7987
|
}
|
|
7743
7988
|
}
|
|
7989
|
+
if (length$LWS > 0 && isGaterEnabledFeature$LWS(COUNT_DISPATCH_EVENT_DETAIL_REFERENCES_GATE$LWS)) {
|
|
7990
|
+
recordDispatchEventMetrics$LWS(instrumentation$LWS, args$LWS[0]);
|
|
7991
|
+
}
|
|
7744
7992
|
return ReflectApply$LWS$1(originalDispatchEvent$LWS, this, args$LWS);
|
|
7745
7993
|
}
|
|
7746
7994
|
return [originalDispatchEvent$LWS, dispatchEvent$LWS];
|
|
7747
7995
|
};
|
|
7748
7996
|
}
|
|
7749
7997
|
|
|
7998
|
+
// W-23969898: caches the structural "is this a distortable iframe contentWindow
|
|
7999
|
+
// realm" determination per globalObject. The globalObject key here is the
|
|
8000
|
+
// frame's WindowProxy, whose object identity is STABLE across a same-origin
|
|
8001
|
+
// navigation (createSecondaryWindowSandboxRecord runs once for the initial
|
|
8002
|
+
// about:blank realm and again, with the SAME globalObject reference, from the
|
|
8003
|
+
// frame's `load` listener after a navigation). See the caching rationale on
|
|
8004
|
+
// getDistortableFrameElement below.
|
|
8005
|
+
//
|
|
8006
|
+
// This cache is ONE of TWO co-dependent halves of the W-23969898 fix; neither
|
|
8007
|
+
// closes the leak alone (empirically: reverting either half reopens it):
|
|
8008
|
+
// 1. Record-build resilience on a torn-down realm (@locker/sandbox
|
|
8009
|
+
// util/distortion.ts, getDistortionFactories / createDistortionEntries).
|
|
8010
|
+
// A frame the component has already detached leaves its child window with
|
|
8011
|
+
// JS intrinsics intact but DOM globals stripped; a full distortion build
|
|
8012
|
+
// touches an absent DOM interface and throws, collapsing the whole record
|
|
8013
|
+
// to a containment-free opaque one — so the cross-realm family is never
|
|
8014
|
+
// even REACHED. That fix builds only the intrinsic-only distortions on
|
|
8015
|
+
// such a realm, so the family factories below actually run.
|
|
8016
|
+
// 2. This cache. Once the family factory runs, its getDistortableFrameElement
|
|
8017
|
+
// gate still does a LIVE frameElement read (below) that a detached frame
|
|
8018
|
+
// answers null — so without the cached first-sight verdict the factory
|
|
8019
|
+
// installs no entry and the realm's raw Reflect.get still leaks. The cache
|
|
8020
|
+
// supplies the truthy structural verdict recorded while the frame was
|
|
8021
|
+
// still attached.
|
|
8022
|
+
// Half 1 lets the family be reached; half 2 lets it install. Both are required.
|
|
8023
|
+
const distortableFrameElementByGlobalObject$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
7750
8024
|
// W-22602807: shared helper for distorting an iframe contentWindow realm's
|
|
7751
8025
|
// function-invocation primitives (Function.prototype.call/apply/bind,
|
|
7752
8026
|
// Reflect.apply/construct) and, as of W-23748562, its CAPTURE primitives
|
|
@@ -7778,18 +8052,60 @@
|
|
|
7778
8052
|
// changesSince.264: when the gate is off, no entry is installed and the
|
|
7779
8053
|
// primitive keeps its native behavior. One check here covers every
|
|
7780
8054
|
// invocation- and capture-primitive distortion in this family.
|
|
8055
|
+
//
|
|
8056
|
+
// CALLERS MUST capture their native primitive AFTER this returns truthy, inside
|
|
8057
|
+
// the distortion factory — never in the outer initializer's parameter
|
|
8058
|
+
// destructure. The initializer runs for every record built, including a
|
|
8059
|
+
// transitional secondary-window realm (e.g. a still-materializing
|
|
8060
|
+
// window.open()'d same-origin window) whose intrinsics are momentarily
|
|
8061
|
+
// undefined; an eager outer read dereferences them before this gate can bail
|
|
8062
|
+
// and throws (W-24222894).
|
|
8063
|
+
//
|
|
8064
|
+
// W-23969898 (changesSince.266): the "is a distortable iframe realm" verdict is
|
|
8065
|
+
// a PERMANENT structural fact, but this used to re-derive it from a LIVE
|
|
8066
|
+
// `frameElement` read on every call. Each cross-realm distortion factory runs
|
|
8067
|
+
// this at record-build time and installs no entry when it returns falsy, and
|
|
8068
|
+
// the post-navigation record is cached per document — so a single falsy read at
|
|
8069
|
+
// rebuild time skips the family PERMANENTLY for that realm. A component can
|
|
8070
|
+
// force exactly that: it registers its own capture-phase `load` listener BEFORE
|
|
8071
|
+
// reading `contentWindow` (LWS only attaches its own listener at that read, so
|
|
8072
|
+
// it runs SECOND) and detaches the frame from its listener; when LWS's listener
|
|
8073
|
+
// then rebuilds the record, the live `frameElement` read is null, the family is
|
|
8074
|
+
// skipped, and the realm's undistorted `Reflect.get` leaks the host
|
|
8075
|
+
// `document.cookie`. Caching the determination the first time the realm is seen
|
|
8076
|
+
// ATTACHED removes THIS half of the timing dependency: once a factory runs, a
|
|
8077
|
+
// later detach can no longer erase a truthy verdict already recorded. A
|
|
8078
|
+
// window.open() popup never reads a truthy frameElement even on first sight, so
|
|
8079
|
+
// first-sight truthiness still discriminates iframe realms from popup realms.
|
|
8080
|
+
//
|
|
8081
|
+
// The cache only matters AFTER a factory actually runs, though. On a
|
|
8082
|
+
// component-detached frame the record build itself throws before reaching this
|
|
8083
|
+
// family unless the build is made resilient to a torn-down realm — see the
|
|
8084
|
+
// two-halves note on the WeakMap declaration above. This half installs the
|
|
8085
|
+
// entry; the resilience half lets this half be reached.
|
|
7781
8086
|
function getDistortableFrameElement$LWS(globalObject$LWS) {
|
|
7782
8087
|
if (!isGaterEnabledFeature$LWS('changesSince.264')) {
|
|
7783
8088
|
return undefined;
|
|
7784
8089
|
}
|
|
8090
|
+
const cacheStructuralDetermination$LWS = isGaterEnabledFeature$LWS('changesSince.266');
|
|
8091
|
+
if (cacheStructuralDetermination$LWS) {
|
|
8092
|
+
const cached$LWS = distortableFrameElementByGlobalObject$LWS.get(globalObject$LWS);
|
|
8093
|
+
if (cached$LWS !== undefined) {
|
|
8094
|
+
return cached$LWS;
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
7785
8097
|
let frameElement$LWS;
|
|
7786
8098
|
try {
|
|
7787
8099
|
frameElement$LWS = ReflectApply$LWS$1(WindowFrameElementGetter$LWS, globalObject$LWS, []);
|
|
7788
|
-
} catch (
|
|
8100
|
+
} catch (_unused4$LWS) {
|
|
7789
8101
|
// Cross-origin / non-window realm: not our target.
|
|
7790
8102
|
return undefined;
|
|
7791
8103
|
}
|
|
7792
|
-
|
|
8104
|
+
const distortableFrameElement$LWS = frameElement$LWS || undefined;
|
|
8105
|
+
if (cacheStructuralDetermination$LWS && distortableFrameElement$LWS !== undefined) {
|
|
8106
|
+
distortableFrameElementByGlobalObject$LWS.set(globalObject$LWS, distortableFrameElement$LWS);
|
|
8107
|
+
}
|
|
8108
|
+
return distortableFrameElement$LWS;
|
|
7793
8109
|
}
|
|
7794
8110
|
// Re-resolve `callee` to its distorted counterpart from the root distortion
|
|
7795
8111
|
// map, if one exists; otherwise return it unchanged.
|
|
@@ -7819,18 +8135,61 @@
|
|
|
7819
8135
|
}
|
|
7820
8136
|
return callee$LWS;
|
|
7821
8137
|
}
|
|
8138
|
+
// The exotic-object internal-method (trap) names a Proxy handler may carry, per
|
|
8139
|
+
// ECMAScript 9.5. The foreign engine invokes these directly when an operation
|
|
8140
|
+
// is performed on the resulting proxy.
|
|
8141
|
+
const PROXY_TRAP_NAMES$LWS = ['apply', 'construct', 'defineProperty', 'deleteProperty', 'get', 'getOwnPropertyDescriptor', 'getPrototypeOf', 'has', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf'];
|
|
8142
|
+
// W-24124284: substitute the trap functions on a Proxy handler the same way
|
|
8143
|
+
// substituteDistortedCallee substitutes the target. A capture primitive
|
|
8144
|
+
// (Proxy / Proxy.revocable) re-resolves only its TARGET; the handler crosses
|
|
8145
|
+
// into the native primitive untouched, so a raw cross-realm callable smuggled
|
|
8146
|
+
// as a trap (e.g. `{ getPrototypeOf: Function }`) is later invoked by the
|
|
8147
|
+
// foreign engine UNDISTORTED — it compiles `document.cookie` against the
|
|
8148
|
+
// undistorted document and leaks the top-level jar, exactly the raw-callee
|
|
8149
|
+
// leak substituteDistortedCallee closes for the target. Re-resolving each trap
|
|
8150
|
+
// at capture time re-attaches the distortion the engine's internal trap
|
|
8151
|
+
// dispatch would otherwise bypass (there is no JS-observable interception point
|
|
8152
|
+
// for a native [[Call]] on a handler trap).
|
|
8153
|
+
//
|
|
8154
|
+
// Only an OWN trap the handler actually carries is mirrored onto the fresh
|
|
8155
|
+
// handler. ObjectHasOwn is a frozen intrinsic own-property check: unlike
|
|
8156
|
+
// handler.hasOwnProperty(...) it cannot be spoofed by an attacker-controlled
|
|
8157
|
+
// handler (e.g. `{ hasOwnProperty: () => false, getPrototypeOf: rawFn }`), and
|
|
8158
|
+
// unlike a bare `in` it does not walk the prototype. Prototype-walking would be
|
|
8159
|
+
// actively wrong here: a FUNCTION is a valid Proxy handler and inherits
|
|
8160
|
+
// apply/call/bind from Function.prototype, so `'apply' in handler` would be
|
|
8161
|
+
// true and Function.prototype.apply would be mis-captured as an apply trap. A
|
|
8162
|
+
// trap the caller never defined stays absent, so the proxy keeps its default
|
|
8163
|
+
// forward-to-target behavior for that operation rather than being handed a
|
|
8164
|
+
// spurious `undefined` own property. An inherited trap is likewise not copied:
|
|
8165
|
+
// the proxy then default-forwards that operation instead of invoking a possibly
|
|
8166
|
+
// raw inherited callable -- a fail-closed divergence from the engine's
|
|
8167
|
+
// prototype-inclusive GetMethod dispatch, never a leak.
|
|
8168
|
+
//
|
|
8169
|
+
// Each present trap is read ONCE and snapshotted; besides closing the
|
|
8170
|
+
// substitution gap this removes any get-trap TOCTOU where a handler could hand
|
|
8171
|
+
// the substitution a benign trap and the engine a raw one on a later read. A
|
|
8172
|
+
// non-object/non-function handler is returned unchanged so the native primitive
|
|
8173
|
+
// throws its own TypeError for an invalid handler.
|
|
8174
|
+
function substituteDistortedHandler$LWS(root$LWS, handler$LWS) {
|
|
8175
|
+
if (handler$LWS === null || typeof handler$LWS !== 'object' && typeof handler$LWS !== 'function') {
|
|
8176
|
+
return handler$LWS;
|
|
8177
|
+
}
|
|
8178
|
+
const substituted$LWS = {};
|
|
8179
|
+
for (let i$LWS = 0, {
|
|
8180
|
+
length: length$LWS
|
|
8181
|
+
} = PROXY_TRAP_NAMES$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
8182
|
+
const name$LWS = PROXY_TRAP_NAMES$LWS[i$LWS];
|
|
8183
|
+
if (ObjectHasOwn$LWS$1(handler$LWS, name$LWS)) {
|
|
8184
|
+
substituted$LWS[name$LWS] = substituteDistortedCallee$LWS(root$LWS, handler$LWS[name$LWS]);
|
|
8185
|
+
}
|
|
8186
|
+
}
|
|
8187
|
+
return substituted$LWS;
|
|
8188
|
+
}
|
|
7822
8189
|
|
|
7823
8190
|
// W-22602807: distort an iframe contentWindow realm's Function.prototype.apply.
|
|
7824
8191
|
// See cross-realm-invocation.ts for the threat model.
|
|
7825
|
-
function initDistortionFunctionApply$LWS({
|
|
7826
|
-
globalObject: {
|
|
7827
|
-
Function: {
|
|
7828
|
-
prototype: {
|
|
7829
|
-
apply: originalApply$LWS
|
|
7830
|
-
}
|
|
7831
|
-
}
|
|
7832
|
-
}
|
|
7833
|
-
}) {
|
|
8192
|
+
function initDistortionFunctionApply$LWS() {
|
|
7834
8193
|
return function distortionFunctionApply$LWS({
|
|
7835
8194
|
globalObject: globalObject$LWS,
|
|
7836
8195
|
root: root$LWS
|
|
@@ -7838,6 +8197,14 @@
|
|
|
7838
8197
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
7839
8198
|
return undefined;
|
|
7840
8199
|
}
|
|
8200
|
+
// W-24222894: read the primitive AFTER the gate — never in the outer
|
|
8201
|
+
// initializer's parameter. The initializer runs for EVERY record built,
|
|
8202
|
+
// including a transitional secondary-window realm (e.g. a freshly
|
|
8203
|
+
// window.open()'d same-origin window still materializing) whose
|
|
8204
|
+
// Function.prototype is momentarily undefined; an eager outer read
|
|
8205
|
+
// dereferences it before this gate can bail and throws. See
|
|
8206
|
+
// cross-realm-invocation.ts.
|
|
8207
|
+
const originalApply$LWS = globalObject$LWS.Function.prototype.apply;
|
|
7841
8208
|
return [originalApply$LWS,
|
|
7842
8209
|
// `this` is the callee; (thisArg, argsArray) its binding and args.
|
|
7843
8210
|
// `apply` accepts a null/undefined argsArray, which ReflectApply
|
|
@@ -7854,15 +8221,7 @@
|
|
|
7854
8221
|
// bind defers invocation: it returns a bound function invoked later. We
|
|
7855
8222
|
// substitute the callee for its distorted counterpart FIRST, then bind that,
|
|
7856
8223
|
// so the returned bound function wraps the sandbox-distorted callee.
|
|
7857
|
-
function initDistortionFunctionBind$LWS({
|
|
7858
|
-
globalObject: {
|
|
7859
|
-
Function: {
|
|
7860
|
-
prototype: {
|
|
7861
|
-
bind: originalBind$LWS
|
|
7862
|
-
}
|
|
7863
|
-
}
|
|
7864
|
-
}
|
|
7865
|
-
}) {
|
|
8224
|
+
function initDistortionFunctionBind$LWS() {
|
|
7866
8225
|
return function distortionFunctionBind$LWS({
|
|
7867
8226
|
globalObject: globalObject$LWS,
|
|
7868
8227
|
root: root$LWS
|
|
@@ -7870,6 +8229,10 @@
|
|
|
7870
8229
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
7871
8230
|
return undefined;
|
|
7872
8231
|
}
|
|
8232
|
+
// W-24222894: read the primitive AFTER the gate. See apply-value.ts and
|
|
8233
|
+
// cross-realm-invocation.ts for why an eager outer-parameter read
|
|
8234
|
+
// crashes on a transitional secondary-window realm.
|
|
8235
|
+
const originalBind$LWS = globalObject$LWS.Function.prototype.bind;
|
|
7873
8236
|
return [originalBind$LWS,
|
|
7874
8237
|
// `this` is the callee; (thisArg, ...boundArgs) the binding and
|
|
7875
8238
|
// partially-applied args. Bind the substituted callee with the
|
|
@@ -7882,15 +8245,7 @@
|
|
|
7882
8245
|
|
|
7883
8246
|
// W-22602807: distort an iframe contentWindow realm's Function.prototype.call.
|
|
7884
8247
|
// See cross-realm-invocation.ts for the threat model.
|
|
7885
|
-
function initDistortionFunctionCall$LWS({
|
|
7886
|
-
globalObject: {
|
|
7887
|
-
Function: {
|
|
7888
|
-
prototype: {
|
|
7889
|
-
call: originalCall$LWS
|
|
7890
|
-
}
|
|
7891
|
-
}
|
|
7892
|
-
}
|
|
7893
|
-
}) {
|
|
8248
|
+
function initDistortionFunctionCall$LWS() {
|
|
7894
8249
|
return function distortionFunctionCall$LWS({
|
|
7895
8250
|
globalObject: globalObject$LWS,
|
|
7896
8251
|
root: root$LWS
|
|
@@ -7898,6 +8253,10 @@
|
|
|
7898
8253
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
7899
8254
|
return undefined;
|
|
7900
8255
|
}
|
|
8256
|
+
// W-24222894: read the primitive AFTER the gate. See apply-value.ts and
|
|
8257
|
+
// cross-realm-invocation.ts for why an eager outer-parameter read
|
|
8258
|
+
// crashes on a transitional secondary-window realm.
|
|
8259
|
+
const originalCall$LWS = globalObject$LWS.Function.prototype.call;
|
|
7901
8260
|
return [originalCall$LWS,
|
|
7902
8261
|
// `this` is the callee; (thisArg, ...args) its binding and arguments.
|
|
7903
8262
|
function call$LWS(thisArg$LWS, ...args$LWS) {
|
|
@@ -7948,6 +8307,46 @@
|
|
|
7948
8307
|
}];
|
|
7949
8308
|
};
|
|
7950
8309
|
}
|
|
8310
|
+
|
|
8311
|
+
// Shared endpoint enforcement for the History URL-mutating methods
|
|
8312
|
+
// (`pushState` / `replaceState`). Their optional third argument is the new
|
|
8313
|
+
// history URL; when present and non-empty, validate its resolved destination
|
|
8314
|
+
// against the endpoint denylist so sandboxed code cannot repoint the shared
|
|
8315
|
+
// main-window document at a platform-internal endpoint. An omitted, `null` /
|
|
8316
|
+
// `undefined`, or empty URL leaves the document address unchanged, so it is
|
|
8317
|
+
// delegated untouched and the common state-only usage is preserved.
|
|
8318
|
+
function assertHistoryURLAllowed$LWS(args$LWS) {
|
|
8319
|
+
if (args$LWS.length > 2) {
|
|
8320
|
+
const {
|
|
8321
|
+
2: url$LWS
|
|
8322
|
+
} = args$LWS;
|
|
8323
|
+
// An explicit `null` / `undefined` third argument is the spec's "leave the
|
|
8324
|
+
// document address unchanged" signal (equivalent to omitting it). Delegate
|
|
8325
|
+
// it untouched: coercing it would yield the literal string `"null"` /
|
|
8326
|
+
// `"undefined"`, pin that back below, and dispatch an unintended
|
|
8327
|
+
// same-origin navigation to `/null` or `/undefined`. Mirrors
|
|
8328
|
+
// `Window/fetch-value.ts`'s null/undefined guard. This branches on the raw
|
|
8329
|
+
// argument identity (never a coercion), so a shape-shifting object — which
|
|
8330
|
+
// is neither `null` nor `undefined` — still flows through the pinning path.
|
|
8331
|
+
if (url$LWS !== null && url$LWS !== undefined) {
|
|
8332
|
+
const urlString$LWS = toSafeStringValue$LWS(url$LWS);
|
|
8333
|
+
// Pin the coerced primitive back into the argument list before the
|
|
8334
|
+
// native `pushState` / `replaceState` runs. Otherwise the browser's own
|
|
8335
|
+
// WebIDL coercion re-invokes a shape-shifting argument's `toString`,
|
|
8336
|
+
// letting it hand the guard an allowed URL and the platform a denylisted
|
|
8337
|
+
// one (TOCTOU). Writing unconditionally also closes the empty-string
|
|
8338
|
+
// variant, where the first coercion yields '' (skipping validation) and
|
|
8339
|
+
// the second yields a denylisted URL.
|
|
8340
|
+
args$LWS[2] = urlString$LWS;
|
|
8341
|
+
if (urlString$LWS !== '') {
|
|
8342
|
+
const parsedURL$LWS = parseURL$LWS(urlString$LWS);
|
|
8343
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
8344
|
+
throw new LockerSecurityError$LWS(`Cannot set history URL to disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8349
|
+
}
|
|
7951
8350
|
function initDistortionHistoryPushState$LWS({
|
|
7952
8351
|
globalObject: {
|
|
7953
8352
|
DOMException: DOMException$LWS,
|
|
@@ -7959,6 +8358,9 @@
|
|
|
7959
8358
|
}
|
|
7960
8359
|
}) {
|
|
7961
8360
|
const distortionEntry$LWS = [originalPushState$LWS, function pushState$LWS(...args$LWS) {
|
|
8361
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8362
|
+
assertHistoryURLAllowed$LWS(args$LWS);
|
|
8363
|
+
}
|
|
7962
8364
|
try {
|
|
7963
8365
|
return ReflectApply$LWS$1(originalPushState$LWS, this, args$LWS);
|
|
7964
8366
|
} catch (error) {
|
|
@@ -7987,6 +8389,9 @@
|
|
|
7987
8389
|
}
|
|
7988
8390
|
}) {
|
|
7989
8391
|
const distortionEntry$LWS = [originalReplaceState$LWS, function replaceState$LWS(...args$LWS) {
|
|
8392
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8393
|
+
assertHistoryURLAllowed$LWS(args$LWS);
|
|
8394
|
+
}
|
|
7990
8395
|
try {
|
|
7991
8396
|
return ReflectApply$LWS$1(originalReplaceState$LWS, this, args$LWS);
|
|
7992
8397
|
} catch (error) {
|
|
@@ -8331,6 +8736,76 @@
|
|
|
8331
8736
|
};
|
|
8332
8737
|
}
|
|
8333
8738
|
|
|
8739
|
+
// Shared validation for programmatic form submission (submit / requestSubmit).
|
|
8740
|
+
//
|
|
8741
|
+
// The `action` IDL getter resolves the form's effective submission destination:
|
|
8742
|
+
// per the HTML standard, when the `action` content attribute is missing or its
|
|
8743
|
+
// value is the empty string, the getter returns the element's node-document URL
|
|
8744
|
+
// rather than the empty string. Reading the resolved value through the native
|
|
8745
|
+
// getter therefore captures the actionless-form case (the current document URL)
|
|
8746
|
+
// that the `action` setter's empty-string passthrough leaves unvalidated.
|
|
8747
|
+
//
|
|
8748
|
+
// `requestSubmit(submitter)` can override the form's action: when the submitter
|
|
8749
|
+
// is a submit button carrying a `formaction` content attribute, the native
|
|
8750
|
+
// submission algorithm dispatches to *that* target instead of the form's
|
|
8751
|
+
// `action`. A submitter can acquire a denylisted `formaction` through a path the
|
|
8752
|
+
// `formAction` setter / `setAttribute` guards do not cover (e.g. HTML parsed via
|
|
8753
|
+
// `innerHTML`), so the submitter's effective target is resolved and validated
|
|
8754
|
+
// here whenever it supplies one, falling back to the form's action otherwise.
|
|
8755
|
+
// The `formaction` content attribute is read (rather than the `formAction` IDL
|
|
8756
|
+
// getter) so a missing attribute — meaning "no override" — is distinguishable
|
|
8757
|
+
// from an empty one; `parseURL` resolves a relative or empty value against the
|
|
8758
|
+
// document base, mirroring the native empty-`formaction`-to-document-URL rule.
|
|
8759
|
+
function assertFormSubmissionAllowed$LWS(form$LWS, submitter$LWS) {
|
|
8760
|
+
const submitterFormAction$LWS = submitter$LWS === undefined || submitter$LWS === null ? null : ReflectApply$LWS$1(ElementProtoGetAttribute$LWS, submitter$LWS, ['formaction']);
|
|
8761
|
+
const effectiveAction$LWS = submitterFormAction$LWS === null ? toSafeStringValue$LWS(ReflectApply$LWS$1(HTMLFormElementProtoActionGetter$LWS, form$LWS, [])) : toSafeStringValue$LWS(submitterFormAction$LWS);
|
|
8762
|
+
const parsedURL$LWS = parseURL$LWS(effectiveAction$LWS);
|
|
8763
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
8764
|
+
throw new LockerSecurityError$LWS(`Cannot submit form to disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
|
|
8765
|
+
}
|
|
8766
|
+
}
|
|
8767
|
+
function initDistortionHTMLFormElementRequestSubmit$LWS({
|
|
8768
|
+
globalObject: {
|
|
8769
|
+
HTMLFormElement: {
|
|
8770
|
+
prototype: {
|
|
8771
|
+
requestSubmit: originalRequestSubmit$LWS
|
|
8772
|
+
}
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8775
|
+
}) {
|
|
8776
|
+
const distortionEntry$LWS = [originalRequestSubmit$LWS, function requestSubmit$LWS(...args$LWS) {
|
|
8777
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8778
|
+
// The optional submitter's `formaction` overrides the form's
|
|
8779
|
+
// action at submission time, so validate the submitter's
|
|
8780
|
+
// effective target rather than only the form's `action`.
|
|
8781
|
+
assertFormSubmissionAllowed$LWS(this, args$LWS[0]);
|
|
8782
|
+
}
|
|
8783
|
+
return ReflectApply$LWS$1(originalRequestSubmit$LWS, this, args$LWS);
|
|
8784
|
+
}];
|
|
8785
|
+
return function distortionHTMLFormElementRequestSubmit$LWS() {
|
|
8786
|
+
return distortionEntry$LWS;
|
|
8787
|
+
};
|
|
8788
|
+
}
|
|
8789
|
+
function initDistortionHTMLFormElementSubmit$LWS({
|
|
8790
|
+
globalObject: {
|
|
8791
|
+
HTMLFormElement: {
|
|
8792
|
+
prototype: {
|
|
8793
|
+
submit: originalSubmit$LWS
|
|
8794
|
+
}
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8797
|
+
}) {
|
|
8798
|
+
const distortionEntry$LWS = [originalSubmit$LWS, function submit$LWS(...args$LWS) {
|
|
8799
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8800
|
+
assertFormSubmissionAllowed$LWS(this);
|
|
8801
|
+
}
|
|
8802
|
+
return ReflectApply$LWS$1(originalSubmit$LWS, this, args$LWS);
|
|
8803
|
+
}];
|
|
8804
|
+
return function distortionHTMLFormElementSubmit$LWS() {
|
|
8805
|
+
return distortionEntry$LWS;
|
|
8806
|
+
};
|
|
8807
|
+
}
|
|
8808
|
+
|
|
8334
8809
|
// Per-frame bookkeeping for the HTMLFrameElement.src async pre-flight
|
|
8335
8810
|
const pendingURLs$1$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
8336
8811
|
const inflightControllers$1$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
@@ -8523,7 +8998,7 @@
|
|
|
8523
8998
|
let isSameOrigin$LWS = false;
|
|
8524
8999
|
try {
|
|
8525
9000
|
isSameOrigin$LWS = isSameOriginURL$LWS(urlString$LWS);
|
|
8526
|
-
} catch (
|
|
9001
|
+
} catch (_unused5$LWS) {
|
|
8527
9002
|
isSameOrigin$LWS = false;
|
|
8528
9003
|
}
|
|
8529
9004
|
if (urlString$LWS !== '' && urlString$LWS !== ABOUT_BLANK_TOKEN$1$LWS && isSameOrigin$LWS) {
|
|
@@ -8888,7 +9363,7 @@
|
|
|
8888
9363
|
if (!isSameOriginURL$LWS(srcValue$LWS)) {
|
|
8889
9364
|
return;
|
|
8890
9365
|
}
|
|
8891
|
-
} catch (
|
|
9366
|
+
} catch (_unused6$LWS) {
|
|
8892
9367
|
/* empty */
|
|
8893
9368
|
}
|
|
8894
9369
|
if (!ReflectApply$LWS$1(DOMTokenListProtoContains$LWS, sandboxTokenList$LWS, [ALLOW_SCRIPTS_TOKEN$LWS])) {
|
|
@@ -10477,6 +10952,49 @@
|
|
|
10477
10952
|
}];
|
|
10478
10953
|
};
|
|
10479
10954
|
}
|
|
10955
|
+
function initDistortionNavigationNavigate$LWS({
|
|
10956
|
+
globalObject: globalObject$LWS
|
|
10957
|
+
}) {
|
|
10958
|
+
var _Navigation$prototype$LWS;
|
|
10959
|
+
// The Navigation API is not exposed in every browser LWS supports, so it is
|
|
10960
|
+
// read defensively rather than destructured (a missing `Navigation` global
|
|
10961
|
+
// would throw at factory-initialization time and break sandbox creation).
|
|
10962
|
+
const {
|
|
10963
|
+
Navigation: Navigation$LWS
|
|
10964
|
+
} = globalObject$LWS;
|
|
10965
|
+
const originalNavigate$LWS = Navigation$LWS == null || (_Navigation$prototype$LWS = Navigation$LWS.prototype) == null ? void 0 : _Navigation$prototype$LWS.navigate;
|
|
10966
|
+
return function distortionNavigationNavigate$LWS() {
|
|
10967
|
+
// Nothing to distort when the Navigation API is unavailable.
|
|
10968
|
+
if (originalNavigate$LWS === undefined) {
|
|
10969
|
+
return undefined;
|
|
10970
|
+
}
|
|
10971
|
+
const distortionEntry$LWS = [originalNavigate$LWS, function navigate$LWS(...args$LWS) {
|
|
10972
|
+
// `navigate(url)` has a required `url` argument. A zero-argument
|
|
10973
|
+
// call must reach the native method untouched so it throws its own
|
|
10974
|
+
// WebIDL "1 argument required" `TypeError`. Coercing the missing
|
|
10975
|
+
// argument would synthesize the string `"undefined"`, pin it into a
|
|
10976
|
+
// now-length-1 argument list below, and either navigate to a URL the
|
|
10977
|
+
// caller never supplied or throw the wrong error type. (A present
|
|
10978
|
+
// `null` / `undefined` *value* is left to native, which coerces it
|
|
10979
|
+
// to `"null"` / `"undefined"` and navigates — the required-argument
|
|
10980
|
+
// contract only concerns the missing case.)
|
|
10981
|
+
if (args$LWS.length > 0 && isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10982
|
+
const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(args$LWS[0]));
|
|
10983
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
10984
|
+
throw new LockerSecurityError$LWS(`Cannot navigate to disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
|
|
10985
|
+
}
|
|
10986
|
+
// Pin the validated primitive so the native `navigate` cannot
|
|
10987
|
+
// re-run a shape-shifting argument's `toString` /
|
|
10988
|
+
// `Symbol.toPrimitive` and dispatch to a different (denylisted)
|
|
10989
|
+
// URL after the guard passed (TOCTOU). Mirrors `fetch`'s
|
|
10990
|
+
// `args[0] = url` arg-reassignment before dispatch.
|
|
10991
|
+
args$LWS[0] = parsedURL$LWS.normalizedURL;
|
|
10992
|
+
}
|
|
10993
|
+
return ReflectApply$LWS$1(originalNavigate$LWS, this, args$LWS);
|
|
10994
|
+
}];
|
|
10995
|
+
return distortionEntry$LWS;
|
|
10996
|
+
};
|
|
10997
|
+
}
|
|
10480
10998
|
function initDistortionNavigatorSendBeacon$LWS({
|
|
10481
10999
|
globalObject: {
|
|
10482
11000
|
Navigator: {
|
|
@@ -10515,6 +11033,95 @@
|
|
|
10515
11033
|
return distortionEntry$LWS;
|
|
10516
11034
|
};
|
|
10517
11035
|
}
|
|
11036
|
+
|
|
11037
|
+
// A genuine `<script>` reports `nodeName` "SCRIPT" (HTML) or "script" (SVG). The
|
|
11038
|
+
// value is read straight from the native `nodeName` accessor, so it is
|
|
11039
|
+
// unforgeable and cheap — used as a pre-filter before the brand-checking nonce
|
|
11040
|
+
// setter runs.
|
|
11041
|
+
const HTML_SCRIPT_NODE_NAME$LWS = 'SCRIPT';
|
|
11042
|
+
const SVG_SCRIPT_NODE_NAME$LWS = 'script';
|
|
11043
|
+
function initDistortionNodeCloneNode$LWS({
|
|
11044
|
+
globalObject: {
|
|
11045
|
+
Node: {
|
|
11046
|
+
prototype: {
|
|
11047
|
+
cloneNode: originalCloneNode$LWS
|
|
11048
|
+
}
|
|
11049
|
+
},
|
|
11050
|
+
HTMLElement: HTMLElement$LWS,
|
|
11051
|
+
SVGElement: SVGElement$LWS
|
|
11052
|
+
}
|
|
11053
|
+
}) {
|
|
11054
|
+
// The CSP `nonce` is exposed through the `nonce` IDL attribute, which comes
|
|
11055
|
+
// from the `HTMLOrSVGElement` WebIDL mixin. That mixin installs the accessor
|
|
11056
|
+
// as an OWN property of `HTMLElement.prototype` and `SVGElement.prototype`,
|
|
11057
|
+
// NOT of `HTMLScriptElement.prototype` (where it is merely inherited).
|
|
11058
|
+
// Capturing from the subclass prototype would yield `undefined` and turn this
|
|
11059
|
+
// distortion into a silent no-op, so the native setter is captured from the
|
|
11060
|
+
// mixin hosts. Applying that setter with '' is the only way to clear the
|
|
11061
|
+
// element's internal `[[CryptographicNonce]]` slot: the sandbox-facing
|
|
11062
|
+
// `.nonce` accessor is blocked (it throws) and therefore cannot clear it.
|
|
11063
|
+
const htmlNonceSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLElement$LWS.prototype, 'nonce');
|
|
11064
|
+
const svgNonceSetter$LWS = ObjectLookupOwnSetter$LWS(SVGElement$LWS.prototype, 'nonce');
|
|
11065
|
+
function clearScriptNonce$LWS(node$LWS) {
|
|
11066
|
+
// Try the HTML setter first (the common `<script>` case), then the SVG
|
|
11067
|
+
// setter. Each native setter brand-checks its receiver, so applying the
|
|
11068
|
+
// wrong one simply throws and is safely ignored.
|
|
11069
|
+
if (htmlNonceSetter$LWS !== undefined) {
|
|
11070
|
+
try {
|
|
11071
|
+
ReflectApply$LWS$1(htmlNonceSetter$LWS, node$LWS, ['']);
|
|
11072
|
+
return;
|
|
11073
|
+
} catch (_unused7$LWS) {
|
|
11074
|
+
// Not an HTMLElement; fall through to the SVG setter.
|
|
11075
|
+
}
|
|
11076
|
+
}
|
|
11077
|
+
if (svgNonceSetter$LWS !== undefined) {
|
|
11078
|
+
try {
|
|
11079
|
+
ReflectApply$LWS$1(svgNonceSetter$LWS, node$LWS, ['']);
|
|
11080
|
+
} catch (_unused8$LWS) {
|
|
11081
|
+
// Not an SVGElement either; there is no nonce slot to clear.
|
|
11082
|
+
}
|
|
11083
|
+
}
|
|
11084
|
+
}
|
|
11085
|
+
function stripClonedScriptNonces$LWS(root$LWS) {
|
|
11086
|
+
// Iterative depth-first walk of the freshly cloned subtree. A shallow
|
|
11087
|
+
// clone copies no children, so the stack drains after visiting the single
|
|
11088
|
+
// root — matching native `cloneNode(false)` cost. `getNodeName` is a cheap
|
|
11089
|
+
// native read used as a pre-filter so the brand-checking `try/catch` in
|
|
11090
|
+
// `clearScriptNonce` runs only for the rare `<script>` node, keeping the
|
|
11091
|
+
// LWC template-cloning hot path fast.
|
|
11092
|
+
const stack$LWS = [root$LWS];
|
|
11093
|
+
while (stack$LWS.length > 0) {
|
|
11094
|
+
const node$LWS = stack$LWS.pop();
|
|
11095
|
+
const nodeName$LWS = getNodeName$LWS(node$LWS);
|
|
11096
|
+
if (nodeName$LWS === HTML_SCRIPT_NODE_NAME$LWS || nodeName$LWS === SVG_SCRIPT_NODE_NAME$LWS) {
|
|
11097
|
+
clearScriptNonce$LWS(node$LWS);
|
|
11098
|
+
}
|
|
11099
|
+
const childNodes$LWS = ReflectApply$LWS$1(NodeProtoChildNodesGetter$LWS, node$LWS, []);
|
|
11100
|
+
for (let i$LWS = 0, {
|
|
11101
|
+
length: length$LWS
|
|
11102
|
+
} = childNodes$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
11103
|
+
stack$LWS[stack$LWS.length] = childNodes$LWS[i$LWS];
|
|
11104
|
+
}
|
|
11105
|
+
}
|
|
11106
|
+
}
|
|
11107
|
+
const distortionEntry$LWS = [originalCloneNode$LWS, function cloneNode$LWS(...args$LWS) {
|
|
11108
|
+
const result$LWS = ReflectApply$LWS$1(originalCloneNode$LWS, this, args$LWS);
|
|
11109
|
+
// W-23859662: Chromium's node-cloning steps copy a script element's
|
|
11110
|
+
// internal `[[CryptographicNonce]]` slot to the clone. That slot is
|
|
11111
|
+
// NOT a content attribute, so the sandbox's `.nonce` property/attribute
|
|
11112
|
+
// block never touches it — the clone would otherwise carry a CSP-valid
|
|
11113
|
+
// nonce the sandbox could never have produced, letting it run a forged
|
|
11114
|
+
// inline script natively in the host realm. Strip the nonce from every
|
|
11115
|
+
// cloned script element to close that bypass.
|
|
11116
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
11117
|
+
stripClonedScriptNonces$LWS(result$LWS);
|
|
11118
|
+
}
|
|
11119
|
+
return result$LWS;
|
|
11120
|
+
}];
|
|
11121
|
+
return function distortionNodeCloneNode$LWS() {
|
|
11122
|
+
return distortionEntry$LWS;
|
|
11123
|
+
};
|
|
11124
|
+
}
|
|
10518
11125
|
function initDistortionNodeGetRootNode$LWS({
|
|
10519
11126
|
globalObject: {
|
|
10520
11127
|
Node: Node$LWS,
|
|
@@ -11892,16 +12499,21 @@
|
|
|
11892
12499
|
// substitutes the callee before binding it. Returning an object from a
|
|
11893
12500
|
// constructor call short-circuits [[Construct]] (ECMAScript 10.2.2) so this
|
|
11894
12501
|
// behaves identically whether reached via `new`, Reflect.construct, or a
|
|
11895
|
-
// .call/.apply/.bind chain on the constructor itself.
|
|
12502
|
+
// .call/.apply/.bind chain on the constructor itself. (`new cw.Proxy(...)` is
|
|
12503
|
+
// separately contained by near-membrane's non-constructible arrow shadow; the
|
|
12504
|
+
// reachable doorway for this distortion is Reflect.construct(cw.Proxy, ...).)
|
|
12505
|
+
//
|
|
12506
|
+
// W-24124284: the HANDLER is substituted the same way (substituteDistorted
|
|
12507
|
+
// Handler). A raw callable smuggled as a handler trap (e.g.
|
|
12508
|
+
// `{ getPrototypeOf: Function }`) is otherwise invoked UNDISTORTED by the
|
|
12509
|
+
// engine's internal trap dispatch and leaks the raw document.cookie, exactly
|
|
12510
|
+
// as it does for Proxy.revocable (Proxy/revocable-value.ts) -- the target-only
|
|
12511
|
+
// substitution never covered it.
|
|
11896
12512
|
//
|
|
11897
12513
|
// Gated on changesSince.266: this is new distortion behavior, distinct from
|
|
11898
12514
|
// getDistortableFrameElement's own changesSince.264 gate on the underlying
|
|
11899
12515
|
// cross-realm scoping helper.
|
|
11900
|
-
function initDistortionProxyCtor$LWS({
|
|
11901
|
-
globalObject: {
|
|
11902
|
-
Proxy: originalProxyCtor$LWS
|
|
11903
|
-
}
|
|
11904
|
-
}) {
|
|
12516
|
+
function initDistortionProxyCtor$LWS() {
|
|
11905
12517
|
return function distortionProxyCtor$LWS({
|
|
11906
12518
|
globalObject: globalObject$LWS,
|
|
11907
12519
|
root: root$LWS
|
|
@@ -11909,8 +12521,15 @@
|
|
|
11909
12521
|
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11910
12522
|
return undefined;
|
|
11911
12523
|
}
|
|
12524
|
+
// W-24222894: read the primitive AFTER the gate, per the capture-after-
|
|
12525
|
+
// gate invariant in Function/cross-realm-invocation.ts. Unlike its
|
|
12526
|
+
// Proxy.revocable sibling's deeper read, this shallow `globalObject.Proxy`
|
|
12527
|
+
// read would not itself throw on a transitional secondary-window realm,
|
|
12528
|
+
// but keeping the read inside the gated factory holds every capture
|
|
12529
|
+
// primitive to one rule.
|
|
12530
|
+
const originalProxyCtor$LWS = globalObject$LWS.Proxy;
|
|
11912
12531
|
return [originalProxyCtor$LWS, function Proxy$LWS(target$LWS, handler$LWS) {
|
|
11913
|
-
return new ProxyCtor$LWS(substituteDistortedCallee$LWS(root$LWS, target$LWS), handler$LWS);
|
|
12532
|
+
return new ProxyCtor$LWS(substituteDistortedCallee$LWS(root$LWS, target$LWS), substituteDistortedHandler$LWS(root$LWS, handler$LWS));
|
|
11914
12533
|
}];
|
|
11915
12534
|
};
|
|
11916
12535
|
}
|
|
@@ -11930,13 +12549,7 @@
|
|
|
11930
12549
|
// Gated on changesSince.266: this is new distortion behavior, distinct from
|
|
11931
12550
|
// getDistortableFrameElement's own changesSince.264 gate on the underlying
|
|
11932
12551
|
// cross-realm scoping helper.
|
|
11933
|
-
function initDistortionProxyRevocable$LWS({
|
|
11934
|
-
globalObject: {
|
|
11935
|
-
Proxy: {
|
|
11936
|
-
revocable: originalRevocable$LWS
|
|
11937
|
-
}
|
|
11938
|
-
}
|
|
11939
|
-
}) {
|
|
12552
|
+
function initDistortionProxyRevocable$LWS() {
|
|
11940
12553
|
return function distortionProxyRevocable$LWS({
|
|
11941
12554
|
globalObject: globalObject$LWS,
|
|
11942
12555
|
root: root$LWS
|
|
@@ -11944,8 +12557,17 @@
|
|
|
11944
12557
|
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11945
12558
|
return undefined;
|
|
11946
12559
|
}
|
|
12560
|
+
// W-24222894: read the primitive AFTER the gate — never in the outer
|
|
12561
|
+
// initializer's parameter. The initializer runs for EVERY record built,
|
|
12562
|
+
// including a transitional secondary-window realm (e.g. a freshly
|
|
12563
|
+
// window.open()'d same-origin window still materializing) whose Proxy is
|
|
12564
|
+
// momentarily undefined; the deep `Proxy.revocable` outer read
|
|
12565
|
+
// dereferences that undefined before this gate can bail and throws,
|
|
12566
|
+
// exactly as it did for Function.prototype.apply. See
|
|
12567
|
+
// ../Function/cross-realm-invocation.ts.
|
|
12568
|
+
const originalRevocable$LWS = globalObject$LWS.Proxy.revocable;
|
|
11947
12569
|
return [originalRevocable$LWS, function revocable$LWS(target$LWS, handler$LWS) {
|
|
11948
|
-
return ReflectApply$LWS$1(originalRevocable$LWS, undefined, [substituteDistortedCallee$LWS(root$LWS, target$LWS), handler$LWS]);
|
|
12570
|
+
return ReflectApply$LWS$1(originalRevocable$LWS, undefined, [substituteDistortedCallee$LWS(root$LWS, target$LWS), substituteDistortedHandler$LWS(root$LWS, handler$LWS)]);
|
|
11949
12571
|
}];
|
|
11950
12572
|
};
|
|
11951
12573
|
}
|
|
@@ -11955,19 +12577,32 @@
|
|
|
11955
12577
|
function initDistortionRangeCloneContents$LWS({
|
|
11956
12578
|
globalObject: {
|
|
11957
12579
|
AbstractRange: AbstractRange$LWS,
|
|
11958
|
-
Range:
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
12580
|
+
Range: Range$LWS
|
|
12581
|
+
}
|
|
12582
|
+
}) {
|
|
12583
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12584
|
+
// hierarchy over time:
|
|
12585
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12586
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12587
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12588
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12589
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12590
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12591
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12592
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12593
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12594
|
+
const {
|
|
12595
|
+
prototype: RangeProto$LWS
|
|
12596
|
+
} = Range$LWS;
|
|
12597
|
+
const {
|
|
12598
|
+
cloneContents: originalCloneContents$LWS
|
|
12599
|
+
} = RangeProto$LWS;
|
|
11965
12600
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11966
12601
|
const {
|
|
11967
12602
|
prototype: AbstractRangeProto$LWS
|
|
11968
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11969
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11970
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12603
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12604
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12605
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11971
12606
|
const distortionEntry$LWS = [originalCloneContents$LWS, function cloneContents$LWS(...args$LWS) {
|
|
11972
12607
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
11973
12608
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -11992,19 +12627,32 @@
|
|
|
11992
12627
|
function initDistortionRangeCloneRange$LWS({
|
|
11993
12628
|
globalObject: {
|
|
11994
12629
|
AbstractRange: AbstractRange$LWS,
|
|
11995
|
-
Range:
|
|
11996
|
-
|
|
11997
|
-
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12630
|
+
Range: Range$LWS
|
|
12631
|
+
}
|
|
12632
|
+
}) {
|
|
12633
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12634
|
+
// hierarchy over time:
|
|
12635
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12636
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12637
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12638
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12639
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12640
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12641
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12642
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12643
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12644
|
+
const {
|
|
12645
|
+
prototype: RangeProto$LWS
|
|
12646
|
+
} = Range$LWS;
|
|
12647
|
+
const {
|
|
12648
|
+
cloneRange: originalCloneRange$LWS
|
|
12649
|
+
} = RangeProto$LWS;
|
|
12002
12650
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
12003
12651
|
const {
|
|
12004
12652
|
prototype: AbstractRangeProto$LWS
|
|
12005
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
12006
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12007
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12653
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12654
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12655
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12008
12656
|
const distortionEntry$LWS = [originalCloneRange$LWS, function cloneRange$LWS(...args$LWS) {
|
|
12009
12657
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
12010
12658
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -12066,24 +12714,32 @@
|
|
|
12066
12714
|
function initDistortionRangeDeleteContents$LWS({
|
|
12067
12715
|
globalObject: {
|
|
12068
12716
|
AbstractRange: AbstractRange$LWS,
|
|
12069
|
-
Range:
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
//
|
|
12077
|
-
//
|
|
12078
|
-
//
|
|
12079
|
-
//
|
|
12080
|
-
//
|
|
12717
|
+
Range: Range$LWS
|
|
12718
|
+
}
|
|
12719
|
+
}) {
|
|
12720
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12721
|
+
// hierarchy over time:
|
|
12722
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12723
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12724
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12725
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12726
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12727
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12728
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12729
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12730
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12731
|
+
const {
|
|
12732
|
+
prototype: RangeProto$LWS
|
|
12733
|
+
} = Range$LWS;
|
|
12734
|
+
const {
|
|
12735
|
+
deleteContents: originalDeleteContents$LWS
|
|
12736
|
+
} = RangeProto$LWS;
|
|
12081
12737
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
12082
12738
|
const {
|
|
12083
12739
|
prototype: AbstractRangeProto$LWS
|
|
12084
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
12085
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12086
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12740
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12741
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12742
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12087
12743
|
const distortionEntry$LWS = [originalDeleteContents$LWS, function deleteContents$LWS(...args$LWS) {
|
|
12088
12744
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
12089
12745
|
for (let i$LWS = 0, {
|
|
@@ -12106,24 +12762,32 @@
|
|
|
12106
12762
|
function initDistortionRangeExtractContents$LWS({
|
|
12107
12763
|
globalObject: {
|
|
12108
12764
|
AbstractRange: AbstractRange$LWS,
|
|
12109
|
-
Range:
|
|
12110
|
-
|
|
12111
|
-
|
|
12112
|
-
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
12116
|
-
//
|
|
12117
|
-
//
|
|
12118
|
-
//
|
|
12119
|
-
//
|
|
12120
|
-
//
|
|
12765
|
+
Range: Range$LWS
|
|
12766
|
+
}
|
|
12767
|
+
}) {
|
|
12768
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12769
|
+
// hierarchy over time:
|
|
12770
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12771
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12772
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12773
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12774
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12775
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12776
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12777
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12778
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12779
|
+
const {
|
|
12780
|
+
prototype: RangeProto$LWS
|
|
12781
|
+
} = Range$LWS;
|
|
12782
|
+
const {
|
|
12783
|
+
extractContents: originalExtractContents$LWS
|
|
12784
|
+
} = RangeProto$LWS;
|
|
12121
12785
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
12122
12786
|
const {
|
|
12123
12787
|
prototype: AbstractRangeProto$LWS
|
|
12124
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
12125
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12126
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12788
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12789
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12790
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12127
12791
|
const distortionEntry$LWS = [originalExtractContents$LWS, function extractContents$LWS(...args$LWS) {
|
|
12128
12792
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
12129
12793
|
for (let i$LWS = 0, {
|
|
@@ -12146,19 +12810,32 @@
|
|
|
12146
12810
|
function initDistortionRangeGetBoundingClientRect$LWS({
|
|
12147
12811
|
globalObject: {
|
|
12148
12812
|
AbstractRange: AbstractRange$LWS,
|
|
12149
|
-
Range:
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
|
|
12153
|
-
|
|
12154
|
-
|
|
12155
|
-
|
|
12813
|
+
Range: Range$LWS
|
|
12814
|
+
}
|
|
12815
|
+
}) {
|
|
12816
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12817
|
+
// hierarchy over time:
|
|
12818
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12819
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12820
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12821
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12822
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12823
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12824
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12825
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12826
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12827
|
+
const {
|
|
12828
|
+
prototype: RangeProto$LWS
|
|
12829
|
+
} = Range$LWS;
|
|
12830
|
+
const {
|
|
12831
|
+
getBoundingClientRect: originalGetBoundingClientRect$LWS
|
|
12832
|
+
} = RangeProto$LWS;
|
|
12156
12833
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
12157
12834
|
const {
|
|
12158
12835
|
prototype: AbstractRangeProto$LWS
|
|
12159
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
12160
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12161
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12836
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12837
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12838
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12162
12839
|
const distortionEntry$LWS = [originalGetBoundingClientRect$LWS, function getBoundingClientRect$LWS(...args$LWS) {
|
|
12163
12840
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
12164
12841
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -12262,19 +12939,32 @@
|
|
|
12262
12939
|
function initDistortionRangeToString$LWS({
|
|
12263
12940
|
globalObject: {
|
|
12264
12941
|
AbstractRange: AbstractRange$LWS,
|
|
12265
|
-
Range:
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12942
|
+
Range: Range$LWS
|
|
12943
|
+
}
|
|
12944
|
+
}) {
|
|
12945
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12946
|
+
// hierarchy over time:
|
|
12947
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12948
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12949
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12950
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12951
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12952
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12953
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12954
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12955
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12956
|
+
const {
|
|
12957
|
+
prototype: RangeProto$LWS
|
|
12958
|
+
} = Range$LWS;
|
|
12959
|
+
const {
|
|
12960
|
+
toString: originalRangeToString$LWS
|
|
12961
|
+
} = RangeProto$LWS;
|
|
12272
12962
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
12273
12963
|
const {
|
|
12274
12964
|
prototype: AbstractRangeProto$LWS
|
|
12275
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
12276
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12277
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12965
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12966
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12967
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12278
12968
|
const distortionEntry$LWS = [originalRangeToString$LWS, function toString$LWS(...args$LWS) {
|
|
12279
12969
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
12280
12970
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -12300,13 +12990,7 @@
|
|
|
12300
12990
|
// Unlike Function.prototype.apply, the callee is the FIRST ARGUMENT (not
|
|
12301
12991
|
// `this`) and the invocation never routes through Function.prototype.call, so
|
|
12302
12992
|
// it is an independent doorway that must be distorted separately.
|
|
12303
|
-
function initDistortionReflectApply$LWS({
|
|
12304
|
-
globalObject: {
|
|
12305
|
-
Reflect: {
|
|
12306
|
-
apply: originalReflectApply$LWS
|
|
12307
|
-
}
|
|
12308
|
-
}
|
|
12309
|
-
}) {
|
|
12993
|
+
function initDistortionReflectApply$LWS() {
|
|
12310
12994
|
return function distortionReflectApply$LWS({
|
|
12311
12995
|
globalObject: globalObject$LWS,
|
|
12312
12996
|
root: root$LWS
|
|
@@ -12314,6 +12998,11 @@
|
|
|
12314
12998
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
12315
12999
|
return undefined;
|
|
12316
13000
|
}
|
|
13001
|
+
// W-24222894: read the primitive AFTER the gate. See
|
|
13002
|
+
// ../Function/apply-value.ts and ../Function/cross-realm-invocation.ts
|
|
13003
|
+
// for why an eager outer-parameter read crashes on a transitional
|
|
13004
|
+
// secondary-window realm.
|
|
13005
|
+
const originalReflectApply$LWS = globalObject$LWS.Reflect.apply;
|
|
12317
13006
|
return [originalReflectApply$LWS, function apply$LWS(target$LWS, thisArg$LWS, argsArray$LWS) {
|
|
12318
13007
|
return ReflectApply$LWS$1(substituteDistortedCallee$LWS(root$LWS, target$LWS), thisArg$LWS, argsArray$LWS == null ? [] : argsArray$LWS);
|
|
12319
13008
|
}];
|
|
@@ -12327,13 +13016,7 @@
|
|
|
12327
13016
|
// invoked as a constructor. Substitute it for its distorted counterpart, then
|
|
12328
13017
|
// construct with the sandbox-realm Reflect.construct, preserving the optional
|
|
12329
13018
|
// newTarget argument.
|
|
12330
|
-
function initDistortionReflectConstruct$LWS({
|
|
12331
|
-
globalObject: {
|
|
12332
|
-
Reflect: {
|
|
12333
|
-
construct: originalReflectConstruct$LWS
|
|
12334
|
-
}
|
|
12335
|
-
}
|
|
12336
|
-
}) {
|
|
13019
|
+
function initDistortionReflectConstruct$LWS() {
|
|
12337
13020
|
return function distortionReflectConstruct$LWS({
|
|
12338
13021
|
globalObject: globalObject$LWS,
|
|
12339
13022
|
root: root$LWS
|
|
@@ -12341,6 +13024,11 @@
|
|
|
12341
13024
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
12342
13025
|
return undefined;
|
|
12343
13026
|
}
|
|
13027
|
+
// W-24222894: read the primitive AFTER the gate. See
|
|
13028
|
+
// ../Function/apply-value.ts and ../Function/cross-realm-invocation.ts
|
|
13029
|
+
// for why an eager outer-parameter read crashes on a transitional
|
|
13030
|
+
// secondary-window realm.
|
|
13031
|
+
const originalReflectConstruct$LWS = globalObject$LWS.Reflect.construct;
|
|
12344
13032
|
return [originalReflectConstruct$LWS, function construct$LWS(target$LWS, argsArray$LWS, newTarget$LWS) {
|
|
12345
13033
|
const substituted$LWS = substituteDistortedCallee$LWS(root$LWS, target$LWS);
|
|
12346
13034
|
if (arguments.length > 2) {
|
|
@@ -12476,7 +13164,7 @@
|
|
|
12476
13164
|
}
|
|
12477
13165
|
current$LWS = ReflectGetPrototypeOf$LWS$1(current$LWS);
|
|
12478
13166
|
}
|
|
12479
|
-
} catch (
|
|
13167
|
+
} catch (_unused9$LWS) {
|
|
12480
13168
|
// Not the confused-deputy path: defer to native below.
|
|
12481
13169
|
}
|
|
12482
13170
|
if (distortedGetter$LWS !== undefined) {
|
|
@@ -13184,7 +13872,7 @@
|
|
|
13184
13872
|
try {
|
|
13185
13873
|
originalStorageObject$LWS = globalObject$LWS[storageName$LWS];
|
|
13186
13874
|
// eslint-disable-next-line no-empty
|
|
13187
|
-
} catch (
|
|
13875
|
+
} catch (_unused0$LWS) {}
|
|
13188
13876
|
// istanbul ignore if: currently unreachable via tests
|
|
13189
13877
|
if (!isObject$LWS$1(originalStorageObject$LWS)) {
|
|
13190
13878
|
return noop$LWS$1;
|
|
@@ -13667,7 +14355,7 @@
|
|
|
13667
14355
|
try {
|
|
13668
14356
|
// istanbul ignore next: needs default platform behavior test
|
|
13669
14357
|
return ReflectApply$LWS$1(originalCreatePolicy$LWS, this, args$LWS);
|
|
13670
|
-
} catch (
|
|
14358
|
+
} catch (_unused1$LWS) {
|
|
13671
14359
|
// istanbul ignore next: this is tested, but currently cannot be tested in the coverage environment
|
|
13672
14360
|
consoleWarn$LWS(`${createTrustedTypesExceptionMessage$LWS(name$LWS)} Substituting with Lightning Web Security policy.`);
|
|
13673
14361
|
}
|
|
@@ -13812,7 +14500,7 @@
|
|
|
13812
14500
|
ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', outURL$LWS, false]);
|
|
13813
14501
|
try {
|
|
13814
14502
|
ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
|
|
13815
|
-
} catch (
|
|
14503
|
+
} catch (_unused10$LWS) {
|
|
13816
14504
|
throw new LockerSecurityError$LWS(`Unable to verify ${toSafeTemplateStringValue$LWS(blobObject$LWS)} is secure.`);
|
|
13817
14505
|
}
|
|
13818
14506
|
const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
|
|
@@ -14521,7 +15209,7 @@
|
|
|
14521
15209
|
// Same-browsing-context targets (_self, _parent, _top) are excluded:
|
|
14522
15210
|
// they navigate the current context (no new unsandboxed page), and the
|
|
14523
15211
|
// existing URL validation (gate 262) already guards them.
|
|
14524
|
-
if (isGaterEnabledFeature$LWS('
|
|
15212
|
+
if (isGaterEnabledFeature$LWS('blockWindowOpenSameOriginSameContext') && !willOpenInSameBrowsingContext$LWS) {
|
|
14525
15213
|
if (isSameOriginURL$LWS(resourceUrl$LWS)) {
|
|
14526
15214
|
throw new LockerSecurityError$LWS('Cannot open same-origin URL in a new browsing context.');
|
|
14527
15215
|
}
|
|
@@ -14756,7 +15444,7 @@
|
|
|
14756
15444
|
try {
|
|
14757
15445
|
ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, value$LWS, []);
|
|
14758
15446
|
return true;
|
|
14759
|
-
} catch (
|
|
15447
|
+
} catch (_unused11$LWS) {
|
|
14760
15448
|
return false;
|
|
14761
15449
|
}
|
|
14762
15450
|
}
|
|
@@ -14865,7 +15553,7 @@
|
|
|
14865
15553
|
try {
|
|
14866
15554
|
docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
|
|
14867
15555
|
isDocument$LWS = true;
|
|
14868
|
-
} catch (
|
|
15556
|
+
} catch (_unused12$LWS) {
|
|
14869
15557
|
isDocument$LWS = false;
|
|
14870
15558
|
}
|
|
14871
15559
|
}
|
|
@@ -14971,12 +15659,14 @@
|
|
|
14971
15659
|
initDistortionReportingObserverCtor$LWS, initDistortionReportingObserverProto$LWS,
|
|
14972
15660
|
// ResizeObserver
|
|
14973
15661
|
initDistortionResizeObserverObserve$LWS,
|
|
15662
|
+
// Navigation
|
|
15663
|
+
initDistortionNavigationNavigate$LWS,
|
|
14974
15664
|
// Navigator
|
|
14975
15665
|
initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS,
|
|
14976
15666
|
// Observable
|
|
14977
15667
|
initDistortionObservableCatch$LWS, initDistortionObservableEvery$LWS, initDistortionObservableFilter$LWS, initDistortionObservableFinally$LWS, initDistortionObservableFind$LWS, initDistortionObservableFlatMap$LWS, initDistortionObservableForEach$LWS, initDistortionObservableInspect$LWS, initDistortionObservableMap$LWS, initDistortionObservableReduce$LWS, initDistortionObservableSome$LWS, initDistortionObservableSubscribe$LWS, initDistortionObservableSwitchMap$LWS,
|
|
14978
15668
|
// Node
|
|
14979
|
-
initDistortionNodeGetRootNode$LWS, initDistortionNodeParentElementGetter$LWS, initDistortionNodeParentNodeGetter$LWS, initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
|
|
15669
|
+
initDistortionNodeCloneNode$LWS, initDistortionNodeGetRootNode$LWS, initDistortionNodeParentElementGetter$LWS, initDistortionNodeParentNodeGetter$LWS, initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
|
|
14980
15670
|
// Performance
|
|
14981
15671
|
initDistortionPerformanceMark$LWS, initDistortionPerformanceMeasure$LWS,
|
|
14982
15672
|
// PerformanceMark
|
|
@@ -15065,7 +15755,7 @@
|
|
|
15065
15755
|
// HTMLButtonElement
|
|
15066
15756
|
initDistortionHTMLButtonElementFormActionSetter$LWS,
|
|
15067
15757
|
// HTMLFormElement
|
|
15068
|
-
initDistortionHTMLFormElementActionSetter$LWS,
|
|
15758
|
+
initDistortionHTMLFormElementActionSetter$LWS, initDistortionHTMLFormElementRequestSubmit$LWS, initDistortionHTMLFormElementSubmit$LWS,
|
|
15069
15759
|
// HTMLInputElement
|
|
15070
15760
|
initDistortionHTMLInputElementFormActionSetter$LWS,
|
|
15071
15761
|
// HTMLFrameSetElement
|
|
@@ -15107,7 +15797,7 @@
|
|
|
15107
15797
|
// initDistortionNodeAppendChild,
|
|
15108
15798
|
initDistortionNodeInsertBefore$LWS]);
|
|
15109
15799
|
const externalKeyedDistortionFactoryInitializers$LWS = internalKeyedDistortionFactoryInitializers$LWS;
|
|
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']]));
|
|
15800
|
+
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'], [initDistortionHTMLFormElementRequestSubmit$LWS, 'form'], [initDistortionHTMLFormElementSubmit$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'], [initDistortionNavigationNavigate$LWS, 'navigation'], [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'], [initDistortionNodeCloneNode$LWS, 'node'], [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']]));
|
|
15111
15801
|
const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
|
|
15112
15802
|
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'];
|
|
15113
15803
|
const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
|
|
@@ -15139,7 +15829,7 @@
|
|
|
15139
15829
|
const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
|
|
15140
15830
|
const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
|
|
15141
15831
|
const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
|
|
15142
|
-
/*! version: 0.29.
|
|
15832
|
+
/*! version: 0.29.2 */
|
|
15143
15833
|
|
|
15144
15834
|
/*!
|
|
15145
15835
|
* Copyright (C) 2021 salesforce.com, inc.
|
|
@@ -15148,7 +15838,7 @@
|
|
|
15148
15838
|
function getPdpSchema$LWS() {
|
|
15149
15839
|
return pdpSchema$LWS;
|
|
15150
15840
|
}
|
|
15151
|
-
/*! version: 0.29.
|
|
15841
|
+
/*! version: 0.29.2 */
|
|
15152
15842
|
|
|
15153
15843
|
/*!
|
|
15154
15844
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -15331,11 +16021,30 @@
|
|
|
15331
16021
|
function createDistortionEntries$LWS(record$LWS, factories$LWS) {
|
|
15332
16022
|
const distortionEntryToToggleSwitch$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
|
|
15333
16023
|
const entries$LWS = [];
|
|
16024
|
+
// W-23969898: on a torn-down same-origin iframe realm (DOM globals stripped
|
|
16025
|
+
// to `undefined`, JS intrinsics intact) getDistortionFactories returns only
|
|
16026
|
+
// the factories whose initializers survived, but a surviving factory can
|
|
16027
|
+
// still touch an absent DOM global when it BUILDS its entry here. Tolerate
|
|
16028
|
+
// such a failure so the intrinsic-only cross-realm family (Reflect.get et
|
|
16029
|
+
// al.) is still installed instead of the whole build throwing and dropping
|
|
16030
|
+
// the realm to a containment-free opaque record. Detected the same way as in
|
|
16031
|
+
// getDistortionFactories: a live window always exposes its Document.
|
|
16032
|
+
const tolerateFactoryBuildErrors$LWS = isGaterEnabledFeature$LWS('changesSince.266') && record$LWS.globalObject.Document === undefined;
|
|
15334
16033
|
for (let i$LWS = 0, {
|
|
15335
16034
|
length: length$LWS
|
|
15336
16035
|
} = factories$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
15337
16036
|
const factory$LWS = factories$LWS[i$LWS];
|
|
15338
|
-
|
|
16037
|
+
let entry$LWS;
|
|
16038
|
+
if (tolerateFactoryBuildErrors$LWS) {
|
|
16039
|
+
try {
|
|
16040
|
+
entry$LWS = factory$LWS(record$LWS);
|
|
16041
|
+
} catch (_unused0$LWS) {
|
|
16042
|
+
// Cannot build this distortion on the torn-down realm; skip it.
|
|
16043
|
+
continue;
|
|
16044
|
+
}
|
|
16045
|
+
} else {
|
|
16046
|
+
entry$LWS = factory$LWS(record$LWS);
|
|
16047
|
+
}
|
|
15339
16048
|
if (entry$LWS) {
|
|
15340
16049
|
const {
|
|
15341
16050
|
0: originalValue$LWS,
|
|
@@ -15409,6 +16118,41 @@
|
|
|
15409
16118
|
const initializers$LWS = type$LWS === 1 /* SandboxType.Internal */ ?
|
|
15410
16119
|
// instanbul ignore next: coverage is collected on the external sandbox test run
|
|
15411
16120
|
ArrayConcat$LWS(internalDistortionFactoryInitializers$LWS, internalKeyedDistortionFactoryInitializers$LWS) : ArrayConcat$LWS(externalDistortionFactoryInitializers$LWS, externalKeyedDistortionFactoryInitializers$LWS);
|
|
16121
|
+
// W-23969898: a same-origin iframe whose browsing context has been torn
|
|
16122
|
+
// down (e.g. detached from the DOM before LWS rebuilds the post-navigation
|
|
16123
|
+
// record) keeps its JavaScript intrinsics — Reflect, Function, Proxy — but
|
|
16124
|
+
// strips its DOM globals: `globalObject.Document` and the other DOM
|
|
16125
|
+
// constructors read back `undefined`. A full record build destructures
|
|
16126
|
+
// those absent interfaces and throws, and the caller's rebuild fallback
|
|
16127
|
+
// then installs a containment-free opaque record — leaving the realm's raw
|
|
16128
|
+
// `Reflect.get` free to leak the host `document.cookie` across the membrane.
|
|
16129
|
+
//
|
|
16130
|
+
// On such a realm, build only the distortions whose intrinsics survived the
|
|
16131
|
+
// teardown by skipping any initializer that throws. This preserves the
|
|
16132
|
+
// cross-realm containment family (Reflect.get/apply/construct,
|
|
16133
|
+
// Function.call/apply/bind, Proxy) — exactly what a leaked
|
|
16134
|
+
// `child.Reflect.get` needs — while dropping the DOM-interface distortions,
|
|
16135
|
+
// which cannot build and have nothing to protect on a realm with no live
|
|
16136
|
+
// DOM. `Document === undefined` distinguishes a torn-down window from a live
|
|
16137
|
+
// one (a live secondary window always exposes its DOM constructors).
|
|
16138
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && Document$LWS === undefined) {
|
|
16139
|
+
const survivingFactories$LWS = [];
|
|
16140
|
+
for (let i$LWS = 0, {
|
|
16141
|
+
length: length$LWS
|
|
16142
|
+
} = initializers$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
16143
|
+
let factory$LWS;
|
|
16144
|
+
try {
|
|
16145
|
+
factory$LWS = initializers$LWS[i$LWS](record$LWS);
|
|
16146
|
+
} catch (_unused1$LWS) {
|
|
16147
|
+
// A DOM-dependent distortion cannot build on a torn-down realm;
|
|
16148
|
+
// skip it. The intrinsic-only cross-realm family still builds.
|
|
16149
|
+
continue;
|
|
16150
|
+
}
|
|
16151
|
+
survivingFactories$LWS[survivingFactories$LWS.length] = factory$LWS;
|
|
16152
|
+
}
|
|
16153
|
+
distortionFactoriesCache$LWS.set(document$LWS, survivingFactories$LWS);
|
|
16154
|
+
return survivingFactories$LWS;
|
|
16155
|
+
}
|
|
15412
16156
|
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLElement$LWS, 'HTMLElement', HTMLElementBlockedAttributes$LWS, initializers$LWS);
|
|
15413
16157
|
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLEmbedElement, 'HTMLEmbedElement', HTMLEmbedElementBlockedAttributes$LWS, initializers$LWS, 'embed');
|
|
15414
16158
|
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS, 'iframe');
|
|
@@ -17915,22 +18659,9 @@
|
|
|
17915
18659
|
// Replace pending traps with live traps that can work with the
|
|
17916
18660
|
// target without taking snapshots.
|
|
17917
18661
|
this.deleteProperty = BoundaryProxyHandler$LWS.passthruDeletePropertyTrap;
|
|
18662
|
+
this.defineProperty = BoundaryProxyHandler$LWS.passthruDefinePropertyTrap;
|
|
17918
18663
|
this.preventExtensions = BoundaryProxyHandler$LWS.passthruPreventExtensionsTrap;
|
|
17919
18664
|
this.set = BoundaryProxyHandler$LWS.passthruSetTrap;
|
|
17920
|
-
// `[[DefineOwnProperty]]` is passthru for DATA descriptors
|
|
17921
|
-
// (the expando capability live targets actually need) but
|
|
17922
|
-
// accessor descriptors are scoped to the shadow target. The
|
|
17923
|
-
// passthru variant calls `foreignCallableDefineProperty` on the
|
|
17924
|
-
// RAW foreign target; for an accessor that plants a
|
|
17925
|
-
// sandbox-authored getter/setter directly onto a host-shared
|
|
17926
|
-
// object. Because the descriptor's functions are marshalled as
|
|
17927
|
-
// pointers back into the sandbox, any later access from the
|
|
17928
|
-
// primary realm (a confused deputy reading the planted key)
|
|
17929
|
-
// would execute sandbox code with the RAW object as `this` and
|
|
17930
|
-
// read raw-global-only state through it. Data expandos carry no
|
|
17931
|
-
// such callback, so they remain passthru; only accessors are
|
|
17932
|
-
// contained. See `liveAccessorGuardedDefinePropertyTrap`.
|
|
17933
|
-
this.defineProperty = BoundaryProxyHandler$LWS.liveAccessorGuardedDefinePropertyTrap;
|
|
17934
18665
|
// `[[SetPrototypeOf]]` is the one live trap we do not
|
|
17935
18666
|
// passthru. The passthru variant calls `ReflectSetPrototypeOf`
|
|
17936
18667
|
// on the RAW foreign target, which lets sandbox code splice a
|
|
@@ -17941,9 +18672,9 @@
|
|
|
17941
18672
|
// shadow target. It also lets sandbox code wipe a host-shared
|
|
17942
18673
|
// object's prototype to `null`. Scoping the proto change to the
|
|
17943
18674
|
// shadow target makes both observably inert while leaving
|
|
17944
|
-
// `set`/`deleteProperty` passthru (the
|
|
17945
|
-
// actually need) untouched. No
|
|
17946
|
-
// itself across the membrane.
|
|
18675
|
+
// `set`/`defineProperty`/`deleteProperty` passthru (the
|
|
18676
|
+
// capabilities live targets actually need) untouched. No
|
|
18677
|
+
// legitimate live target re-parents itself across the membrane.
|
|
17947
18678
|
this.setPrototypeOf = BoundaryProxyHandler$LWS.staticSetPrototypeOfTrap;
|
|
17948
18679
|
} : noop$LWS;
|
|
17949
18680
|
this.makeProxyStatic = IS_IN_SHADOW_REALM$LWS ? function () {
|
|
@@ -18549,76 +19280,6 @@
|
|
|
18549
19280
|
}
|
|
18550
19281
|
return result$LWS;
|
|
18551
19282
|
} : alwaysFalse$LWS;
|
|
18552
|
-
// `[[DefineOwnProperty]]` trap for LIVE targets. Data descriptors are the
|
|
18553
|
-
// expando capability live targets rely on and stay passthru to the RAW
|
|
18554
|
-
// foreign target via `passthruDefinePropertyTrap`. Accessor descriptors
|
|
18555
|
-
// (a `get` and/or `set`), however, would install sandbox-authored
|
|
18556
|
-
// functions onto a host-shared object; a subsequent access from the
|
|
18557
|
-
// primary realm would run that sandbox code with the RAW target as
|
|
18558
|
-
// receiver and expose raw-global-only state. We contain accessors on the
|
|
18559
|
-
// inert shadow target instead. This mirrors the `staticSetPrototypeOfTrap`
|
|
18560
|
-
// contract: the operation is observably inert from every side. A live
|
|
18561
|
-
// `get` resolves against the RAW foreign target (`lookupForeignDescriptor`
|
|
18562
|
-
// reads the raw own descriptor and walks the RAW prototype chain; it only
|
|
18563
|
-
// ever writes the shadow target, never reads its own properties), so the
|
|
18564
|
-
// sandbox reads back `undefined` for a shadow-scoped accessor too. The
|
|
18565
|
-
// security-relevant guarantee is that no sandbox-authored callback ever
|
|
18566
|
-
// reaches the raw host-shared object.
|
|
18567
|
-
//
|
|
18568
|
-
// The shadow-scoped copy is always written with `configurable: true`,
|
|
18569
|
-
// regardless of what the sandbox asked for. A live proxy's `has`,
|
|
18570
|
-
// `ownKeys`, and `getOwnPropertyDescriptor` traps are NOT overridden by
|
|
18571
|
-
// `makeProxyLive()` (see `hybridHasTrap`, `passthruOwnKeysTrap`,
|
|
18572
|
-
// `passthruGetOwnPropertyDescriptorTrap`): they all resolve against the
|
|
18573
|
-
// RAW foreign target and never consult the shadow target's own
|
|
18574
|
-
// properties. `Object.defineProperty` defaults `configurable` to
|
|
18575
|
-
// `false`, so the common `{ get() {...} }` shape would otherwise leave
|
|
18576
|
-
// the shadow target — the proxy's actual `[[ProxyTarget]]` — holding a
|
|
18577
|
-
// NON-CONFIGURABLE own key that those raw-resolving traps can never
|
|
18578
|
-
// mirror. The engine's proxy invariants then throw on the very next
|
|
18579
|
-
// `has`/`ownKeys`/`getOwnPropertyDescriptor` (`in`, `Object.keys`,
|
|
18580
|
-
// spread, `JSON.stringify`, `Object.getOwnPropertyDescriptor`, ...)
|
|
18581
|
-
// because a non-configurable target key must be reported by those traps
|
|
18582
|
-
// and it never can be. Since the accessor is invisible through the
|
|
18583
|
-
// proxy either way (reads resolve against the raw target), forcing
|
|
18584
|
-
// `configurable: true` is not observable to the sandbox, and it keeps
|
|
18585
|
-
// every read-side invariant satisfiable. An explicit `configurable:
|
|
18586
|
-
// false` request cannot be honored while preserving that invisibility;
|
|
18587
|
-
// it now fails fast with a native TypeError raised by the engine's own
|
|
18588
|
-
// `defineProperty` trap-result invariant check (requested
|
|
18589
|
-
// non-configurable vs. an actually-configurable target descriptor) at
|
|
18590
|
-
// the `defineProperty` call site itself, rather than deferring the
|
|
18591
|
-
// detonation to a later, unrelated read.
|
|
18592
|
-
BoundaryProxyHandler$LWS.liveAccessorGuardedDefinePropertyTrap = IS_IN_SHADOW_REALM$LWS ? function (shadowTarget$LWS, key$LWS, unsafePartialDesc$LWS) {
|
|
18593
|
-
// A descriptor is an accessor iff it carries a `get` or `set`.
|
|
18594
|
-
// Read membership before detaching the prototype so a poisoned
|
|
18595
|
-
// `Object.prototype` getter cannot forge the answer.
|
|
18596
|
-
const isAccessorDescriptor$LWS = 'get' in unsafePartialDesc$LWS || 'set' in unsafePartialDesc$LWS;
|
|
18597
|
-
if (isAccessorDescriptor$LWS) {
|
|
18598
|
-
lastProxyTrapCalled$LWS = 4 /* ProxyHandlerTraps.DefineProperty */;
|
|
18599
|
-
// Build a fresh descriptor rather than writing the
|
|
18600
|
-
// sandbox's `unsafePartialDesc` object directly, and
|
|
18601
|
-
// force `configurable: true` on the shadow-scoped copy
|
|
18602
|
-
// (see the block comment above).
|
|
18603
|
-
const shadowDesc$LWS = {
|
|
18604
|
-
__proto__: null
|
|
18605
|
-
};
|
|
18606
|
-
if ('get' in unsafePartialDesc$LWS) {
|
|
18607
|
-
shadowDesc$LWS.get = unsafePartialDesc$LWS.get;
|
|
18608
|
-
}
|
|
18609
|
-
if ('set' in unsafePartialDesc$LWS) {
|
|
18610
|
-
shadowDesc$LWS.set = unsafePartialDesc$LWS.set;
|
|
18611
|
-
}
|
|
18612
|
-
if ('enumerable' in unsafePartialDesc$LWS) {
|
|
18613
|
-
shadowDesc$LWS.enumerable = unsafePartialDesc$LWS.enumerable;
|
|
18614
|
-
}
|
|
18615
|
-
shadowDesc$LWS.configurable = true;
|
|
18616
|
-
// Scope the accessor to the shadow target: observably
|
|
18617
|
-
// defined for the sandbox, never planted on the raw object.
|
|
18618
|
-
return ReflectDefineProperty$LWS(shadowTarget$LWS, key$LWS, shadowDesc$LWS);
|
|
18619
|
-
}
|
|
18620
|
-
return ReflectApply$LWS(BoundaryProxyHandler$LWS.passthruDefinePropertyTrap, this, [shadowTarget$LWS, key$LWS, unsafePartialDesc$LWS]);
|
|
18621
|
-
} : alwaysFalse$LWS;
|
|
18622
19283
|
BoundaryProxyHandler$LWS.passthruGetTrap = IS_NOT_IN_SHADOW_REALM$LWS ? function (_shadowTarget$LWS, key$LWS, receiver$LWS) {
|
|
18623
19284
|
// Only allow accessing handshake property values if the
|
|
18624
19285
|
// "has" trap has been triggered immediately BEFORE and
|
|
@@ -20454,7 +21115,7 @@
|
|
|
20454
21115
|
// eslint-disable-next-line no-unused-expressions
|
|
20455
21116
|
bindings$LWS[i$LWS];
|
|
20456
21117
|
// eslint-disable-next-line no-empty
|
|
20457
|
-
} catch (
|
|
21118
|
+
} catch (_unused35$LWS) {}
|
|
20458
21119
|
}
|
|
20459
21120
|
return spreadable$LWS(args$LWS);
|
|
20460
21121
|
};
|
|
@@ -20853,7 +21514,7 @@
|
|
|
20853
21514
|
// tools from mistaking the regexp or the replacement string for an
|
|
20854
21515
|
// actual source mapping URL.
|
|
20855
21516
|
/\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
|
|
20856
|
-
sourceText$LWS = `\n//# LWS Version = "0.29.
|
|
21517
|
+
sourceText$LWS = `\n//# LWS Version = "0.29.2"\n${sourceText$LWS}`;
|
|
20857
21518
|
return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
|
|
20858
21519
|
// Append "'use strict'" to the extracted function body so it is
|
|
20859
21520
|
// evaluated in strict mode.
|
|
@@ -21017,7 +21678,7 @@
|
|
|
21017
21678
|
type: type$LWS
|
|
21018
21679
|
}, _root$LWS);
|
|
21019
21680
|
}
|
|
21020
|
-
} catch (
|
|
21681
|
+
} catch (_unused36$LWS) {
|
|
21021
21682
|
// Cross-origin window — document access throws.
|
|
21022
21683
|
// Opaque sandbox record was already created on first
|
|
21023
21684
|
// encounter; nothing more to do.
|
|
@@ -21066,7 +21727,7 @@
|
|
|
21066
21727
|
return newDistortedTarget$LWS;
|
|
21067
21728
|
}
|
|
21068
21729
|
}
|
|
21069
|
-
} catch (
|
|
21730
|
+
} catch (_unused37$LWS) {
|
|
21070
21731
|
// Cross-origin window — document access throws.
|
|
21071
21732
|
}
|
|
21072
21733
|
}
|
|
@@ -21083,7 +21744,7 @@
|
|
|
21083
21744
|
if (!ObjectHasOwn$LWS$1(originalTarget$LWS, 'location')) {
|
|
21084
21745
|
return originalTarget$LWS;
|
|
21085
21746
|
}
|
|
21086
|
-
} catch (
|
|
21747
|
+
} catch (_unused38$LWS) {
|
|
21087
21748
|
// Likely an opaque object of a cross-origin window.
|
|
21088
21749
|
// istanbul ignore next: an access of property iframe.contentWindow.location.href on an opaque window, that should reach this catch clause IS tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
|
|
21089
21750
|
return originalTarget$LWS;
|
|
@@ -21092,14 +21753,29 @@
|
|
|
21092
21753
|
let originalTargetWindow$LWS;
|
|
21093
21754
|
// Do the safe cross-origin window object check first to avoid
|
|
21094
21755
|
// failure caused by touching non-cross-origin-safe properties.
|
|
21095
|
-
|
|
21756
|
+
//
|
|
21757
|
+
// Reading `window` invokes a getter when the target defines one, and a
|
|
21758
|
+
// hostile or exotic object can define `get window()` that throws. Guard
|
|
21759
|
+
// it exactly like the `location` check above: an unguarded throw here
|
|
21760
|
+
// propagates out of classification and through near-membrane's
|
|
21761
|
+
// pushErrorAcrossBoundary as a raw, unclassified value, letting an
|
|
21762
|
+
// undistorted host object escape the boundary into sandboxed code.
|
|
21763
|
+
let isSelfReferencingWindow$LWS = false;
|
|
21764
|
+
try {
|
|
21765
|
+
isSelfReferencingWindow$LWS = ObjectHasOwn$LWS$1(originalTarget$LWS, 'window') && originalTarget$LWS.window === originalTarget$LWS;
|
|
21766
|
+
} catch (_unused39$LWS) {
|
|
21767
|
+
// Not a window we can safely classify; treat it as a plain object
|
|
21768
|
+
// and let near-membrane wrap it normally.
|
|
21769
|
+
return originalTarget$LWS;
|
|
21770
|
+
}
|
|
21771
|
+
if (isSelfReferencingWindow$LWS) {
|
|
21096
21772
|
// Slower check to detect a window object.
|
|
21097
21773
|
try {
|
|
21098
21774
|
// `WindowDocumentGetter` will throw if `originalTarget` is
|
|
21099
21775
|
// not a window object, or if it is an opaque cross-origin window.
|
|
21100
21776
|
originalTargetDocument$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
|
|
21101
21777
|
originalTargetWindow$LWS = originalTarget$LWS;
|
|
21102
|
-
} catch (
|
|
21778
|
+
} catch (_unused40$LWS) {
|
|
21103
21779
|
try {
|
|
21104
21780
|
// istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
|
|
21105
21781
|
if (ReflectApply$LWS$1(WindowLocationGetter$LWS, originalTarget$LWS, [])) {
|
|
@@ -21111,7 +21787,7 @@
|
|
|
21111
21787
|
return originalTarget$LWS;
|
|
21112
21788
|
}
|
|
21113
21789
|
// eslint-disable-next-line no-empty
|
|
21114
|
-
} catch (
|
|
21790
|
+
} catch (_unused41$LWS) {}
|
|
21115
21791
|
}
|
|
21116
21792
|
// Check if originalTarget is a document and get its defaultView.
|
|
21117
21793
|
} else if ('defaultView' in originalTarget$LWS) {
|
|
@@ -21125,7 +21801,7 @@
|
|
|
21125
21801
|
// This will throw if `originalTarget` is not a document object.
|
|
21126
21802
|
defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, originalTarget$LWS, []);
|
|
21127
21803
|
// eslint-disable-next-line no-empty
|
|
21128
|
-
} catch (
|
|
21804
|
+
} catch (_unused42$LWS) {}
|
|
21129
21805
|
if (defaultView$LWS) {
|
|
21130
21806
|
originalTargetDocument$LWS = originalTarget$LWS;
|
|
21131
21807
|
originalTargetWindow$LWS = defaultView$LWS;
|
|
@@ -21440,7 +22116,7 @@
|
|
|
21440
22116
|
type: type$LWS
|
|
21441
22117
|
}, _root$LWS);
|
|
21442
22118
|
}
|
|
21443
|
-
} catch (
|
|
22119
|
+
} catch (_unused43$LWS) {
|
|
21444
22120
|
// istanbul ignore next: this is a safety precaution that is unreachable via tests
|
|
21445
22121
|
createOpaqueSecondaryWindowSandboxRecord$LWS({
|
|
21446
22122
|
globalObject: globalObject$LWS,
|
|
@@ -21479,7 +22155,7 @@
|
|
|
21479
22155
|
ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
|
|
21480
22156
|
// istanbul ignore next: currently unreachable via tests
|
|
21481
22157
|
ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
|
|
21482
|
-
} catch (
|
|
22158
|
+
} catch (_unused44$LWS) {
|
|
21483
22159
|
// istanbul ignore next: this is a safety precaution that is unreachable via tests
|
|
21484
22160
|
createOpaqueSecondaryWindowSandboxRecord$LWS({
|
|
21485
22161
|
globalObject: globalObject$LWS,
|
|
@@ -21593,7 +22269,7 @@
|
|
|
21593
22269
|
// surrounding-whitespace variant of the two known separators back onto the
|
|
21594
22270
|
// sandbox-scoped facade.
|
|
21595
22271
|
toSafeSet$LWS(new SetCtor$LWS$1(['lightning/platformresourceloader', 'lightning:platformresourceloader', 'lightningmobileruntime/platformresourceloader', 'lightningmobileruntime:platformresourceloader']));
|
|
21596
|
-
/*! version: 0.29.
|
|
22272
|
+
/*! version: 0.29.2 */
|
|
21597
22273
|
|
|
21598
22274
|
// Expose evaluateInSandbox on the window global so the browser harness page
|
|
21599
22275
|
// (eval.html / component.html) can invoke it against source delivered by the
|