diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-10-18 16:31:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-18 16:31:17 -0400 |
commit | 118a9ecdfe5005a0f3328c362ce8d7a7f1b52912 (patch) | |
tree | 15d2a2da978411577d71e47d170d89961fb4f661 /components/script/dom/bindings/codegen | |
parent | 83fb2b06d064589b12fc9f573a97ef85598f1980 (diff) | |
parent | 1c717bc086c7f464c743a8f054461b8c88b03444 (diff) | |
download | servo-118a9ecdfe5005a0f3328c362ce8d7a7f1b52912.tar.gz servo-118a9ecdfe5005a0f3328c362ce8d7a7f1b52912.zip |
Auto merge of #24476 - saschanaz:nonenumerable, r=jdm
Mark @@iterator as nonenumerable
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15497
<!-- Either: -->
- [x] There are tests for these changes
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 17ec39913d6..ad76ef5d8d3 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1637,6 +1637,7 @@ class MethodDefiner(PropertyDefiner): self.regular = [{"name": m.identifier.name, "methodInfo": not m.isStatic(), "length": methodLength(m), + "flags": "JSPROP_ENUMERATE", "condition": PropertyDefiner.getControllingCondition(m, descriptor)} for m in methods] @@ -1646,6 +1647,7 @@ class MethodDefiner(PropertyDefiner): "methodInfo": False, "selfHostedName": "ArrayValues", "length": 0, + "flags": "0", # Not enumerable, per spec. "condition": "Condition::Satisfied"}) # Generate the keys/values/entries aliases for value iterables. @@ -1660,6 +1662,7 @@ class MethodDefiner(PropertyDefiner): "methodInfo": False, "selfHostedName": "ArrayKeys", "length": 0, + "flags": "JSPROP_ENUMERATE", "condition": PropertyDefiner.getControllingCondition(m, descriptor) }) @@ -1668,6 +1671,7 @@ class MethodDefiner(PropertyDefiner): "methodInfo": False, "selfHostedName": "ArrayValues", "length": 0, + "flags": "JSPROP_ENUMERATE", "condition": PropertyDefiner.getControllingCondition(m, descriptor) }) @@ -1676,6 +1680,7 @@ class MethodDefiner(PropertyDefiner): "methodInfo": False, "selfHostedName": "ArrayEntries", "length": 0, + "flags": "JSPROP_ENUMERATE", "condition": PropertyDefiner.getControllingCondition(m, descriptor) }) @@ -1684,6 +1689,7 @@ class MethodDefiner(PropertyDefiner): "methodInfo": False, "selfHostedName": "ArrayForEach", "length": 1, + "flags": "JSPROP_ENUMERATE", "condition": PropertyDefiner.getControllingCondition(m, descriptor) }) @@ -1696,6 +1702,7 @@ class MethodDefiner(PropertyDefiner): "name": "toString", "nativeName": stringifier.identifier.name, "length": 0, + "flags": "JSPROP_ENUMERATE", "condition": PropertyDefiner.getControllingCondition(stringifier, descriptor) }) self.unforgeable = unforgeable @@ -1707,13 +1714,10 @@ class MethodDefiner(PropertyDefiner): def condition(m, d): return m["condition"] - flags = "JSPROP_ENUMERATE" - if self.unforgeable: - flags += " | JSPROP_PERMANENT | JSPROP_READONLY" - def specData(m): - # TODO: Use something like JS_FNSPEC - # https://github.com/servo/servo/issues/6391 + flags = m["flags"] + if self.unforgeable: + flags += " | JSPROP_PERMANENT | JSPROP_READONLY" if "selfHostedName" in m: selfHostedName = '%s as *const u8 as *const libc::c_char' % str_to_const_array(m["selfHostedName"]) assert not m.get("methodInfo", True) @@ -3075,12 +3079,14 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null()); symbolJSID=symbolJSID)) defineFn = "JS_DefinePropertyById2" prop = "iteratorId.handle()" + enumFlags = "0" # Not enumerable, per spec. elif alias.startswith("@@"): raise TypeError("Can't handle any well-known Symbol other than @@iterator") else: getSymbolJSID = None defineFn = "JS_DefineProperty" prop = '"%s"' % alias + enumFlags = "JSPROP_ENUMERATE" return CGList([ getSymbolJSID, # XXX If we ever create non-enumerable properties that can @@ -3089,10 +3095,11 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null()); CGGeneric(fill( """ assert!(${defineFn}(*cx, prototype.handle(), ${prop}, aliasedVal.handle(), - JSPROP_ENUMERATE as u32)); + ${enumFlags} as u32)); """, defineFn=defineFn, - prop=prop)) + prop=prop, + enumFlags=enumFlags)) ], "\n") def defineAliasesFor(m): |