@@ -404,7 +404,7 @@ class Interface {
404
404
value: function next() {
405
405
const internal = this[utils.iterInternalSymbol];
406
406
const { target, kind, index } = internal;
407
- const values = Array.from(target[implSymbol ]);
407
+ const values = Array.from(target[impl ]);
408
408
const len = values.length;
409
409
if (index >= len) {
410
410
return { value: undefined, done: true };
@@ -498,9 +498,9 @@ class Interface {
498
498
}
499
499
500
500
generateRequires ( ) {
501
- this . requires . addRaw ( "implSymbol" , "utils.implSymbol" ) ;
501
+ this . requires . addRaw ( "impl" , "utils.implSymbol" ) ;
502
+ this . requires . addRaw ( "ctorRegistry" , "utils.ctorRegistrySymbol" ) ;
502
503
this . requires . addRaw ( "wrapperSymbol" , "utils.wrapperSymbol" ) ;
503
- this . requires . addRaw ( "ctorRegistrySymbol" , "utils.ctorRegistrySymbol" ) ;
504
504
this . requires . addRaw ( "globalObjectSymbol" , "utils.globalObjectSymbol" ) ;
505
505
this . requires . addRaw ( "createWrapperSymbol" , "utils.createWrapperSymbol" ) ;
506
506
@@ -537,7 +537,7 @@ class Interface {
537
537
exports._mixedIntoPredicates = [];
538
538
exports.is = function is(obj) {
539
539
if (obj) {
540
- if (utils.hasOwn(obj, implSymbol ) && obj[implSymbol ] instanceof Impl.implementation) {
540
+ if (utils.hasOwn(obj, impl ) && obj[impl ] instanceof Impl.implementation) {
541
541
return true;
542
542
}
543
543
for (const isMixedInto of exports._mixedIntoPredicates) {
@@ -598,10 +598,10 @@ class Interface {
598
598
}
599
599
if ( unsupportedValue ) {
600
600
const func = this . indexedGetter . name ? `.${ this . indexedGetter . name } ` : "[utils.indexedGet]" ;
601
- const value = indexedValue || `${ O } [implSymbol ]${ func } (${ index } )` ;
601
+ const value = indexedValue || `${ O } [impl ]${ func } (${ index } )` ;
602
602
return `${ value } !== ${ unsupportedValue } ` ;
603
603
}
604
- return `${ O } [implSymbol ][utils.supportsPropertyIndex](${ index } )` ;
604
+ return `${ O } [impl ][utils.supportsPropertyIndex](${ index } )` ;
605
605
} ;
606
606
607
607
const supportsPropertyName = ( O , P , namedValue ) => {
@@ -611,10 +611,10 @@ class Interface {
611
611
}
612
612
if ( unsupportedValue ) {
613
613
const func = this . namedGetter . name ? `.${ this . namedGetter . name } ` : "[utils.namedGet]" ;
614
- const value = namedValue || `${ O } [implSymbol ]${ func } (${ P } )` ;
614
+ const value = namedValue || `${ O } [impl ]${ func } (${ P } )` ;
615
615
return `${ value } !== ${ unsupportedValue } ` ;
616
616
}
617
- return `${ O } [implSymbol ][utils.supportsPropertyName](${ P } )` ;
617
+ return `${ O } [impl ][utils.supportsPropertyName](${ P } )` ;
618
618
} ;
619
619
620
620
// "named property visibility algorithm"
@@ -651,14 +651,14 @@ class Interface {
651
651
str += `
652
652
const creating = !(${ supportsPropertyIndex ( O , "index" ) } );
653
653
if (creating) {
654
- ${ O } [implSymbol ][utils.indexedSetNew](index, indexedValue);
654
+ ${ O } [impl ][utils.indexedSetNew](index, indexedValue);
655
655
} else {
656
- ${ O } [implSymbol ][utils.indexedSetExisting](index, indexedValue);
656
+ ${ O } [impl ][utils.indexedSetExisting](index, indexedValue);
657
657
}
658
658
` ;
659
659
} else {
660
660
str += `
661
- ${ O } [implSymbol ].${ this . indexedSetter . name } (index, indexedValue);
661
+ ${ O } [impl ].${ this . indexedSetter . name } (index, indexedValue);
662
662
` ;
663
663
}
664
664
@@ -682,14 +682,14 @@ class Interface {
682
682
str += `
683
683
const creating = !(${ supportsPropertyName ( O , P ) } );
684
684
if (creating) {
685
- ${ O } [implSymbol ][utils.namedSetNew](${ P } , namedValue);
685
+ ${ O } [impl ][utils.namedSetNew](${ P } , namedValue);
686
686
} else {
687
- ${ O } [implSymbol ][utils.namedSetExisting](${ P } , namedValue);
687
+ ${ O } [impl ][utils.namedSetExisting](${ P } , namedValue);
688
688
}
689
689
` ;
690
690
} else {
691
691
str += `
692
- ${ O } [implSymbol ].${ this . namedSetter . name } (${ P } , namedValue);
692
+ ${ O } [impl ].${ this . namedSetter . name } (${ P } , namedValue);
693
693
` ;
694
694
}
695
695
@@ -752,14 +752,14 @@ class Interface {
752
752
` ;
753
753
if ( this . supportsIndexedProperties ) {
754
754
this . str += `
755
- for (const key of target[implSymbol ][utils.supportedPropertyIndices]) {
755
+ for (const key of target[impl ][utils.supportedPropertyIndices]) {
756
756
keys.add(\`\${key}\`);
757
757
}
758
758
` ;
759
759
}
760
760
if ( this . supportsNamedProperties ) {
761
761
this . str += `
762
- for (const key of target[implSymbol ][utils.supportedPropertyNames]) {
762
+ for (const key of target[impl ][utils.supportedPropertyNames]) {
763
763
if (${ namedPropertyVisible ( "key" , "target" , true ) } ) {
764
764
keys.add(\`\${key}\`);
765
765
}
@@ -792,10 +792,10 @@ class Interface {
792
792
let preamble = "" ;
793
793
let condition ;
794
794
if ( utils . getExtAttr ( this . indexedGetter . extAttrs , "WebIDL2JSValueAsUnsupported" ) ) {
795
- this . str += `const indexedValue = target[implSymbol ]${ func } (index);` ;
795
+ this . str += `const indexedValue = target[impl ]${ func } (index);` ;
796
796
condition = supportsPropertyIndex ( "target" , "index" , "indexedValue" ) ;
797
797
} else {
798
- preamble = `const indexedValue = target[implSymbol ]${ func } (index);` ;
798
+ preamble = `const indexedValue = target[impl ]${ func } (index);` ;
799
799
condition = supportsPropertyIndex ( "target" , "index" ) ;
800
800
}
801
801
@@ -820,13 +820,13 @@ class Interface {
820
820
const conditions = [ ] ;
821
821
if ( utils . getExtAttr ( this . namedGetter . extAttrs , "WebIDL2JSValueAsUnsupported" ) ) {
822
822
this . str += `
823
- const namedValue = target[implSymbol ]${ func } (P);
823
+ const namedValue = target[impl ]${ func } (P);
824
824
` ;
825
825
conditions . push ( supportsPropertyName ( "target" , "index" , "namedValue" ) ) ;
826
826
conditions . push ( namedPropertyVisible ( "P" , "target" , true ) ) ;
827
827
} else {
828
828
preamble = `
829
- const namedValue = target[implSymbol ]${ func } (P);
829
+ const namedValue = target[impl ]${ func } (P);
830
830
` ;
831
831
conditions . push ( namedPropertyVisible ( "P" , "target" , false ) ) ;
832
832
}
@@ -902,10 +902,10 @@ class Interface {
902
902
let preamble = "" ;
903
903
let condition ;
904
904
if ( utils . getExtAttr ( this . indexedGetter . extAttrs , "WebIDL2JSValueAsUnsupported" ) ) {
905
- this . str += `const indexedValue = target[implSymbol ]${ func } (index);` ;
905
+ this . str += `const indexedValue = target[impl ]${ func } (index);` ;
906
906
condition = supportsPropertyIndex ( "target" , "index" , "indexedValue" ) ;
907
907
} else {
908
- preamble = `const indexedValue = target[implSymbol ]${ func } (index);` ;
908
+ preamble = `const indexedValue = target[impl ]${ func } (index);` ;
909
909
condition = supportsPropertyIndex ( "target" , "index" ) ;
910
910
}
911
911
@@ -1071,11 +1071,11 @@ class Interface {
1071
1071
const func = this . namedDeleter . name ? `.${ this . namedDeleter . name } ` : "[utils.namedDelete]" ;
1072
1072
if ( this . namedDeleter . idlType . idlType === "bool" ) {
1073
1073
this . str += `
1074
- return target[implSymbol ]${ func } (P);
1074
+ return target[impl ]${ func } (P);
1075
1075
` ;
1076
1076
} else {
1077
1077
this . str += `
1078
- target[implSymbol ]${ func } (P);
1078
+ target[impl ]${ func } (P);
1079
1079
return true;
1080
1080
` ;
1081
1081
}
@@ -1103,51 +1103,55 @@ class Interface {
1103
1103
1104
1104
generateIface ( ) {
1105
1105
this . str += `
1106
- function createWrapper(impl ) {
1107
- const globalObject = impl [globalObjectSymbol];
1106
+ function createWrapper(implObject ) {
1107
+ const globalObject = implObject [globalObjectSymbol];
1108
1108
1109
- if (globalObject[ctorRegistrySymbol ] === undefined) {
1109
+ if (globalObject[ctorRegistry ] === undefined) {
1110
1110
throw new Error('Internal error: invalid global object');
1111
1111
}
1112
1112
1113
- const ctor = globalObject[ctorRegistrySymbol ]["${ this . name } "];
1113
+ const ctor = globalObject[ctorRegistry ]["${ this . name } "];
1114
1114
if (ctor === undefined) {
1115
1115
throw new Error('Internal error: constructor ${ this . name } is not installed on the passed global object');
1116
1116
}
1117
1117
1118
- let wrapper = Object.create(ctor.prototype);
1119
- exports._internalSetup(wrapper );
1118
+ let wrapperObject = Object.create(ctor.prototype);
1119
+ exports._internalSetup(wrapperObject );
1120
1120
` ;
1121
1121
1122
1122
if ( this . isLegacyPlatformObj ) {
1123
1123
this . str += `
1124
- wrapper = new Proxy(wrapper , proxyHandler);
1124
+ wrapperObject = new Proxy(wrapperObject , proxyHandler);
1125
1125
` ;
1126
1126
}
1127
1127
1128
1128
this . str += `
1129
- impl [wrapperSymbol] = wrapper ;
1130
- wrapper[implSymbol ] = impl ;
1131
- return wrapper ;
1129
+ implObject [wrapperSymbol] = wrapperObject ;
1130
+ wrapperObject[impl ] = implObject ;
1131
+ return wrapperObject ;
1132
1132
};
1133
1133
exports.create = function create(globalObject, constructorArgs, privateData) {
1134
- const impl = exports.createImpl(globalObject, constructorArgs, privateData);
1135
- return utils.wrapperForImpl(impl );
1134
+ const implObject = exports.createImpl(globalObject, constructorArgs, privateData);
1135
+ return utils.wrapperForImpl(implObject );
1136
1136
};
1137
1137
exports.createImpl = function createImpl(globalObject, constructorArgs = [], privateData = {}) {
1138
- const impl = new Impl.implementation(globalObject, constructorArgs, privateData);
1138
+ const implObject = new Impl.implementation(globalObject, constructorArgs, privateData);
1139
1139
1140
- impl [wrapperSymbol] = null;
1141
- impl [globalObjectSymbol] = globalObject;
1142
- impl [createWrapperSymbol] = createWrapper;
1140
+ implObject [wrapperSymbol] = null;
1141
+ implObject [globalObjectSymbol] = globalObject;
1142
+ implObject [createWrapperSymbol] = createWrapper;
1143
1143
1144
- return impl ;
1144
+ return implObject ;
1145
1145
};
1146
- exports.setup = function setup(wrapper, globalObject, constructorArgs = [], privateData = {}) {
1147
- const impl = exports.createImpl(globalObject, constructorArgs, privateData);
1148
- impl[wrapperSymbol] = wrapper;
1149
- wrapper[implSymbol] = impl;
1150
- return wrapper;
1146
+ exports.setup = function setup(wrapperObject, globalObject, constructorArgs = [], privateData = {}) {
1147
+ const implObject = exports.createImpl(globalObject, constructorArgs, privateData);
1148
+
1149
+ implObject[wrapperSymbol] = wrapperObject;
1150
+ wrapperObject[impl] = implObject;
1151
+
1152
+ exports._internalSetup(wrapperObject);
1153
+
1154
+ return wrapperObject;
1151
1155
};
1152
1156
exports._internalSetup = function _internalSetup(obj) {
1153
1157
` ;
@@ -1445,10 +1449,10 @@ class Interface {
1445
1449
this . generateOffInstanceAfterClass ( ) ;
1446
1450
1447
1451
this . str += `
1448
- if (globalObject[ctorRegistrySymbol ] === undefined) {
1449
- globalObject[ctorRegistrySymbol ] = Object.create(null);
1452
+ if (globalObject[ctorRegistry ] === undefined) {
1453
+ globalObject[ctorRegistry ] = Object.create(null);
1450
1454
}
1451
- globalObject[ctorRegistrySymbol ]["${ name } "] = ${ name } ;
1455
+ globalObject[ctorRegistry ]["${ name } "] = ${ name } ;
1452
1456
1453
1457
Object.defineProperty(globalObject, "${ name } ", {
1454
1458
configurable: true,
0 commit comments