mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 832014 part 6. Make it possible to specify that only a particular interface that implements a given consequential interface gets cross-origin-settable behavior for a particular property. r=bholley
This commit is contained in:
parent
394a33af93
commit
12589bea78
@ -2200,6 +2200,23 @@ class MethodDefiner(PropertyDefiner):
|
||||
condition, specData, doIdArrays)
|
||||
|
||||
|
||||
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 == True:
|
||||
return True
|
||||
assert (isinstance(crossOriginWritable, list) and
|
||||
len(crossOriginWritable) == 1)
|
||||
return crossOriginWritable[0] == descriptor.interface.identifier.name
|
||||
|
||||
|
||||
class AttrDefiner(PropertyDefiner):
|
||||
def __init__(self, descriptor, name, static, unforgeable=False):
|
||||
assert not (static and unforgeable)
|
||||
@ -2263,7 +2280,7 @@ class AttrDefiner(PropertyDefiner):
|
||||
else:
|
||||
if attr.hasLenientThis():
|
||||
accessor = "genericLenientSetter"
|
||||
elif attr.getExtendedAttribute("CrossOriginWritable"):
|
||||
elif IsCrossOriginWritable(attr, self.descriptor):
|
||||
accessor = "genericCrossOriginSetter"
|
||||
elif self.descriptor.needsSpecialGenericOps():
|
||||
accessor = "genericSetter"
|
||||
@ -10396,13 +10413,13 @@ class CGDescriptor(CGThing):
|
||||
cgThings.append(CGSpecializedSetter(descriptor, m))
|
||||
if m.hasLenientThis():
|
||||
hasLenientSetter = True
|
||||
elif m.getExtendedAttribute("CrossOriginWritable"):
|
||||
elif IsCrossOriginWritable(m, descriptor):
|
||||
crossOriginSetters.add(m.identifier.name)
|
||||
elif descriptor.needsSpecialGenericOps():
|
||||
hasSetter = True
|
||||
elif m.getExtendedAttribute("PutForwards"):
|
||||
cgThings.append(CGSpecializedForwardingSetter(descriptor, m))
|
||||
if m.getExtendedAttribute("CrossOriginWritable"):
|
||||
if IsCrossOriginWritable(m, descriptor):
|
||||
crossOriginSetters.add(m.identifier.name)
|
||||
elif descriptor.needsSpecialGenericOps():
|
||||
hasSetter = True
|
||||
|
@ -2997,7 +2997,7 @@ class IDLAttribute(IDLInterfaceMember):
|
||||
[attr.location, self.location])
|
||||
elif (identifier == "CrossOriginReadable" or
|
||||
identifier == "CrossOriginWritable"):
|
||||
if not attr.noArguments():
|
||||
if not attr.noArguments() and identifier == "CrossOriginReadable":
|
||||
raise WebIDLError("[%s] must take no arguments" % identifier,
|
||||
[attr.location])
|
||||
if self.isStatic():
|
||||
@ -3591,15 +3591,19 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
||||
raise WebIDLError("[LenientFloat] used on an operation with no "
|
||||
"restricted float type arguments",
|
||||
[attr.location, self.location])
|
||||
elif (identifier == "Pure" or
|
||||
identifier == "CrossOriginCallable" or
|
||||
identifier == "WebGLHandlesContextLoss"):
|
||||
# Known no-argument attributes.
|
||||
if not attr.noArguments():
|
||||
raise WebIDLError("[%s] must take no arguments" % identifier,
|
||||
[attr.location])
|
||||
elif (identifier == "Throws" or
|
||||
identifier == "NewObject" or
|
||||
identifier == "ChromeOnly" or
|
||||
identifier == "Pref" or
|
||||
identifier == "Func" or
|
||||
identifier == "AvailableIn" or
|
||||
identifier == "Pure" or
|
||||
identifier == "CrossOriginCallable" or
|
||||
identifier == "WebGLHandlesContextLoss" or
|
||||
identifier == "CheckPermissions"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
|
@ -15,7 +15,7 @@
|
||||
interface Location {
|
||||
[Throws]
|
||||
void assign(DOMString url);
|
||||
[Throws]
|
||||
[Throws, CrossOriginCallable]
|
||||
void replace(DOMString url);
|
||||
// XXXbz there is no forceget argument in the spec! See bug 1037721.
|
||||
[Throws]
|
||||
|
@ -17,7 +17,7 @@
|
||||
interface URLUtilsNoSearchParams {
|
||||
// Bug 824857: no support for stringifier attributes yet.
|
||||
// stringifier attribute DOMString href;
|
||||
[Throws]
|
||||
[Throws, CrossOriginWritable=Location]
|
||||
attribute DOMString href;
|
||||
[Throws]
|
||||
readonly attribute DOMString origin;
|
||||
|
Loading…
Reference in New Issue
Block a user