Bug 1494333 - index crons just like artifacts r=Callek
[gecko.git] / dom / html / nsDOMStringMap.h
blob6506f1464f80c16ec28e97c9889ce6bf4c95e6da
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsDOMStringMap_h
8 #define nsDOMStringMap_h
10 #include "nsCycleCollectionParticipant.h"
11 #include "nsTArray.h"
12 #include "nsString.h"
13 #include "nsWrapperCache.h"
14 #include "mozilla/dom/Element.h"
15 #include "jsfriendapi.h" // For js::ExpandoAndGeneration
17 namespace mozilla {
18 class ErrorResult;
19 namespace dom {
20 class DocGroup;
21 } // namespace dom
22 } // namespace mozilla
24 class nsDOMStringMap : public nsStubMutationObserver,
25 public nsWrapperCache
27 public:
28 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
29 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMStringMap)
31 NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
33 nsINode* GetParentObject()
35 return mElement;
38 mozilla::dom::DocGroup* GetDocGroup() const;
40 explicit nsDOMStringMap(mozilla::dom::Element* aElement);
42 // WebIDL API
43 virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
44 void NamedGetter(const nsAString& aProp, bool& found,
45 mozilla::dom::DOMString& aResult) const;
46 void NamedSetter(const nsAString& aProp, const nsAString& aValue,
47 mozilla::ErrorResult& rv);
48 void NamedDeleter(const nsAString& aProp, bool &found);
49 void GetSupportedNames(nsTArray<nsString>& aNames);
51 js::ExpandoAndGeneration mExpandoAndGeneration;
53 private:
54 virtual ~nsDOMStringMap();
56 protected:
57 RefPtr<mozilla::dom::Element> mElement;
58 // Flag to guard against infinite recursion.
59 bool mRemovingProp;
60 static bool DataPropToAttr(const nsAString& aProp, nsAutoString& aResult);
61 static bool AttrToDataProp(const nsAString& aAttr, nsAutoString& aResult);
64 #endif