Bug 1270349 part 4. Use LegacyUnenumerableNamedProperties instead of NameIsEnumerable() calls to determine whether named props on DOM proxies should be enumerable. r=peterv

This commit is contained in:
Boris Zbarsky 2016-05-09 22:25:40 -04:00
parent 919ca7517c
commit 76180fb5a7
26 changed files with 15 additions and 113 deletions

View File

@ -163,12 +163,6 @@ nsDOMAttributeMap::NamedGetter(const nsAString& aAttrName, bool& aFound)
return GetAttribute(ni); return GetAttribute(ni);
} }
bool
nsDOMAttributeMap::NameIsEnumerable(const nsAString& aName)
{
return false;
}
void void
nsDOMAttributeMap::GetSupportedNames(unsigned aFlags, nsDOMAttributeMap::GetSupportedNames(unsigned aFlags,
nsTArray<nsString>& aNames) nsTArray<nsString>& aNames)

View File

@ -139,7 +139,6 @@ public:
// WebIDL // WebIDL
Attr* GetNamedItem(const nsAString& aAttrName); Attr* GetNamedItem(const nsAString& aAttrName);
Attr* NamedGetter(const nsAString& aAttrName, bool& aFound); Attr* NamedGetter(const nsAString& aAttrName, bool& aFound);
bool NameIsEnumerable(const nsAString& aName);
already_AddRefed<Attr> already_AddRefed<Attr>
RemoveNamedItem(mozilla::dom::NodeInfo* aNodeInfo, ErrorResult& aError); RemoveNamedItem(mozilla::dom::NodeInfo* aNodeInfo, ErrorResult& aError);
already_AddRefed<Attr> already_AddRefed<Attr>

View File

