Skip to content

Commit 246f799

Browse files
committed
fix: Expose globalObject on proxyHandler [CEReactions] methods
1 parent 2aecfb6 commit 246f799

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/constructs/interface.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ class Interface {
639639
`"Failed to set the " + index + " property on '${this.name}': The provided value"`);
640640
this.requires.merge(conv.requires);
641641

642-
const prolog = `
642+
let prolog = `
643643
const index = ${P} >>> 0;
644644
let indexedValue = ${V};
645645
${conv.body}
@@ -662,6 +662,8 @@ class Interface {
662662
}
663663

664664
if (utils.hasCEReactions(this.indexedSetter)) {
665+
prolog = `const globalObject = ${O}[impl]._globalObject;` + prolog;
666+
665667
invocation = this.ctx.invokeProcessCEReactions(invocation, {
666668
requires: this.requires
667669
});
@@ -678,7 +680,7 @@ class Interface {
678680
`"Failed to set the '" + ${P} + "' property on '${this.name}': The provided value"`);
679681
this.requires.merge(conv.requires);
680682

681-
const prolog = `
683+
let prolog = `
682684
let namedValue = ${V};
683685
${conv.body}
684686
`;
@@ -701,6 +703,9 @@ class Interface {
701703
}
702704

703705
if (utils.hasCEReactions(this.namedSetter)) {
706+
prolog = `
707+
const globalObject = ${O}[impl]._globalObject;` + prolog;
708+
704709
invocation = this.ctx.invokeProcessCEReactions(invocation, {
705710
requires: this.requires
706711
});

test/__snapshots__/test.js.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,7 @@ const proxyHandler = {
502502
}
503503
if (target === receiver) {
504504
if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) {
505+
const globalObject = target[impl]._globalObject;
505506
let namedValue = V;
506507

507508
namedValue = conversions[\\"DOMString\\"](namedValue, {
@@ -566,6 +567,7 @@ const proxyHandler = {
566567
return false;
567568
}
568569

570+
const globalObject = target[impl]._globalObject;
569571
let namedValue = desc.value;
570572

571573
namedValue = conversions[\\"DOMString\\"](namedValue, {
@@ -8101,6 +8103,7 @@ const proxyHandler = {
81018103
}
81028104
if (target === receiver) {
81038105
if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) {
8106+
const globalObject = target[impl]._globalObject;
81048107
let namedValue = V;
81058108

81068109
namedValue = conversions[\\"DOMString\\"](namedValue, {
@@ -8160,6 +8163,7 @@ const proxyHandler = {
81608163
return false;
81618164
}
81628165

8166+
const globalObject = target[impl]._globalObject;
81638167
let namedValue = desc.value;
81648168

81658169
namedValue = conversions[\\"DOMString\\"](namedValue, {

0 commit comments

Comments
 (0)