2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-05-20 21:23:49 +04:00
|
|
|
|
|
|
|
#ifndef nsDOMStringMap_h
|
|
|
|
#define nsDOMStringMap_h
|
|
|
|
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2012-10-17 05:09:42 +04:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
2013-08-24 06:42:42 +04:00
|
|
|
#include "jsfriendapi.h" // For js::ExpandoAndGeneration
|
2011-05-20 21:23:49 +04:00
|
|
|
|
2012-11-05 20:58:03 +04:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
}
|
|
|
|
|
2013-06-18 00:31:03 +04:00
|
|
|
class nsDOMStringMap : public nsStubMutationObserver,
|
2012-10-17 05:09:42 +04:00
|
|
|
public nsWrapperCache
|
2011-05-20 21:23:49 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2012-10-17 05:09:42 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMStringMap)
|
|
|
|
|
2013-06-18 00:31:03 +04:00
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
|
2012-10-17 05:09:42 +04:00
|
|
|
nsINode* GetParentObject()
|
|
|
|
{
|
|
|
|
return mElement;
|
|
|
|
}
|
|
|
|
|
2014-09-02 04:49:25 +04:00
|
|
|
explicit nsDOMStringMap(nsGenericHTMLElement* aElement);
|
2011-05-20 21:23:49 +04:00
|
|
|
|
2012-11-05 20:58:03 +04:00
|
|
|
// WebIDL API
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
|
2013-05-11 02:57:58 +04:00
|
|
|
void NamedGetter(const nsAString& aProp, bool& found,
|
|
|
|
mozilla::dom::DOMString& aResult) const;
|
2012-11-05 20:58:03 +04:00
|
|
|
void NamedSetter(const nsAString& aProp, const nsAString& aValue,
|
|
|
|
mozilla::ErrorResult& rv);
|
|
|
|
void NamedDeleter(const nsAString& aProp, bool &found);
|
2014-04-16 06:58:44 +04:00
|
|
|
bool NameIsEnumerable(const nsAString& aName);
|
2014-04-16 06:58:44 +04:00
|
|
|
void GetSupportedNames(unsigned, nsTArray<nsString>& aNames);
|
2011-05-20 21:23:49 +04:00
|
|
|
|
2013-06-18 00:31:03 +04:00
|
|
|
js::ExpandoAndGeneration mExpandoAndGeneration;
|
|
|
|
|
2011-05-20 21:23:49 +04:00
|
|
|
private:
|
|
|
|
virtual ~nsDOMStringMap();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsRefPtr<nsGenericHTMLElement> mElement;
|
|
|
|
// Flag to guard against infinite recursion.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mRemovingProp;
|
2013-05-11 02:57:58 +04:00
|
|
|
static bool DataPropToAttr(const nsAString& aProp, nsAutoString& aResult);
|
|
|
|
static bool AttrToDataProp(const nsAString& aAttr, nsAutoString& aResult);
|
2011-05-20 21:23:49 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|