@ -122,12 +122,6 @@ nsMimeTypeArray::NamedGetter(const nsAString& aName, bool &aFound)
return nullptr; return nullptr;
} }
bool
nsMimeTypeArray::NameIsEnumerable(const nsAString& aName)
{
return true;
}
uint32_t uint32_t
nsMimeTypeArray::Length() nsMimeTypeArray::Length()
{ {

View File

@ -35,7 +35,6 @@ public:
nsMimeType* NamedItem(const nsAString& name); nsMimeType* NamedItem(const nsAString& name);
nsMimeType* IndexedGetter(uint32_t index, bool &found); nsMimeType* IndexedGetter(uint32_t index, bool &found);
nsMimeType* NamedGetter(const nsAString& name, bool &found); nsMimeType* NamedGetter(const nsAString& name, bool &found);
bool NameIsEnumerable(const nsAString& name);
uint32_t Length(); uint32_t Length();
void GetSupportedNames(unsigned, nsTArray< nsString >& retval); void GetSupportedNames(unsigned, nsTArray< nsString >& retval);

View File

@ -224,12 +224,6 @@ nsPluginArray::NamedGetter(const nsAString& aName, bool &aFound)
return plugin; return plugin;
} }
bool
nsPluginArray::NameIsEnumerable(const nsAString& aName)
{
return true;
}
uint32_t uint32_t
nsPluginArray::Length() nsPluginArray::Length()
{ {
@ -419,12 +413,6 @@ nsPluginElement::NamedGetter(const nsAString& aName, bool &aFound)
return nullptr; return nullptr;
} }
bool
nsPluginElement::NameIsEnumerable(const nsAString& aName)
{
return true;
}
uint32_t uint32_t
nsPluginElement::Length() nsPluginElement::Length()
{ {

View File

@ -49,7 +49,6 @@ public:
void Refresh(bool aReloadDocuments); void Refresh(bool aReloadDocuments);
nsPluginElement* IndexedGetter(uint32_t aIndex, bool &aFound); nsPluginElement* IndexedGetter(uint32_t aIndex, bool &aFound);
nsPluginElement* NamedGetter(const nsAString& aName, bool &aFound); nsPluginElement* NamedGetter(const nsAString& aName, bool &aFound);
bool NameIsEnumerable(const nsAString& aName);
uint32_t Length(); uint32_t Length();
void GetSupportedNames(unsigned, nsTArray<nsString>& aRetval); void GetSupportedNames(unsigned, nsTArray<nsString>& aRetval);
@ -91,7 +90,6 @@ public:
nsMimeType* NamedItem(const nsAString& name); nsMimeType* NamedItem(const nsAString& name);
nsMimeType* IndexedGetter(uint32_t index, bool &found); nsMimeType* IndexedGetter(uint32_t index, bool &found);
nsMimeType* NamedGetter(const nsAString& name, bool &found); nsMimeType* NamedGetter(const nsAString& name, bool &found);
bool NameIsEnumerable(const nsAString& aName);
uint32_t Length(); uint32_t Length();
void GetSupportedNames(unsigned, nsTArray<nsString>& retval); void GetSupportedNames(unsigned, nsTArray<nsString>& retval);

View File

@ -10975,15 +10975,11 @@ class CGDOMJSProxyHandler_getOwnPropDescriptor(ClassMethod):
if self.descriptor.supportsNamedProperties(): if self.descriptor.supportsNamedProperties():
operations = self.descriptor.operations operations = self.descriptor.operations
readonly = toStringBool(operations['NamedSetter'] is None) readonly = toStringBool(operations['NamedSetter'] is None)
enumerable = (
"self->NameIsEnumerable(Constify(%s))" %
# First [0] means first (and only) signature, [1] means
# "arguments" as opposed to return type, [0] means first (and
# only) argument.
operations['NamedGetter'].signatures()[0][1][0].identifier.name)
fillDescriptor = ( fillDescriptor = (
"FillPropertyDescriptor(desc, proxy, %s, %s);\n" "FillPropertyDescriptor(desc, proxy, %s, %s);\n"
"return true;\n" % (readonly, enumerable)) "return true;\n" %
(readonly,
toStringBool(self.descriptor.namedPropertiesEnumerable)))
templateValues = {'jsvalRef': 'desc.value()', 'jsvalHandle': 'desc.value()', templateValues = {'jsvalRef': 'desc.value()', 'jsvalHandle': 'desc.value()',
'obj': 'proxy', 'successCode': fillDescriptor} 'obj': 'proxy', 'successCode': fillDescriptor}
@ -14141,15 +14137,6 @@ class CGBindingImplClass(CGClass):
FakeMember(), FakeMember(),
name="aFlags")]), name="aFlags")]),
{"infallible": True})) {"infallible": True}))
self.methodDecls.append(
CGNativeMember(
descriptor, FakeMember(),
"NameIsEnumerable",
(BuiltinTypes[IDLBuiltinType.Types.boolean],
[FakeArgument(BuiltinTypes[IDLBuiltinType.Types.domstring],
FakeMember(),
name="aName")]),
{"infallible": True}))
wrapArgs = [Argument('JSContext*', 'aCx'), wrapArgs = [Argument('JSContext*', 'aCx'),
Argument('JS::Handle<JSObject*>', 'aGivenProto')] Argument('JS::Handle<JSObject*>', 'aGivenProto')]

View File

