Bug 1520509. Remove the unused support for CrossOriginWritable=InterfaceName in Web IDL. r=qdot
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 18 Jan 2019 22:11:04 +0000
changeset 514743 fcef3b13bb1c0ea091dc09a07e35ad758e0a56f2
parent 514742 4aafc1f415adc5a3ab80630b94291968b3a84eb2
child 514744 e25a1ed32b5347b86843580e66b344bf11dcceba
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersqdot
bugs1520509
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1520509. Remove the unused support for CrossOriginWritable=InterfaceName in Web IDL. r=qdot Differential Revision: https://phabricator.services.mozilla.com/D16712
dom/bindings/Codegen.py
dom/bindings/parser/WebIDL.py
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -2581,48 +2581,32 @@ class MethodDefiner(PropertyDefiner):
         return self.generatePrefableArray(
             array, name,
             self.formatSpec,
             '  JS_FS_END',
             'JSFunctionSpec',
             self.condition, functools.partial(self.specData, unforgeable=self.unforgeable))
 
 
-def isCrossOriginWritable(attr, descriptor):
-    """
-    Return whether the IDLAttribute in question is cross-origin writable on the
-    interface represented by descriptor.  This is needed to handle the fact that
-    some, but not all, interfaces implementing URLUtils want a cross-origin
-    writable .href.
-    """
-    crossOriginWritable = attr.getExtendedAttribute("CrossOriginWritable")
-    if not crossOriginWritable:
-        return False
-    if crossOriginWritable is True:
-        return True
-    assert (isinstance(crossOriginWritable, list) and
-            len(crossOriginWritable) == 1)
-    return crossOriginWritable[0] == descriptor.interface.identifier.name
-
 def isNonExposedNavigatorObjectGetter(attr, descriptor):
     return (attr.navigatorObjectGetter and
             not descriptor.getDescriptor(attr.type.inner.identifier.name).register)
 
 class AttrDefiner(PropertyDefiner):
     def __init__(self, descriptor, name, crossOriginOnly, static, unforgeable=False):
         assert not (static and unforgeable)
         PropertyDefiner.__init__(self, descriptor, name)
         self.name = name
         # Ignore non-static attributes for interfaces without a proto object
         if descriptor.interface.hasInterfacePrototypeObject() or static:
             idlAttrs = [m for m in descriptor.interface.members if
                         m.isAttr() and m.isStatic() == static and
                         MemberIsUnforgeable(m, descriptor) == unforgeable and
                         (not crossOriginOnly or m.getExtendedAttribute("CrossOriginReadable") or
-                         isCrossOriginWritable(m, descriptor)) and
+                         m.getExtendedAttribute("CrossOriginWritable")) and
                         not isNonExposedNavigatorObjectGetter(m, descriptor)]
         else:
             idlAttrs = []
 
         attributes = []
         for attr in idlAttrs:
             attributes.extend(self.attrData(attr, unforgeable))
         self.chrome = [m for m in attributes if isChromeOnly(m["attr"])]
@@ -2694,30 +2678,30 @@ class AttrDefiner(PropertyDefiner):
                    (accessor, jitinfo)
 
         def setter(attr):
             if (attr.readonly and
                 attr.getExtendedAttribute("PutForwards") is None and
                 attr.getExtendedAttribute("Replaceable") is None and
                 attr.getExtendedAttribute("LenientSetter") is None):
                 return "nullptr, nullptr"
-            if crossOriginOnly and not isCrossOriginWritable(attr, descriptor):
+            if crossOriginOnly and not attr.getExtendedAttribute("CrossOriginWritable"):
                 return "nullptr, nullptr"
             if static:
                 accessor = 'set_' + IDLToCIdentifier(attr.identifier.name)
                 jitinfo = "nullptr"
             else:
                 if attr.hasLenientThis():
-                    if isCrossOriginWritable(attr, descriptor):
+                    if attr.getExtendedAttribute("CrossOriginWritable"):
                         raise TypeError("Can't handle lenient cross-origin "
                                         "writable attribute %s.%s" %
                                         (descriptor.name,
                                          attr.identifier.name))
                     accessor = "GenericSetter<LenientThisPolicy>"
