webidl2js
Advanced tools
Comparing version 4.3.3 to 5.0.0
@@ -19,3 +19,3 @@ "use strict"; | ||
const configurable = utils.getExtAttr(this.idl.extAttrs, "Unforgeable") ? "false" : "true"; | ||
const configurable = !utils.getExtAttr(this.idl.extAttrs, "Unforgeable"); | ||
const shouldReflect = utils.getExtAttr(this.idl.extAttrs, "Reflect"); | ||
@@ -25,3 +25,3 @@ | ||
let definedOn = this.obj.name + (this.idl.static ? "" : ".prototype"); | ||
if (configurable === "false") { // we're in a setup method and define an Unforgeable attribute | ||
if (!configurable || utils.isGlobal(this.interface)) { // we're in a setup method | ||
objName = `obj`; | ||
@@ -66,6 +66,16 @@ definedOn = `obj`; | ||
},`; | ||
} else if (utils.getExtAttr(this.idl.extAttrs, "Replaceable")) { | ||
str += ` | ||
set(V) { | ||
Object.defineProperty(this, "${this.idl.name}", { | ||
configurable: true, | ||
enumerable: true, | ||
value: V, | ||
writable: true | ||
}); | ||
},`; | ||
} | ||
str += ` | ||
enumerable: true, | ||
configurable: ${configurable} | ||
configurable: ${JSON.stringify(configurable)} | ||
});\n\n`; | ||
@@ -72,0 +82,0 @@ |
@@ -184,3 +184,3 @@ "use strict"; | ||
const memberIdl = this.idl.members[i]; | ||
if (memberIdl.type === "attribute" && utils.getExtAttr(memberIdl.extAttrs, "Unforgeable")) { | ||
if (memberIdl.type === "attribute" && (utils.getExtAttr(memberIdl.extAttrs, "Unforgeable") || utils.isGlobal(this.idl))) { | ||
const member = new Attribute(this, this.idl, memberIdl); | ||
@@ -258,3 +258,3 @@ this.str += "\n " + member.generate().body.replace(/\n/g, '\n '); | ||
case "attribute": | ||
if (utils.getExtAttr(memberIdl.extAttrs, "Unforgeable")) { | ||
if (utils.getExtAttr(memberIdl.extAttrs, "Unforgeable") || utils.isGlobal(this.idl)) { | ||
break; | ||
@@ -261,0 +261,0 @@ } |
@@ -11,2 +11,8 @@ "use strict"; | ||
return null; | ||
}; | ||
}; | ||
module.exports.isGlobal = function isGlobal(idl) { | ||
const isGlobal = !!module.exports.getExtAttr(idl.extAttrs, "Global") || | ||
!!module.exports.getExtAttr(idl.extAttrs, "PrimaryGlobal"); | ||
return isGlobal; | ||
}; |
{ | ||
"name": "webidl2js", | ||
"version": "4.3.3", | ||
"version": "5.0.0", | ||
"description": "Auto-generates class structures for WebIDL specifications", | ||
"main": "index.js", | ||
"main": "lib/transformer.js", | ||
"dependencies": { | ||
"fs-extra": "~0.23.1", | ||
"webidl2": "^2.0.11", | ||
"webidl-conversions": "^2.0.0" | ||
"co": "^4.6.0", | ||
"pn": "^1.0.0", | ||
"webidl-conversions": "^2.0.0", | ||
"webidl2": "^2.0.11" | ||
}, | ||
@@ -11,0 +12,0 @@ "devDependencies": {}, |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
36477
16
1059
2
4
+ Addedco@^4.6.0
+ Addedpn@^1.0.0
+ Addedco@4.6.0(transitive)
+ Addedpn@1.1.0(transitive)
- Removedfs-extra@~0.23.1
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs-extra@0.23.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedjsonfile@2.4.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedwrappy@1.0.2(transitive)