@ -1137,7 +1137,6 @@ public:
virtual nsISupports* GetParentObject(); virtual nsISupports* GetParentObject();
void NamedGetter(const nsAString&, bool&, nsAString&); void NamedGetter(const nsAString&, bool&, nsAString&);
bool NameIsEnumerable(const nsAString&);
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
}; };
@ -1151,7 +1150,6 @@ public:
virtual nsISupports* GetParentObject(); virtual nsISupports* GetParentObject();
void NamedGetter(const nsAString&, bool&, nsAString&); void NamedGetter(const nsAString&, bool&, nsAString&);
bool NameIsEnumerable(const nsAString&);
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
int32_t IndexedGetter(uint32_t, bool&); int32_t IndexedGetter(uint32_t, bool&);
void IndexedSetter(uint32_t, int32_t); void IndexedSetter(uint32_t, int32_t);
@ -1169,7 +1167,6 @@ public:
uint32_t IndexedGetter(uint32_t, bool&); uint32_t IndexedGetter(uint32_t, bool&);
void NamedGetter(const nsAString&, bool&, nsAString&); void NamedGetter(const nsAString&, bool&, nsAString&);
bool NameIsEnumerable(const nsAString&);
void NamedItem(const nsAString&, nsAString&); void NamedItem(const nsAString&, nsAString&);
uint32_t Length(); uint32_t Length();
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
@ -1201,7 +1198,6 @@ public:
void NamedSetter(const nsAString&, TestIndexedSetterInterface&); void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&); TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&);
bool NameIsEnumerable(const nsAString&);
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
}; };
@ -1219,7 +1215,6 @@ public:
uint32_t Length(); uint32_t Length();
void NamedSetter(const nsAString&, TestIndexedSetterInterface&); void NamedSetter(const nsAString&, TestIndexedSetterInterface&);
TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&); TestIndexedSetterInterface* NamedGetter(const nsAString&, bool&);
bool NameIsEnumerable(const nsAString&);
void SetNamedItem(const nsAString&, TestIndexedSetterInterface&); void SetNamedItem(const nsAString&, TestIndexedSetterInterface&);
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
}; };
@ -1230,7 +1225,6 @@ public:
uint32_t IndexedGetter(uint32_t, bool&); uint32_t IndexedGetter(uint32_t, bool&);
uint32_t Item(uint32_t); uint32_t Item(uint32_t);
void NamedGetter(const nsAString&, bool&, nsAString&); void NamedGetter(const nsAString&, bool&, nsAString&);
bool NameIsEnumerable(const nsAString&);
void NamedItem(const nsAString&, nsAString&); void NamedItem(const nsAString&, nsAString&);
void IndexedSetter(uint32_t, int32_t&); void IndexedSetter(uint32_t, int32_t&);
void IndexedSetter(uint32_t, const nsAString&) = delete; void IndexedSetter(uint32_t, const nsAString&) = delete;
@ -1299,7 +1293,6 @@ public:
void NamedDeleter(const nsAString&, bool&); void NamedDeleter(const nsAString&, bool&);
long NamedGetter(const nsAString&, bool&); long NamedGetter(const nsAString&, bool&);
bool NameIsEnumerable(const nsAString&);
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
}; };
@ -1315,7 +1308,6 @@ public:
bool NamedDeleter(const nsAString&, bool&); bool NamedDeleter(const nsAString&, bool&);
bool NamedDeleter(const nsAString&) = delete; bool NamedDeleter(const nsAString&) = delete;
long NamedGetter(const nsAString&, bool&); long NamedGetter(const nsAString&, bool&);
bool NameIsEnumerable(const nsAString&);
bool DelNamedItem(const nsAString&); bool DelNamedItem(const nsAString&);
bool DelNamedItem(const nsAString&, bool&) = delete; bool DelNamedItem(const nsAString&, bool&) = delete;
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);
@ -1337,7 +1329,6 @@ public:
void NamedDeleter(const nsAString&, bool&); void NamedDeleter(const nsAString&, bool&);
void NamedDeleter(const nsAString&) = delete; void NamedDeleter(const nsAString&) = delete;
long NamedGetter(const nsAString&, bool&); long NamedGetter(const nsAString&, bool&);
bool NameIsEnumerable(const nsAString&);
void DelNamedItem(const nsAString&); void DelNamedItem(const nsAString&);
void DelNamedItem(const nsAString&, bool&) = delete; void DelNamedItem(const nsAString&, bool&) = delete;
void GetSupportedNames(unsigned, nsTArray<nsString>&); void GetSupportedNames(unsigned, nsTArray<nsString>&);

View File

