@wenathlan/extension 1.1.46 → 1.1.47
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/README.md +5 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +570 -11
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +52 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +18 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/profilers.d.ts +167 -0
- package/dist/profilers.d.ts.map +1 -0
- package/dist/protocol.d.ts +33 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +131 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +913 -14
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +144 -3
- package/extension/dist/pagebridge.js.map +4 -4
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +10 -6
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +159 -2
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/dist/style.css +1 -1
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnOEjO8Z0PDgQyfvawGcaO2j+o0GLCFTLNj7TkYC/Avo9l2NenMRq7gp90Nfd7E9MViv/OMcCKSYZ5unv12QPRtv31C+a5UQWDFAOP/cH5mwMd6hsayElrSoW8ta+FwFqmr9dIFkn7cQEU3YhZr4Gcbs+ycUHOxVgDA4NBKB0rQ6e9VW5LvTw0isRYUrqM+M72vKxHk9zUIYYn/LGPvottKBYi2GLr0PHSeC2UE+Shmq7vcFIXj6hDjvD4kLJ5sKoUllEcZ1TPuBcnHUQ9ndKA5iktXDQOIJCUJmi7a0YJ2PGg7fvpYfT9k0ai/qZ+pIoRfoOEwE01bPoDn7NjeYnNQIDAQAB",
|
|
4
4
|
"name": "Devthink",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.47",
|
|
6
6
|
"description": "A consent-first bridge for reviewed browser-agent tasks.",
|
|
7
7
|
"permissions": [
|
|
8
8
|
"activeTab",
|
|
@@ -120,9 +120,9 @@
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
// policy.ts
|
|
123
|
-
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages", "callrest", "callgraphql", "sendmessage", "blockrequest", "mockresponse", "rewriteheaders", "setcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles", "attachcdp", "detachcdp", "cdpcmd", "overridescript"]);
|
|
123
|
+
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages", "callrest", "callgraphql", "sendmessage", "blockrequest", "mockresponse", "rewriteheaders", "setcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles", "attachcdp", "detachcdp", "cdpcmd", "overridescript", "heapshot", "profilecpu", "capturesourcemaps"]);
|
|
124
124
|
var interactionactions = /* @__PURE__ */ new Set(["focus", "scroll", "hover", "clickdeep", "rightclick", "doubleclick", "scrollpage", "scrollby", "scrollend", "scrolltop", "fullscreen", "zoomset", "movepointer", "clicktext", "clickaria", "clickname", "expanddetails", "pierceshadow", "retryaction", "capturebodies", "setbreakpoint", "stepcode", "watchexpr"]);
|
|
125
|
-
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs", "fetchurl", "parsejson", "parsehtml", "opensocket", "waitmessage", "watchrequests", "readheaders", "mapapi", "subscribesse", "longpoll", "extractapi", "readcookies", "watchconsole", "watcherrors", "watchtasks", "watchcdp"]);
|
|
125
|
+
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs", "fetchurl", "parsejson", "parsehtml", "opensocket", "waitmessage", "watchrequests", "readheaders", "mapapi", "subscribesse", "longpoll", "extractapi", "readcookies", "watchconsole", "watcherrors", "watchtasks", "watchcdp", "measureflow", "trackmemory", "watchshifts", "traceload", "annotatetrace", "replaytrace"]);
|
|
126
126
|
var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
|
|
127
127
|
function parseoptions(step) {
|
|
128
128
|
if (step.options === void 0) return {};
|
|
@@ -2544,7 +2544,9 @@
|
|
|
2544
2544
|
}
|
|
2545
2545
|
}
|
|
2546
2546
|
writeharness(harness);
|
|
2547
|
-
|
|
2547
|
+
const iframes = [...document.querySelectorAll("iframe[src]")].map((frame) => frame.src).filter((src) => src.startsWith("https://"));
|
|
2548
|
+
const serviceworker = "serviceWorker" in navigator && navigator.serviceWorker.controller ? navigator.serviceWorker.controller.scriptURL : void 0;
|
|
2549
|
+
return { ok: true, summary: `Attached the instrumented devtools harness with the reviewed domains ${options.domains.join(", ")} enabled.`, details: { attached: true, domains: [...harness.domains], targets: { iframes, ...serviceworker !== void 0 ? { serviceworker } : {} }, derivation: "The chrome devtools protocol needs the debugger permission, which the manifest gate forbids; the session runs through the page-instrumented harness injected by the scripting api and the iframe and service worker targets derive from the page frame list and controller state." } };
|
|
2548
2550
|
}
|
|
2549
2551
|
if (step.kind === "detachcdp") {
|
|
2550
2552
|
const harness = readharness();
|
|
@@ -2786,6 +2788,143 @@
|
|
|
2786
2788
|
return { ok: true, summary, details: { entries, console: consoleentries, errors, rejections, resources, longtasks, watchwindow: options.window, depth: options.depth, derivation: "Console, error and task watching derives from page-injected listeners and the performance buffers through the scripting api; no debugger permission exists in the manifest." } };
|
|
2787
2789
|
}
|
|
2788
2790
|
|
|
2791
|
+
// extension/pageprofile.ts
|
|
2792
|
+
function profilestepoptions(step) {
|
|
2793
|
+
let options = {};
|
|
2794
|
+
try {
|
|
2795
|
+
options = parseoptions(step);
|
|
2796
|
+
} catch {
|
|
2797
|
+
options = {};
|
|
2798
|
+
}
|
|
2799
|
+
const watch = options.watch && typeof options.watch === "object" && !Array.isArray(options.watch) ? options.watch : {};
|
|
2800
|
+
const flow = options.flow && typeof options.flow === "object" && !Array.isArray(options.flow) ? options.flow : void 0;
|
|
2801
|
+
const heap = options.heap && typeof options.heap === "object" && !Array.isArray(options.heap) ? options.heap : {};
|
|
2802
|
+
const growth = options.growth && typeof options.growth === "object" && !Array.isArray(options.growth) ? options.growth : void 0;
|
|
2803
|
+
const profile = options.profile && typeof options.profile === "object" && !Array.isArray(options.profile) ? options.profile : {};
|
|
2804
|
+
const trace = options.trace && typeof options.trace === "object" && !Array.isArray(options.trace) ? options.trace : {};
|
|
2805
|
+
return {
|
|
2806
|
+
...flow !== void 0 && typeof flow.prefix === "string" && Array.isArray(flow.steps) && Array.isArray(flow.metrics) ? { flow: { prefix: flow.prefix, steps: flow.steps.filter((item) => typeof item === "string"), metrics: flow.metrics.filter((item) => typeof item === "string") } } : {},
|
|
2807
|
+
watchwindow: typeof watch.window === "number" && Number.isFinite(watch.window) && watch.window >= 0 ? watch.window : 0,
|
|
2808
|
+
heapinterval: typeof heap.interval === "number" && Number.isFinite(heap.interval) && heap.interval >= 0 ? heap.interval : 0,
|
|
2809
|
+
...growth !== void 0 && typeof growth.slope === "number" ? { growth: { slope: growth.slope, interval: typeof growth.interval === "number" && Number.isFinite(growth.interval) && growth.interval >= 0 ? growth.interval : 0 } } : {},
|
|
2810
|
+
duration: typeof profile.duration === "number" && Number.isFinite(profile.duration) && profile.duration >= 0 ? profile.duration : 0,
|
|
2811
|
+
threshold: typeof options.threshold === "number" && Number.isFinite(options.threshold) && options.threshold >= 0 ? options.threshold : 0,
|
|
2812
|
+
categories: Array.isArray(trace.categories) ? trace.categories.filter((category) => typeof category === "string") : [],
|
|
2813
|
+
...typeof trace.exporttarget === "string" ? { exporttarget: trace.exporttarget } : {},
|
|
2814
|
+
...typeof trace.traceid === "string" ? { traceid: trace.traceid } : {},
|
|
2815
|
+
scripts: Array.isArray(options.scripts) ? options.scripts.filter((url) => typeof url === "string") : []
|
|
2816
|
+
};
|
|
2817
|
+
}
|
|
2818
|
+
function categoryof(entry, initiator) {
|
|
2819
|
+
if (entry.entryType === "navigation") return "navigation";
|
|
2820
|
+
if (entry.entryType === "paint" || entry.entryType === "largest-contentful-paint" || entry.entryType === "layout-shift") return "painting";
|
|
2821
|
+
if (entry.entryType === "resource") return initiator === "fetch" || initiator === "xmlhttprequest" ? "network" : "loading";
|
|
2822
|
+
return "scripting";
|
|
2823
|
+
}
|
|
2824
|
+
async function collectentries(watchwindow, types) {
|
|
2825
|
+
const rows = [];
|
|
2826
|
+
for (const type of ["navigation", "paint", "mark", "measure", "resource", "longtask"]) {
|
|
2827
|
+
for (const entry of performance.getEntriesByType(type)) {
|
|
2828
|
+
rows.push({ name: entry.name, type: entry.entryType, start: entry.startTime, duration: entry.duration, ...type === "resource" ? { initiator: entry.initiatorType } : {} });
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
if (types.length > 0) {
|
|
2832
|
+
await new Promise((resolve) => {
|
|
2833
|
+
const observer = new PerformanceObserver((list) => {
|
|
2834
|
+
for (const entry of list.getEntries()) rows.push({ name: entry.name, type: entry.entryType, start: entry.startTime, duration: entry.duration });
|
|
2835
|
+
});
|
|
2836
|
+
observer.observe({ entryTypes: types, buffered: true });
|
|
2837
|
+
window.setTimeout(() => {
|
|
2838
|
+
observer.disconnect();
|
|
2839
|
+
resolve();
|
|
2840
|
+
}, Math.max(0, watchwindow));
|
|
2841
|
+
});
|
|
2842
|
+
} else {
|
|
2843
|
+
await new Promise((resolve) => window.setTimeout(resolve, Math.max(0, watchwindow)));
|
|
2844
|
+
}
|
|
2845
|
+
return rows;
|
|
2846
|
+
}
|
|
2847
|
+
function heapsample() {
|
|
2848
|
+
const memory = performance.memory;
|
|
2849
|
+
return { usedbytes: memory?.usedJSHeapSize ?? 0, limitbytes: memory?.jsHeapSizeLimit ?? memory?.totalJSHeapSize ?? 0, nodecount: document.querySelectorAll("*").length };
|
|
2850
|
+
}
|
|
2851
|
+
async function runprofilestep(step) {
|
|
2852
|
+
const options = profilestepoptions(step);
|
|
2853
|
+
if (step.kind === "measureflow") {
|
|
2854
|
+
if (!options.flow || options.watchwindow <= 0) return { ok: false, summary: "The reviewed flow spec with its watch window is absent." };
|
|
2855
|
+
const started = performance.now();
|
|
2856
|
+
for (const stepid of options.flow.steps) performance.mark(`${options.flow.prefix}:${stepid}:start`);
|
|
2857
|
+
const entries = await collectentries(options.watchwindow, ["largest-contentful-paint", "first-input", "event", "longtask"]);
|
|
2858
|
+
for (const stepid of options.flow.steps) performance.mark(`${options.flow.prefix}:${stepid}:end`);
|
|
2859
|
+
for (const stepid of options.flow.steps) performance.measure(`${options.flow.prefix}:${stepid}`, `${options.flow.prefix}:${stepid}:start`, `${options.flow.prefix}:${stepid}:end`);
|
|
2860
|
+
return { ok: true, summary: `Marked the start and end of ${options.flow.steps.length} step${options.flow.steps.length === 1 ? "" : "s"} of the flow ${options.flow.prefix} and collected ${entries.length} performance entr${entries.length === 1 ? "y" : "ies"} for the reviewed window of ${options.watchwindow} milliseconds.`, details: { entries, watchwindow: options.watchwindow, started, derivation: "Flow measurement derives from the performance timeline buffers and the injected marks through the scripting api; no debugger permission exists in the manifest." } };
|
|
2861
|
+
}
|
|
2862
|
+
if (step.kind === "heapshot") {
|
|
2863
|
+
const sample = heapsample();
|
|
2864
|
+
return { ok: true, summary: `Captured the on demand heap sample of ${sample.usedbytes} used bytes against the ${sample.limitbytes} byte limit with ${sample.nodecount} dom node${sample.nodecount === 1 ? "" : "s"}.`, details: { ...sample, derivation: "Heap bytes derive from the page performance memory buffer and the node count from the dom because no heap profiler exists without the debugger permission." } };
|
|
2865
|
+
}
|
|
2866
|
+
if (step.kind === "trackmemory") {
|
|
2867
|
+
if (!options.growth) return { ok: false, summary: "The reviewed growth slope is absent." };
|
|
2868
|
+
const sample = heapsample();
|
|
2869
|
+
return { ok: true, summary: `Took the heap sample of ${sample.usedbytes} used bytes beside the step for the growth tracking of slope ${options.growth.slope} bytes per millisecond.`, details: { ...sample, slope: options.growth.slope, interval: options.growth.interval, derivation: "Growth samples derive from the page performance memory buffer beside every step of the run." } };
|
|
2870
|
+
}
|
|
2871
|
+
if (step.kind === "profilecpu") {
|
|
2872
|
+
if (options.duration <= 0) return { ok: false, summary: "The reviewed cpu profile duration is absent." };
|
|
2873
|
+
const started = performance.now();
|
|
2874
|
+
const entries = await collectentries(options.duration, ["longtask", "event", "first-input"]);
|
|
2875
|
+
const samples = entries.filter((entry) => entry.type === "longtask" || entry.type === "event" || entry.type === "first-input").map((entry) => ({ name: entry.name || entry.type, time: entry.duration }));
|
|
2876
|
+
return { ok: true, summary: `Profiled the cpu window of ${options.duration} milliseconds with ${samples.length} sample${samples.length === 1 ? "" : "s"} from the long task and event timing buffers.`, details: { samples, duration: options.duration, started, derivation: "Cpu samples derive from the long task attribution and event timing buffers because no sampling profiler exists without the debugger permission." } };
|
|
2877
|
+
}
|
|
2878
|
+
if (step.kind === "watchshifts") {
|
|
2879
|
+
if (options.watchwindow <= 0) return { ok: false, summary: "The reviewed layout shift window is absent." };
|
|
2880
|
+
const shifts = [];
|
|
2881
|
+
await new Promise((resolve) => {
|
|
2882
|
+
const observer = new PerformanceObserver((list) => {
|
|
2883
|
+
for (const entry of list.getEntries()) {
|
|
2884
|
+
const shift = entry;
|
|
2885
|
+
const selectors = (shift.sources ?? []).flatMap((source) => source.node instanceof Element ? [source.node.tagName.toLowerCase() + (source.node.id ? `#${source.node.id}` : "")] : []);
|
|
2886
|
+
const score = typeof shift.value === "number" ? shift.value : 0;
|
|
2887
|
+
if (options.threshold > 0 && score < options.threshold) continue;
|
|
2888
|
+
shifts.push({ score, starttime: shift.startTime, selectors });
|
|
2889
|
+
}
|
|
2890
|
+
});
|
|
2891
|
+
observer.observe({ entryTypes: ["layout-shift"], buffered: true });
|
|
2892
|
+
window.setTimeout(() => {
|
|
2893
|
+
observer.disconnect();
|
|
2894
|
+
resolve();
|
|
2895
|
+
}, options.watchwindow);
|
|
2896
|
+
});
|
|
2897
|
+
return { ok: true, summary: `Watched ${shifts.length} layout shift${shifts.length === 1 ? "" : "s"} for the reviewed window of ${options.watchwindow} milliseconds${options.threshold > 0 ? ` with the score threshold ${options.threshold}` : ""}.`, details: { shifts, watchwindow: options.watchwindow, derivation: "Layout shifts derive from the performance layout-shift buffer with the impacted element selectors of the shift sources." } };
|
|
2898
|
+
}
|
|
2899
|
+
if (step.kind === "traceload") {
|
|
2900
|
+
if (options.categories.length === 0 || options.watchwindow <= 0) return { ok: false, summary: "The reviewed trace categories or window are absent." };
|
|
2901
|
+
const started = performance.now();
|
|
2902
|
+
const entries = await collectentries(options.watchwindow, ["largest-contentful-paint", "first-input", "event", "longtask", "layout-shift"]);
|
|
2903
|
+
const events4 = entries.filter((entry) => options.categories.includes(categoryof({ name: entry.name, entryType: entry.type, startTime: entry.start, duration: entry.duration }, entry.initiator))).map((entry) => ({ name: entry.name, category: categoryof({ name: entry.name, entryType: entry.type, startTime: entry.start, duration: entry.duration }, entry.initiator), offset: Math.round(entry.start - started) }));
|
|
2904
|
+
return { ok: true, summary: `Recorded ${events4.length} trace event${events4.length === 1 ? "" : "s"} of the reviewed categories ${options.categories.join(", ")} for the window of ${options.watchwindow} milliseconds and derived the exportable trace file.`, details: { events: events4, categories: options.categories, watchwindow: options.watchwindow, started, ...options.exporttarget !== void 0 ? { exporttarget: options.exporttarget } : {}, derivation: "The trace file derives from the performance timeline entries of the reviewed categories; it is not the devtools binary trace format because no debugger permission exists in the manifest." } };
|
|
2905
|
+
}
|
|
2906
|
+
if (step.kind === "capturesourcemaps") {
|
|
2907
|
+
const scripts = [];
|
|
2908
|
+
for (const element of document.querySelectorAll("script[src]")) {
|
|
2909
|
+
const src = element.src;
|
|
2910
|
+
if (!src.startsWith(location.origin)) continue;
|
|
2911
|
+
if (options.scripts.length > 0 && !options.scripts.includes(src)) continue;
|
|
2912
|
+
let mapurl;
|
|
2913
|
+
try {
|
|
2914
|
+
const response = await fetch(src, { credentials: "same-origin" });
|
|
2915
|
+
const source = await response.text();
|
|
2916
|
+
const match = /[#@]\s*sourceMappingURL=(\S+)/.exec(source);
|
|
2917
|
+
if (match !== null && match[1] !== void 0) mapurl = new URL(match[1], src).toString();
|
|
2918
|
+
} catch {
|
|
2919
|
+
}
|
|
2920
|
+
scripts.push({ url: src, ...mapurl !== void 0 ? { mapurl } : {} });
|
|
2921
|
+
}
|
|
2922
|
+
const withmaps = scripts.filter((script) => script.mapurl !== void 0);
|
|
2923
|
+
return { ok: true, summary: `Read the sourceMappingURL declarations of ${scripts.length} same origin script${scripts.length === 1 ? "" : "s"} of ${location.origin} and found ${withmaps.length} map declaration${withmaps.length === 1 ? "" : "s"}; the script sources stay in the page bridge and only the map urls leave it.`, details: { scripts, origin: location.origin, derivation: "Source map declarations are read by re-fetching the loaded same origin scripts of the page; cross origin scripts stay outside the capture and no map content enters the page bridge." } };
|
|
2924
|
+
}
|
|
2925
|
+
return { ok: false, summary: "The profiling step is not part of the instrumented family." };
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2789
2928
|
// extension/pageforms.ts
|
|
2790
2929
|
function matchfield(fields, match) {
|
|
2791
2930
|
const key = match.mode === "label" ? "label" : match.mode === "placeholder" ? "placeholder" : match.mode === "arialabel" ? "arialabel" : "name";
|
|
@@ -3660,6 +3799,7 @@
|
|
|
3660
3799
|
var watchstepkinds = /* @__PURE__ */ new Set(["watchmutate", "watchbanner", "watchfocus", "waitquiet", "readjson", "diffsnapshots", "deriveselector"]);
|
|
3661
3800
|
var debugstepkinds = /* @__PURE__ */ new Set(["watchconsole", "watcherrors", "watchtasks"]);
|
|
3662
3801
|
var cdpstepkinds = /* @__PURE__ */ new Set(["attachcdp", "detachcdp", "cdpcmd", "watchcdp", "setbreakpoint", "stepcode", "watchexpr", "overridescript"]);
|
|
3802
|
+
var profilestepkinds = /* @__PURE__ */ new Set(["measureflow", "heapshot", "trackmemory", "profilecpu", "watchshifts", "traceload", "capturesourcemaps"]);
|
|
3663
3803
|
var navstepkinds = /* @__PURE__ */ new Set(["waitload", "waiturl", "followlink", "spanav", "spawait", "rewritequery", "setfragment", "stopnav", "prefetch", "preconnect", "printpdf"]);
|
|
3664
3804
|
var formkinds = /* @__PURE__ */ new Set(["fillform", "filllabel", "fillplaceholder", "detectfields", "generatevalues", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "asksubmit", "submitform", "consentpassword", "attachfile"]);
|
|
3665
3805
|
var wizardkinds = /* @__PURE__ */ new Set(["runwizard", "selectchain", "picktypeahead", "pickdate", "fillcard", "fillcode"]);
|
|
@@ -3727,6 +3867,7 @@
|
|
|
3727
3867
|
else if (watchstepkinds.has(step.kind)) result = runpagewatch(step, element, rootdocument);
|
|
3728
3868
|
else if (debugstepkinds.has(step.kind)) return await rundebugwatch(step);
|
|
3729
3869
|
else if (cdpstepkinds.has(step.kind)) return await runcdpstep(step);
|
|
3870
|
+
else if (profilestepkinds.has(step.kind)) return await runprofilestep(step);
|
|
3730
3871
|
else if (mutatingkinds.has(step.kind)) result = runpageaction(step, element);
|
|
3731
3872
|
else {
|
|
3732
3873
|
if (!element) return { ok: false, summary: "Action target is no longer available." };
|