-                elif isCrossOriginWritable(attr, descriptor):
+                elif attr.getExtendedAttribute("CrossOriginWritable"):
                     accessor = "GenericSetter<CrossOriginThisPolicy>"
                 elif descriptor.interface.isOnGlobalProtoChain():
                     accessor = "GenericSetter<MaybeGlobalThisPolicy>"
                 else:
                     accessor = "GenericSetter<NormalThisPolicy>"
                 jitinfo = "&%s_setterinfo" % IDLToCIdentifier(attr.identifier.name)
             return "%s, %s" % \
                    (accessor, jitinfo)
@@ -4159,17 +4143,18 @@ class CGClearCachedValueMethod(CGAbstrac
             regetMember=regetMember)
 
 
 class CGCrossOriginProperties(CGThing):
     def __init__(self, descriptor):
         attrs = []
         methods = []
         for m in descriptor.interface.members:
-            if m.isAttr() and (m.getExtendedAttribute("CrossOriginReadable") or isCrossOriginWritable(m, descriptor)):
+            if m.isAttr() and (m.getExtendedAttribute("CrossOriginReadable") or
+                               m.getExtendedAttribute("CrossOriginWritable")):
                 if m.isStatic():
                     raise TypeError("Don't know how to deal with static method %s" %
                                     m.identifier.name)
                 if PropertyDefiner.getControllingCondition(m, descriptor).hasDisablers():
                     raise TypeError("Don't know how to deal with disabler for %s" %
                                     m.identifier.name)
                 if len(m.bindingAliases) > 0:
                     raise TypeError("Don't know how to deal with aliases for %s" %
@@ -12959,24 +12944,24 @@ def memberProperties(m, descriptor):
                 if m.getExtendedAttribute("CrossOriginCallable"):
                     props.isCrossOriginMethod = True
     elif m.isAttr():
         if not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject():
             if m.getExtendedAttribute("CrossOriginReadable"):
                 props.isCrossOriginGetter = True
         if not m.readonly:
             if not m.isStatic() and descriptor.interface.hasInterfacePrototypeObject():
-                if isCrossOriginWritable(m, descriptor):
+                if m.getExtendedAttribute("CrossOriginWritable"):
                     props.isCrossOriginSetter = True
         elif m.getExtendedAttribute("PutForwards"):
-            if isCrossOriginWritable(m, descriptor):
+            if m.getExtendedAttribute("CrossOriginWritable"):
                 props.isCrossOriginSetter = True
         elif (m.getExtendedAttribute("Replaceable") or
               m.getExtendedAttribute("LenientSetter")):
-            if isCrossOriginWritable(m, descriptor):
+            if m.getExtendedAttribute("CrossOriginWritable"):
                 props.isCrossOriginSetter = True
 
     return props
 
 
 class CGDescriptor(CGThing):
     def __init__(self, descriptor):
         CGThing.__init__(self)
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -4375,17 +4375,17 @@ class IDLAttribute(IDLInterfaceMember):
                                   [attr.location, self.location])
         elif identifier == "Cached":
             if self.getExtendedAttribute("StoreInSlot"):
                 raise WebIDLError("[Cached] and [StoreInSlot] must not be "
                                   "specified on the same attribute",
                                   [attr.location, self.location])
         elif (identifier == "CrossOriginReadable" or
               identifier == "CrossOriginWritable"):
-            if not attr.noArguments() and identifier == "CrossOriginReadable":
+            if not attr.noArguments():
                 raise WebIDLError("[%s] must take no arguments" % identifier,
                                   [attr.location])
             if self.isStatic():
                 raise WebIDLError("[%s] is only allowed on non-static "
                                   "attributes" % identifier,
                                   [attr.location, self.location])
             if self.getExtendedAttribute("LenientThis"):
                 raise WebIDLError("[LenientThis] is not allowed in combination "