Skip to content

Commit

Permalink
fix: processing script with private identifier (closes DevExpress/tes…
Browse files Browse the repository at this point in the history
…tcafe#8067) (#2979)

* fix: private identifier

* add ts-ignore

* bump: esotope-hammerhead
  • Loading branch information
PavelMor25 authored Nov 23, 2023
1 parent 0113d2d commit bade0f6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"bowser": "1.6.0",
"crypto-md5": "^1.0.0",
"debug": "4.3.1",
"esotope-hammerhead": "0.6.6",
"esotope-hammerhead": "0.6.7",
"http-cache-semantics": "^4.1.0",
"httpntlm": "^1.8.10",
"iconv-lite": "0.5.1",
Expand Down
5 changes: 5 additions & 0 deletions src/processing/script/transformers/property-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const transformer: Transformer<MemberExpression> = {
if (node.property.type === Syntax.Identifier && !shouldInstrumentProperty(node.property.name))
return false;

// Skip: object.#prop
// @ts-ignore
if (node.property.type === Syntax.PrivateIdentifier)
return false;

// Skip: super.prop
if (node.object.type === Syntax.Super)
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ if (!browserUtils.isIOS) {
});

test('private identifier and property definition without value', function () {
var script = `const Nc = new class {#a; constructor(){this.#a = 4;}; output(){return this.#a;};}; window.prop = Nc.output()`;
var script = `class s{#a; constructor(){this.#a = 4;}; output(){return this.#a;};}; window.prop = new s().output()`;

eval(processScript(script));

Expand Down

0 comments on commit bade0f6

Please sign in to comment.