mirror of
https://github.com/morluto/rea
synced 2026-10-26 14:25:49 -04:00
fix(javascript): stop reading media preload attributes as Electron preloads
HTML audio and video elements have their own `preload` attribute ("none",
"metadata", "auto"). A React renderer compiles `<audio preload="metadata">`
to `jsx("audio", { preload: "metadata" })`, and the `property:preload`
heuristic reported it as an Electron preload script named `metadata`.
Skip `preload` properties in the props object of a call whose first
argument is the static tag `audio` or `video`. The callee is not checked,
because minified element factories have arbitrary names.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XPY2GmufMNGQKoEgRUx1pd
This commit is contained in:
@@ -47,6 +47,8 @@ export interface JavaScriptAnalysisAccumulator {
|
||||
readonly utilityProcesses: LocatedJavaScriptFinding<ElectronUtilityProcessFinding>[];
|
||||
readonly nativeAddonBindings: LocatedJavaScriptFinding<ElectronNativeAddonBindingFinding>[];
|
||||
readonly moduleRangeIndex: JavaScriptModuleRangeIndex;
|
||||
/** `preload` attributes of audio and video elements, which are not scripts. */
|
||||
readonly mediaElementPreloads: WeakSet<t.Node>;
|
||||
readonly seen: Set<string>;
|
||||
visitedNodes: number;
|
||||
unknownFindings: number;
|
||||
@@ -111,6 +113,7 @@ export const createJavaScriptAnalysisAccumulator = (
|
||||
utilityProcesses: [],
|
||||
nativeAddonBindings: [],
|
||||
moduleRangeIndex: new JavaScriptModuleRangeIndex(sourceLength),
|
||||
mediaElementPreloads: new WeakSet(),
|
||||
seen: new Set(),
|
||||
visitedNodes: 0,
|
||||
unknownFindings: 0,
|
||||
|
||||
Reference in New Issue
Block a user