aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen/Configuration.py
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-12 14:50:07 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-12-02 22:15:11 +0100
commit60976406cc6ddf99b3d3a512dce0b4fd01b686f1 (patch)
treec32f5beeacaeab0375e7dfcaa79c34d21ca7bf00 /components/script/dom/bindings/codegen/Configuration.py
parent29c42a9f78a20ddeb5aa89b79d578a039c087967 (diff)
downloadservo-60976406cc6ddf99b3d3a512dce0b4fd01b686f1.tar.gz
servo-60976406cc6ddf99b3d3a512dce0b4fd01b686f1.zip
Implement [Unforgeable]
This is mostly stolen from Gecko. As there, we define the unforgeable members on an object stored in the slots of the prototype object. They are then copied onto instance objects when they are instantiated. It should be noted that proxy objects see their unforgeable memebers defined on their expando object. Unforgeable attributes aren't properly inherited in codegen (in a similar fashion as getters and setters as filed in #5875) and require to be redefined in derived interfaces. Fortunately, there are currently no such interfaces. No unforgeable members can be included into the TestBinding interfaces for good measure because they are not compatible with setters. Given the unforgeable holder object has the same prototype as actual instances of the interface, the finalize hook needs to check its slot pointer for nullity before dropping it. The new failing test isn't related to Unforgeable attributes, but to the fact that all Document instances currently have a Location, even if their window isn't in a browsing context.
Diffstat (limited to 'components/script/dom/bindings/codegen/Configuration.py')
-rw-r--r--components/script/dom/bindings/codegen/Configuration.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/Configuration.py b/components/script/dom/bindings/codegen/Configuration.py
index 4f59ff09f5b..d0af7e37929 100644
--- a/components/script/dom/bindings/codegen/Configuration.py
+++ b/components/script/dom/bindings/codegen/Configuration.py
@@ -139,6 +139,13 @@ class DescriptorProvider:
return self.config.getDescriptor(interfaceName)
+def MemberIsUnforgeable(member, descriptor):
+ return ((member.isAttr() or member.isMethod()) and
+ not member.isStatic() and
+ (member.isUnforgeable() or
+ bool(descriptor.interface.getExtendedAttribute("Unforgeable"))))
+
+
class Descriptor(DescriptorProvider):
"""
Represents a single descriptor for an interface. See Bindings.conf.
@@ -174,6 +181,9 @@ class Descriptor(DescriptorProvider):
# them as having a concrete descendant.
self.concrete = (not self.interface.isCallback() and
desc.get('concrete', True))
+ self.hasUnforgeableMembers = (self.concrete and
+ any(MemberIsUnforgeable(m, self) for m in
+ self.interface.members))
self.operations = {
'IndexedGetter': None,