@ -275,15 +275,6 @@ CameraRecorderProfiles::NamedGetter(const nsAString& aName, bool& aFound)
return profile; return profile;
} }
bool
CameraRecorderProfiles::NameIsEnumerable(const nsAString& aName)
{
DOM_CAMERA_LOGT("%s:%d : this=%p, name='%s' (always returns true)\n",
__func__, __LINE__, this, NS_ConvertUTF16toUTF8(aName).get());
return true;
}
void void
CameraRecorderProfiles::OnHardwareClosed() CameraRecorderProfiles::OnHardwareClosed()
{ {

View File

@ -161,7 +161,6 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
CameraRecorderProfile* NamedGetter(const nsAString& aName, bool& aFound); CameraRecorderProfile* NamedGetter(const nsAString& aName, bool& aFound);
bool NameIsEnumerable(const nsAString& aName);
void GetSupportedNames(unsigned aFlags, nsTArray<nsString>& aNames); void GetSupportedNames(unsigned aFlags, nsTArray<nsString>& aNames);
virtual void OnHardwareClosed(); virtual void OnHardwareClosed();

View File

@ -63,10 +63,6 @@ public:
bool& aFound, bool& aFound,
Nullable<OwningNodeOrHTMLCollection>& aResult); Nullable<OwningNodeOrHTMLCollection>& aResult);
void GetSupportedNames(unsigned aFlags, nsTArray<nsString>& aNames); void GetSupportedNames(unsigned aFlags, nsTArray<nsString>& aNames);
bool NameIsEnumerable(const nsAString& aName)
{
return false;
}
void LegacyCall(JS::Handle<JS::Value>, const nsAString& aName, void LegacyCall(JS::Handle<JS::Value>, const nsAString& aName,
Nullable<OwningNodeOrHTMLCollection>& aResult) Nullable<OwningNodeOrHTMLCollection>& aResult)
{ {

View File

@ -1538,12 +1538,6 @@ HTMLFormElement::NamedGetter(const nsAString& aName, bool &aFound)
return nullptr; return nullptr;
} }
bool
HTMLFormElement::NameIsEnumerable(const nsAString& aName)
{
return true;
}
void void
HTMLFormElement::GetSupportedNames(unsigned, nsTArray<nsString >& aRetval) HTMLFormElement::GetSupportedNames(unsigned, nsTArray<nsString >& aRetval)
{ {

View File

@ -393,8 +393,6 @@ public:
already_AddRefed<nsISupports> already_AddRefed<nsISupports>
NamedGetter(const nsAString& aName, bool &aFound); NamedGetter(const nsAString& aName, bool &aFound);
bool NameIsEnumerable(const nsAString& aName);
void GetSupportedNames(unsigned, nsTArray<nsString >& aRetval); void GetSupportedNames(unsigned, nsTArray<nsString >& aRetval);
static int32_t static int32_t

View File

@ -90,10 +90,6 @@ public:
aFound = IsSupportedNamedProperty(aName); aFound = IsSupportedNamedProperty(aName);
return aFound ? NamedItem(aName) : nullptr; return aFound ? NamedItem(aName) : nullptr;
} }
bool NameIsEnumerable(const nsAString& aName)
{
return true;
}
DOMStringList* Names() DOMStringList* Names()
{ {
EnsureFresh(); EnsureFresh();

View File

@ -89,12 +89,6 @@ nsDOMStringMap::NamedGetter(const nsAString& aProp, bool& found,
found = mElement->GetAttr(attr, aResult); found = mElement->GetAttr(attr, aResult);
} }
bool
nsDOMStringMap::NameIsEnumerable(const nsAString& aName)
{
return true;
}
void void
nsDOMStringMap::NamedSetter(const nsAString& aProp, nsDOMStringMap::NamedSetter(const nsAString& aProp,
const nsAString& aValue, const nsAString& aValue,

View File

@ -42,7 +42,6 @@ public:
void NamedSetter(const nsAString& aProp, const nsAString& aValue, void NamedSetter(const nsAString& aProp, const nsAString& aValue,
mozilla::ErrorResult& rv); mozilla::ErrorResult& rv);
void NamedDeleter(const nsAString& aProp, bool &found); void NamedDeleter(const nsAString& aProp, bool &found);
bool NameIsEnumerable(const nsAString& aName);
void GetSupportedNames(unsigned, nsTArray<nsString>& aNames); void GetSupportedNames(unsigned, nsTArray<nsString>& aNames);
js::ExpandoAndGeneration mExpandoAndGeneration; js::ExpandoAndGeneration mExpandoAndGeneration;

View File

@ -2325,12 +2325,6 @@ nsHTMLDocument::NamedGetter(JSContext* cx, const nsAString& aName, bool& aFound,
aRetval.set(&val.toObject()); aRetval.set(&val.toObject());
} }
bool
nsHTMLDocument::NameIsEnumerable(const nsAString& aName)
{
return true;
}
void void
nsHTMLDocument::GetSupportedNames(unsigned, nsTArray<nsString>& aNames) nsHTMLDocument::GetSupportedNames(unsigned, nsTArray<nsString>& aNames)
{ {

View File

@ -174,7 +174,6 @@ public:
void NamedGetter(JSContext* cx, const nsAString& aName, bool& aFound, void NamedGetter(JSContext* cx, const nsAString& aName, bool& aFound,
JS::MutableHandle<JSObject*> aRetval, JS::MutableHandle<JSObject*> aRetval,
mozilla::ErrorResult& rv); mozilla::ErrorResult& rv);
bool NameIsEnumerable(const nsAString& aName);
void GetSupportedNames(unsigned, nsTArray<nsString>& aNames); void GetSupportedNames(unsigned, nsTArray<nsString>& aNames);
nsGenericHTMLElement *GetBody(); nsGenericHTMLElement *GetBody();
void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv); void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv);

View File

@ -69,10 +69,6 @@ public:
{ {
return GetFirstNamedElement(aName, aFound); return GetFirstNamedElement(aName, aFound);
} }
bool NameIsEnumerable(const nsAString& aName)
{
return false;
}
virtual mozilla::dom::Element* virtual mozilla::dom::Element*
GetFirstNamedElement(const nsAString& aName, bool& aFound) = 0; GetFirstNamedElement(const nsAString& aName, bool& aFound) = 0;

View File

@ -81,11 +81,6 @@ public:
void GetItem(const nsAString& aKey, nsAString& aResult, ErrorResult& aRv); void GetItem(const nsAString& aKey, nsAString& aResult, ErrorResult& aRv);
bool NameIsEnumerable(const nsAString& aName) const
{
return true;
}
void GetSupportedNames(unsigned, nsTArray<nsString>& aKeys); void GetSupportedNames(unsigned, nsTArray<nsString>& aKeys);
void NamedGetter(const nsAString& aKey, bool& aFound, nsAString& aResult, void NamedGetter(const nsAString& aKey, bool& aFound, nsAString& aResult,

View File

@ -11,7 +11,9 @@
* and create derivative works of this document. * and create derivative works of this document.
*/ */
[OverrideBuiltins, LegacyUnenumerableNamedProperties] // Should be LegacyUnenumerableNamedProperties. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=1270369
[OverrideBuiltins]
interface HTMLFormElement : HTMLElement { interface HTMLFormElement : HTMLElement {
[Pure, SetterThrows] [Pure, SetterThrows]
attribute DOMString acceptCharset; attribute DOMString acceptCharset;

View File

@ -4,7 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. * You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
[LegacyUnenumerableNamedProperties] // [LegacyUnenumerableNamedProperties]
// Named properties enumerable for now; see
// https://bugzilla.mozilla.org/show_bug.cgi?id=1270364
interface MimeTypeArray { interface MimeTypeArray {
readonly attribute unsigned long length; readonly attribute unsigned long length;

View File

@ -4,7 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. * You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
[LegacyUnenumerableNamedProperties] // [LegacyUnenumerableNamedProperties]
// Named properties enumerable for now; see
// https://bugzilla.mozilla.org/show_bug.cgi?id=1270366
interface Plugin { interface Plugin {
readonly attribute DOMString description; readonly attribute DOMString description;
readonly attribute DOMString filename; readonly attribute DOMString filename;

View File

@ -4,7 +4,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. * You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
[LegacyUnenumerableNamedProperties] // [LegacyUnenumerableNamedProperties]
// Named properties enumerable for now; see
// https://bugzilla.mozilla.org/show_bug.cgi?id=1270366
interface PluginArray { interface PluginArray {
readonly attribute unsigned long length; readonly attribute unsigned long length;

View File

@ -606,12 +606,6 @@ nsTreeColumns::NamedGetter(const nsAString& aId, bool& aFound)
return nullptr; return nullptr;
} }
bool
nsTreeColumns::NameIsEnumerable(const nsAString& aName)
{
return true;
}
nsTreeColumn* nsTreeColumn*
nsTreeColumns::GetNamedColumn(const nsAString& aId) nsTreeColumns::GetNamedColumn(const nsAString& aId)
{ {

View File

@ -186,7 +186,6 @@ public:
nsTreeColumn* IndexedGetter(uint32_t aIndex, bool& aFound); nsTreeColumn* IndexedGetter(uint32_t aIndex, bool& aFound);
nsTreeColumn* GetColumnAt(uint32_t aIndex); nsTreeColumn* GetColumnAt(uint32_t aIndex);
nsTreeColumn* NamedGetter(const nsAString& aId, bool& aFound); nsTreeColumn* NamedGetter(const nsAString& aId, bool& aFound);
bool NameIsEnumerable(const nsAString& aName);
nsTreeColumn* GetNamedColumn(const nsAString& aId); nsTreeColumn* GetNamedColumn(const nsAString& aId);
void GetSupportedNames(unsigned, nsTArray<nsString>& aNames); void GetSupportedNames(unsigned, nsTArray<nsString>& aNames);