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
Родитель 919ca7517c
Коммит 76180fb5a7
26 изменённых файлов: 15 добавлений и 113 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -10975,15 +10975,11 @@ class CGDOMJSProxyHandler_getOwnPropDescriptor(ClassMethod):
if self.descriptor.supportsNamedProperties():
operations = self.descriptor.operations
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 = (
"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()',
'obj': 'proxy', 'successCode': fillDescriptor}
@ -14141,15 +14137,6 @@ class CGBindingImplClass(CGClass):
FakeMember(),
name="aFlags")]),
{"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'),
Argument('JS::Handle<JSObject*>', 'aGivenProto')]

Просмотреть файл

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

Просмотреть файл

@ -275,15 +275,6 @@ CameraRecorderProfiles::NamedGetter(const nsAString& aName, bool& aFound)
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
CameraRecorderProfiles::OnHardwareClosed()
{

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -11,7 +11,9 @@
* 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 {
[Pure, SetterThrows]
attribute DOMString acceptCharset;

Просмотреть файл

@ -4,7 +4,9 @@
* 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 {
readonly attribute unsigned long length;

Просмотреть файл

@ -4,7 +4,9 @@
* 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 {
readonly attribute DOMString description;
readonly attribute DOMString filename;

Просмотреть файл

@ -4,7 +4,9 @@
* 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 {
readonly attribute unsigned long length;

Просмотреть файл

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

Просмотреть файл

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