Skip to content

Commit 3e82973

Browse files
committed
fix(stealth): address Copilot review findings [CL-2]
- Guard err.stack in generateErrorObject before cleanErrorStack/splitStack - Fix propertyCollection guard to check .length instead of comparing object to string - Fix typos: Depcrecated→Deprecated, AudioContenxt→AudioContext - Remove stale TODO comment in iframe contentWindow instrumentation
1 parent 379b771 commit 3e82973

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

Extension/src/stealth/error.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ function generateErrorObject(
55
err: { stack: any; name: string | number; message: any },
66
context = undefined,
77
) {
8+
if (!err || typeof err.stack !== "string") return err;
89
context = context !== undefined ? context : window;
910
const cleaned = cleanErrorStack(err.stack);
1011
const stack = splitStack(cleaned);

Extension/src/stealth/instrument.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ function startInstrument(context) {
854854
continue;
855855
}
856856
// Instrument each Property per object/prototype
857-
if (propertyCollection[0] !== "") {
857+
if (propertyCollection.length > 0) {
858858
propertyCollection.forEach(({ depth, propertyNames, object }) => {
859859
if (needsWrapper(object)) {
860860
propertyNames.forEach((propertyName) =>

Extension/src/stealth/settings.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { JSInstrumentSettings } from "../types/js_instrument_settings";
22

33
export const jsInstrumentationSettings: JSInstrumentSettings = [
44
{
5-
object: "ScriptProcessorNode", // Depcrecated. Replaced by AudioWorkletNode
5+
object: "ScriptProcessorNode", // Deprecated. Replaced by AudioWorkletNode
66
instrumentedName: "ScriptProcessorNode",
77
depth: 0,
88
logSettings: {
@@ -146,10 +146,10 @@ export const jsInstrumentationSettings: JSInstrumentSettings = [
146146
},
147147
},
148148

149-
// Add shared prototype by AudioContenxt/OfflineAudioContext
149+
// Add shared prototype by AudioContext/OfflineAudioContext
150150
{
151151
object: "AudioContext",
152-
instrumentedName: "[AudioContenxt|OfflineAudioContext]",
152+
instrumentedName: "[AudioContext|OfflineAudioContext]",
153153
depth: 1,
154154
logSettings: {
155155
propertiesToInstrument: [],

Extension/src/stealth/stealth.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ function protectFrameProperties({
164164
constructor.prototype,
165165
"contentWindow",
166166
);
167-
// TODO: Continue here!!!!
168167
const originalContentWindowGetter = contentWindowDescriptor.get;
169168
const contentWindowTemp = {
170169
get contentWindow() {

0 commit comments

Comments
 (0)