2015-05-03 19:32:37 +00: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 11:12:37 +00: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/. */
|
2007-07-09 06:19:27 +00:00
|
|
|
|
2008-10-22 14:31:14 +00:00
|
|
|
#ifndef nsIHTMLCollection_h___
|
|
|
|
#define nsIHTMLCollection_h___
|
2007-07-09 06:19:27 +00:00
|
|
|
|
2008-10-22 21:17:49 +00:00
|
|
|
#include "nsIDOMHTMLCollection.h"
|
2014-03-15 19:00:17 +00:00
|
|
|
#include "nsTArrayForwardDeclare.h"
|
2012-09-05 20:49:53 +00:00
|
|
|
#include "nsWrapperCache.h"
|
2015-07-31 17:30:55 +00:00
|
|
|
#include "js/GCAPI.h"
|
2013-08-28 02:59:14 +00:00
|
|
|
#include "js/TypeDecls.h"
|
2007-07-09 06:19:27 +00:00
|
|
|
|
2011-05-31 21:47:59 +00:00
|
|
|
class nsINode;
|
2013-03-17 07:55:17 +00:00
|
|
|
class nsString;
|
|
|
|
|
2012-09-05 20:49:53 +00:00
|
|
|
namespace mozilla {
|
2012-11-14 22:10:07 +00:00
|
|
|
namespace dom {
|
|
|
|
class Element;
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2010-05-09 19:33:00 +00:00
|
|
|
|
2008-10-22 14:31:14 +00:00
|
|
|
// IID for the nsIHTMLCollection interface
|
|
|
|
#define NS_IHTMLCOLLECTION_IID \
|
2013-11-12 15:22:22 +00:00
|
|
|
{ 0x4e169191, 0x5196, 0x4e17, \
|
|
|
|
{ 0xa4, 0x79, 0xd5, 0x35, 0x0b, 0x5b, 0x0a, 0xcd } }
|
2008-10-22 14:31:14 +00:00
|
|
|
|
|
|
|
/**
|
2011-08-20 13:53:33 +00:00
|
|
|
* An internal interface
|
2008-10-22 14:31:14 +00:00
|
|
|
*/
|
|
|
|
class nsIHTMLCollection : public nsIDOMHTMLCollection
|
2007-07-09 06:19:27 +00:00
|
|
|
{
|
2008-10-22 14:31:14 +00:00
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLCOLLECTION_IID)
|
|
|
|
|
2011-05-31 21:47:59 +00:00
|
|
|
/**
|
|
|
|
* Get the root node for this HTML collection.
|
|
|
|
*/
|
|
|
|
virtual nsINode* GetParentObject() = 0;
|
2012-09-05 20:49:53 +00:00
|
|
|
|
|
|
|
using nsIDOMHTMLCollection::Item;
|
|
|
|
using nsIDOMHTMLCollection::NamedItem;
|
|
|
|
|
|
|
|
uint32_t Length()
|
|
|
|
{
|
|
|
|
uint32_t length;
|
|
|
|
GetLength(&length);
|
|
|
|
return length;
|
|
|
|
}
|
2012-11-14 22:10:07 +00:00
|
|
|
virtual mozilla::dom::Element* GetElementAt(uint32_t index) = 0;
|
|
|
|
mozilla::dom::Element* Item(uint32_t index)
|
2012-09-05 20:49:53 +00:00
|
|
|
{
|
|
|
|
return GetElementAt(index);
|
|
|
|
}
|
2012-11-14 22:10:07 +00:00
|
|
|
mozilla::dom::Element* IndexedGetter(uint32_t index, bool& aFound)
|
2012-09-05 20:49:53 +00:00
|
|
|
{
|
2012-11-14 22:10:07 +00:00
|
|
|
mozilla::dom::Element* item = Item(index);
|
2012-09-05 20:49:53 +00:00
|
|
|
aFound = !!item;
|
|
|
|
return item;
|
|
|
|
}
|
2013-11-11 07:55:41 +00:00
|
|
|
mozilla::dom::Element* NamedItem(const nsAString& aName)
|
2012-09-05 20:49:53 +00:00
|
|
|
{
|
2013-11-11 07:55:41 +00:00
|
|
|
bool dummy;
|
|
|
|
return NamedGetter(aName, dummy);
|
2012-09-05 20:49:53 +00:00
|
|
|
}
|
2013-11-11 07:55:41 +00:00
|
|
|
mozilla::dom::Element* NamedGetter(const nsAString& aName, bool& aFound)
|
|
|
|
{
|
|
|
|
return GetFirstNamedElement(aName, aFound);
|
|
|
|
}
|
|
|
|
virtual mozilla::dom::Element*
|
|
|
|
GetFirstNamedElement(const nsAString& aName, bool& aFound) = 0;
|
2012-11-05 16:58:03 +00:00
|
|
|
|
2016-05-10 02:25:40 +00:00
|
|
|
virtual void GetSupportedNames(nsTArray<nsString>& aNames) = 0;
|
2012-10-16 11:51:00 +00:00
|
|
|
|
2012-11-22 11:09:43 +00:00
|
|
|
JSObject* GetWrapperPreserveColor()
|
2012-10-16 11:51:00 +00:00
|
|
|
{
|
2013-11-12 15:22:22 +00:00
|
|
|
return GetWrapperPreserveColorInternal();
|
2012-10-16 11:51:00 +00:00
|
|
|
}
|
2015-07-31 17:30:55 +00:00
|
|
|
JSObject* GetWrapper()
|
|
|
|
{
|
|
|
|
JSObject* obj = GetWrapperPreserveColor();
|
|
|
|
if (obj) {
|
|
|
|
JS::ExposeObjectToActiveJS(obj);
|
|
|
|
}
|
|
|
|
return obj;
|
|
|
|
}
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) = 0;
|
2013-11-12 15:22:22 +00:00
|
|
|
protected:
|
|
|
|
virtual JSObject* GetWrapperPreserveColorInternal() = 0;
|
2007-07-09 06:19:27 +00:00
|
|
|
};
|
2008-10-22 14:31:14 +00:00
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLCollection, NS_IHTMLCOLLECTION_IID)
|
|
|
|
|
|
|
|
#endif /* nsIHTMLCollection_h___ */
|