Bug 1009645 - Address additional comments. r=bz

--HG--
extra : rebase_source : c6befdd143ad15751182af10f80b03c2f23eea4d
This commit is contained in:
Reuben Morais 2014-07-15 16:15:28 -03:00
parent 6dc8d332eb
commit bb157707dd
2 changed files with 17 additions and 17 deletions

View File

@ -1538,7 +1538,7 @@ Navigator::GetFeature(const nsAString& aName)
NS_NAMED_LITERAL_STRING(apiWindowPrefix, "api.window."); NS_NAMED_LITERAL_STRING(apiWindowPrefix, "api.window.");
if (StringBeginsWith(aName, apiWindowPrefix)) { if (StringBeginsWith(aName, apiWindowPrefix)) {
const nsAString& featureName = Substring(aName, apiWindowPrefix.Length(), aName.Length()-apiWindowPrefix.Length()); const nsAString& featureName = Substring(aName, apiWindowPrefix.Length());
if (IsFeatureDetectible(featureName)) { if (IsFeatureDetectible(featureName)) {
p->MaybeResolve(true); p->MaybeResolve(true);
} else { } else {

View File

@ -569,14 +569,20 @@ class IDLInterface(IDLObjectWithScope):
assert not parent or isinstance(parent, IDLInterface) assert not parent or isinstance(parent, IDLInterface)
if self.getExtendedAttribute("FeatureDetectible"): if self.getExtendedAttribute("FeatureDetectible"):
if self.getExtendedAttribute("NoInterfaceObject"): if not (self.getExtendedAttribute("Func") or
raise WebIDLError("[FeatureDetectible] not allowed on interface " self.getExtendedAttribute("AvailableIn") or
" with [NoInterfaceObject]", self.getExtendedAttribute("CheckPermissions")):
raise WebIDLError("[FeatureDetectible] is only allowed in combination "
"with [Func], [AvailableIn] or [CheckPermissions]",
[self.location]) [self.location])
if self.getExtendedAttribute("Pref"): if self.getExtendedAttribute("Pref"):
raise WebIDLError("[FeatureDetectible] must not be specified " raise WebIDLError("[FeatureDetectible] must not be specified "
"in combination with [Pref]", "in combination with [Pref]",
[self.location]) [self.location])
if not self.hasInterfaceObject():
raise WebIDLError("[FeatureDetectible] not allowed on interface "
"with [NoInterfaceObject]",
[self.location])
self.parent = parent self.parent = parent
@ -2905,9 +2911,9 @@ class IDLAttribute(IDLInterfaceMember):
if not (self.getExtendedAttribute("Func") or if not (self.getExtendedAttribute("Func") or
self.getExtendedAttribute("AvailableIn") or self.getExtendedAttribute("AvailableIn") or
self.getExtendedAttribute("CheckPermissions")): self.getExtendedAttribute("CheckPermissions")):
raise WebIDLError("[%s] is only allowed in combination with [Func], " raise WebIDLError("[FeatureDetectible] is only allowed in combination "
"[AvailableIn] or [CheckPermissions]" % identifier, "with [Func], [AvailableIn] or [CheckPermissions]",
[attr.location, self.location]) [self.location])
if self.getExtendedAttribute("Pref"): if self.getExtendedAttribute("Pref"):
raise WebIDLError("[FeatureDetectible] must not be specified " raise WebIDLError("[FeatureDetectible] must not be specified "
"in combination with [Pref]", "in combination with [Pref]",
@ -3031,13 +3037,6 @@ class IDLAttribute(IDLInterfaceMember):
raise WebIDLError("[LenientThis] is not allowed in combination " raise WebIDLError("[LenientThis] is not allowed in combination "
"with [%s]" % identifier, "with [%s]" % identifier,
[attr.location, self.location]) [attr.location, self.location])
elif identifier == "FeatureDetectible":
if not (self.getExtendedAttribute("Func") or
self.getExtendedAttribute("AvailableIn") or
self.getExtendedAttribute("CheckPermissions")):
raise WebIDLError("[%s] is only allowed in combination with [Func], "
"[AvailableIn] or [CheckPermissions]" % identifier,
[attr.location, self.location])
elif (identifier == "Pref" or elif (identifier == "Pref" or
identifier == "SetterThrows" or identifier == "SetterThrows" or
identifier == "Pure" or identifier == "Pure" or
@ -3050,7 +3049,8 @@ class IDLAttribute(IDLInterfaceMember):
identifier == "Frozen" or identifier == "Frozen" or
identifier == "AvailableIn" or identifier == "AvailableIn" or
identifier == "NewObject" or identifier == "NewObject" or
identifier == "CheckPermissions"): identifier == "CheckPermissions" or
identifier == "FeatureDetectible"):
# Known attributes that we don't need to do anything with here # Known attributes that we don't need to do anything with here
pass pass
else: else: