author Boris Zbarsky <>
Tue, 08 Apr 2014 18:27:18 -0400
changeset 196124 de7487db16d9df8f72eaeb4d6cc7288b47cedb54
parent 194365 c9640661eddcebdebff34cae7435d4bd4b14c367
permissions -rw-r--r--
Bug 991742 part 8. Remove the "aScope" argument of WebIDL/nsWrapperCache WrapObject() methods. r=bholley This patch was mostly generated with the following command: find . -name "*.h" -o -name "*.cpp" | xargs sed -e '/WrapObject(JSContext/ {; N; s/\(WrapObject(JSContext *\* *a\{0,1\}[Cc]x\),\n\{0,1\} *JS::Handle<JSObject\*> a\{0,1\}[sS]cope/\1/ ; }' -i "" and then reverting the changes that made to dom/bindings/BindingUtils.h, since those WrapObject methods are not the ones we're trying to change here, plus a bunch of manual fixups for cases that this command did not catch (including all the callsites of WrapObject()).

/* 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 */

 * Implementation of DOMTokenList specified by HTML5.

#ifndef nsDOMTokenList_h___
#define nsDOMTokenList_h___

#include "nsCOMPtr.h"
#include "nsDOMString.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/BindingDeclarations.h"

namespace mozilla {
class ErrorResult;

} // namespace mozilla

class nsAttrValue;
class nsIAtom;

// nsISupports must be on the primary inheritance chain
// because nsDOMSettableTokenList is traversed by Element.
class nsDOMTokenList : public nsISupports,
                       public nsWrapperCache
  typedef mozilla::dom::Element Element;


  nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom);

  virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;

  Element* GetParentObject()
    return mElement;

  uint32_t Length();
  void Item(uint32_t aIndex, nsAString& aResult)
    bool found;
    IndexedGetter(aIndex, found, aResult);
    if (!found) {
  void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aResult);
  bool Contains(const nsAString& aToken, mozilla::ErrorResult& aError);
  void Add(const nsAString& aToken, mozilla::ErrorResult& aError);
  void Add(const nsTArray<nsString>& aTokens,
           mozilla::ErrorResult& aError);
  void Remove(const nsAString& aToken, mozilla::ErrorResult& aError);
  void Remove(const nsTArray<nsString>& aTokens,
              mozilla::ErrorResult& aError);
  bool Toggle(const nsAString& aToken,
              const mozilla::dom::Optional<bool>& force,
              mozilla::ErrorResult& aError);
  void Stringify(nsAString& aResult);

  virtual ~nsDOMTokenList();

  nsresult CheckToken(const nsAString& aStr);
  nsresult CheckTokens(const nsTArray<nsString>& aStr);
  void AddInternal(const nsAttrValue* aAttr,
                   const nsTArray<nsString>& aTokens);
  void RemoveInternal(const nsAttrValue* aAttr,
                      const nsTArray<nsString>& aTokens);
  inline const nsAttrValue* GetParsedAttr();

  nsCOMPtr<Element> mElement;
  nsCOMPtr<nsIAtom> mAttrAtom;

#endif // nsDOMTokenList_h___