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/. */
|
1999-01-12 08:45:23 +00:00
|
|
|
|
2006-03-30 08:03:04 +00:00
|
|
|
/*
|
2006-03-31 08:41:49 +00:00
|
|
|
* Implementation of DOM Core's nsIDOMAttr node.
|
2006-03-30 08:03:04 +00:00
|
|
|
*/
|
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
#include "mozilla/dom/Attr.h"
|
2013-04-09 15:29:47 +00:00
|
|
|
#include "mozilla/dom/AttrBinding.h"
|
2010-08-24 07:05:56 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2014-03-18 04:48:21 +00:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-02-27 10:51:15 +00:00
|
|
|
#include "mozilla/InternalMutationEvent.h"
|
2006-07-19 04:36:36 +00:00
|
|
|
#include "nsContentCreatorFunctions.h"
|
2012-07-27 14:03:27 +00:00
|
|
|
#include "nsError.h"
|
2002-05-14 01:28:17 +00:00
|
|
|
#include "nsUnicharUtils.h"
|
2004-04-01 19:44:17 +00:00
|
|
|
#include "nsDOMString.h"
|
2013-10-02 11:40:07 +00:00
|
|
|
#include "nsIContentInlines.h"
|
2004-08-10 20:37:26 +00:00
|
|
|
#include "nsIDocument.h"
|
2006-04-06 20:54:53 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2006-06-02 12:33:17 +00:00
|
|
|
#include "nsCOMArray.h"
|
2014-02-27 23:04:46 +00:00
|
|
|
#include "nsNameSpaceManager.h"
|
2006-07-02 07:23:10 +00:00
|
|
|
#include "nsNodeUtils.h"
|
2008-10-15 09:40:28 +00:00
|
|
|
#include "nsTextNode.h"
|
|
|
|
#include "mozAutoDocUpdate.h"
|
2011-05-26 19:58:35 +00:00
|
|
|
#include "nsWrapperCacheInlines.h"
|
1999-01-12 08:45:23 +00:00
|
|
|
|
2013-05-06 23:37:47 +00:00
|
|
|
nsIAttribute::nsIAttribute(nsDOMAttributeMap* aAttrMap,
|
2016-01-11 18:01:31 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
|
|
|
: nsINode(aNodeInfo), mAttrMap(aAttrMap)
|
2013-05-06 23:37:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-27 12:54:32 +00:00
|
|
|
nsIAttribute::~nsIAttribute()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2010-08-24 07:05:56 +00:00
|
|
|
|
1999-01-12 08:45:23 +00:00
|
|
|
//----------------------------------------------------------------------
|
2013-04-09 15:29:44 +00:00
|
|
|
bool Attr::sInitialized;
|
1999-01-12 08:45:23 +00:00
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::Attr(nsDOMAttributeMap *aAttrMap,
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2016-01-11 18:01:31 +00:00
|
|
|
const nsAString &aValue)
|
|
|
|
: nsIAttribute(aAttrMap, aNodeInfo), mValue(aValue)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(mNodeInfo, "We must get a nodeinfo here!");
|
|
|
|
MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE,
|
|
|
|
"Wrong nodeType");
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
1999-01-12 08:45:23 +00:00
|
|
|
// We don't add a reference to our content. It will tell us
|
|
|
|
// to drop our reference when it goes away.
|
2008-07-11 20:42:19 +00:00
|
|
|
}
|
|
|
|
|
2013-08-02 01:29:05 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(Attr)
|
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Attr)
|
2009-05-12 20:20:42 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
2011-08-28 14:07:24 +00:00
|
|
|
|
|
|
|
if (!nsINode::Traverse(tmp, cb)) {
|
|
|
|
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
|
|
|
|
}
|
2013-05-06 23:37:47 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAttrMap)
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2013-05-28 23:58:29 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Attr)
|
2009-05-12 20:20:42 +00:00
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Attr)
|
2011-08-28 14:07:24 +00:00
|
|
|
nsINode::Unlink(tmp);
|
2013-05-06 23:37:47 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mAttrMap)
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
2010-01-12 13:08:43 +00:00
|
|
|
|
2013-05-06 23:37:47 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(Attr)
|
2014-04-10 16:09:50 +00:00
|
|
|
Element* ownerElement = tmp->GetElement();
|
2013-05-06 23:37:47 +00:00
|
|
|
if (tmp->IsBlack()) {
|
|
|
|
if (ownerElement) {
|
|
|
|
// The attribute owns the element via attribute map so we can
|
|
|
|
// mark it when the attribute is certainly alive.
|
|
|
|
mozilla::dom::FragmentOrElement::MarkNodeChildren(ownerElement);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (ownerElement &&
|
|
|
|
mozilla::dom::FragmentOrElement::CanSkip(ownerElement, true)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(Attr)
|
|
|
|
return tmp->IsBlackAndDoesNotNeedTracing(static_cast<nsIAttribute*>(tmp));
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(Attr)
|
|
|
|
return tmp->IsBlack();
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
// QueryInterface implementation for Attr
|
|
|
|
NS_INTERFACE_TABLE_HEAD(Attr)
|
2014-08-25 23:21:35 +00:00
|
|
|
NS_WRAPPERCACHE_INTERFACE_TABLE_ENTRY
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_INTERFACE_TABLE(Attr, nsINode, nsIDOMAttr, nsIAttribute, nsIDOMNode,
|
|
|
|
nsIDOMEventTarget, EventTarget)
|
2013-05-21 19:59:27 +00:00
|
|
|
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(Attr)
|
2006-11-11 00:36:03 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
|
|
|
new nsNodeSupportsWeakRefTearoff(this))
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(Attr)
|
2013-07-09 17:30:58 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(Attr,
|
|
|
|
nsNodeUtils::LastRelease(this))
|
2005-12-03 07:42:40 +00:00
|
|
|
|
2005-06-01 13:46:20 +00:00
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::SetMap(nsDOMAttributeMap *aMap)
|
2005-06-01 13:46:20 +00:00
|
|
|
{
|
2005-08-19 23:40:42 +00:00
|
|
|
if (mAttrMap && !aMap && sInitialized) {
|
2005-06-01 13:46:20 +00:00
|
|
|
// We're breaking a relationship with content and not getting a new one,
|
|
|
|
// need to locally cache value. GetValue() does that.
|
2006-01-25 20:49:56 +00:00
|
|
|
GetValue(mValue);
|
2005-06-01 13:46:20 +00:00
|
|
|
}
|
2010-05-27 19:10:33 +00:00
|
|
|
|
2005-06-01 13:46:20 +00:00
|
|
|
mAttrMap = aMap;
|
|
|
|
}
|
|
|
|
|
2014-04-10 16:09:50 +00:00
|
|
|
Element*
|
|
|
|
Attr::GetElement() const
|
2014-03-21 20:02:21 +00:00
|
|
|
{
|
2014-04-10 16:09:50 +00:00
|
|
|
if (!mAttrMap) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
nsIContent* content = mAttrMap->GetContent();
|
|
|
|
return content ? content->AsElement() : nullptr;
|
2014-03-21 20:02:21 +00:00
|
|
|
}
|
|
|
|
|
2005-12-29 03:01:58 +00:00
|
|
|
nsresult
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::SetOwnerDocument(nsIDocument* aDocument)
|
2005-12-29 03:01:58 +00:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aDocument, "Missing document");
|
|
|
|
|
2011-10-18 10:53:36 +00:00
|
|
|
nsIDocument *doc = OwnerDoc();
|
2013-04-09 15:29:44 +00:00
|
|
|
NS_ASSERTION(doc != aDocument, "bad call to Attr::SetOwnerDocument");
|
2011-10-18 11:19:44 +00:00
|
|
|
doc->DeleteAllPropertiesFor(this);
|
2005-12-29 03:01:58 +00:00
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<mozilla::dom::NodeInfo> newNodeInfo;
|
2008-09-12 22:32:18 +00:00
|
|
|
newNodeInfo = aDocument->NodeInfoManager()->
|
2005-12-29 03:01:58 +00:00
|
|
|
GetNodeInfo(mNodeInfo->NameAtom(), mNodeInfo->GetPrefixAtom(),
|
2011-06-14 07:56:49 +00:00
|
|
|
mNodeInfo->NamespaceID(),
|
|
|
|
nsIDOMNode::ATTRIBUTE_NODE);
|
2005-12-29 03:01:58 +00:00
|
|
|
NS_ASSERTION(newNodeInfo, "GetNodeInfo lies");
|
|
|
|
mNodeInfo.swap(newNodeInfo);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-03-19 10:26:58 +00:00
|
|
|
NS_IMETHODIMP
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetName(nsAString& aName)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2011-06-14 07:56:49 +00:00
|
|
|
aName = NodeName();
|
2003-11-15 05:27:37 +00:00
|
|
|
return NS_OK;
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2006-03-19 10:26:58 +00:00
|
|
|
NS_IMETHODIMP
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetValue(nsAString& aValue)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2014-04-10 16:09:50 +00:00
|
|
|
Element* element = GetElement();
|
|
|
|
if (element) {
|
2015-09-22 17:13:26 +00:00
|
|
|
nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
|
2014-04-10 16:09:50 +00:00
|
|
|
element->GetAttr(mNodeInfo->NamespaceID(), nameAtom, aValue);
|
2006-01-25 20:49:56 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
aValue = mValue;
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
2003-06-13 20:10:01 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2013-04-09 15:29:47 +00:00
|
|
|
void
|
|
|
|
Attr::SetValue(const nsAString& aValue, ErrorResult& aRv)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2014-04-10 16:09:50 +00:00
|
|
|
Element* element = GetElement();
|
|
|
|
if (!element) {
|
2012-04-03 07:25:39 +00:00
|
|
|
mValue = aValue;
|
2013-04-09 15:29:47 +00:00
|
|
|
return;
|
2012-04-03 07:25:39 +00:00
|
|
|
}
|
|
|
|
|
2015-09-22 17:13:26 +00:00
|
|
|
nsCOMPtr<nsIAtom> nameAtom = mNodeInfo->NameAtom();
|
2014-04-10 16:09:50 +00:00
|
|
|
aRv = element->SetAttr(mNodeInfo->NamespaceID(),
|
2013-04-09 15:29:47 +00:00
|
|
|
nameAtom,
|
|
|
|
mNodeInfo->GetPrefixAtom(),
|
|
|
|
aValue,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
Attr::SetValue(const nsAString& aValue)
|
|
|
|
{
|
|
|
|
ErrorResult rv;
|
|
|
|
SetValue(aValue, rv);
|
2015-04-27 13:18:51 +00:00
|
|
|
return rv.StealNSResult();
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2013-04-09 15:29:47 +00:00
|
|
|
bool
|
|
|
|
Attr::Specified() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-06-23 08:30:48 +00:00
|
|
|
|
2006-03-19 10:26:58 +00:00
|
|
|
NS_IMETHODIMP
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetSpecified(bool* aSpecified)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2000-06-23 00:21:32 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aSpecified);
|
2013-04-09 15:29:47 +00:00
|
|
|
*aSpecified = Specified();
|
2003-06-13 20:10:01 +00:00
|
|
|
return NS_OK;
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2014-03-21 20:04:09 +00:00
|
|
|
Element*
|
|
|
|
Attr::GetOwnerElement(ErrorResult& aRv)
|
|
|
|
{
|
2014-04-10 16:09:50 +00:00
|
|
|
return GetElement();
|
2014-03-21 20:04:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
Attr::GetOwnerElement(nsIDOMElement** aOwnerElement)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aOwnerElement);
|
|
|
|
|
2014-04-10 16:09:50 +00:00
|
|
|
Element* element = GetElement();
|
|
|
|
if (element) {
|
|
|
|
return CallQueryInterface(element, aOwnerElement);
|
2014-03-21 20:04:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*aOwnerElement = nullptr;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetNodeValueInternal(nsAString& aNodeValue)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2011-10-18 11:19:44 +00:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
|
2011-06-23 08:30:48 +00:00
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
GetValue(aNodeValue);
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::SetNodeValueInternal(const nsAString& aNodeValue, ErrorResult& aError)
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2011-10-18 11:19:44 +00:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eNodeValue);
|
2011-06-23 08:30:48 +00:00
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
aError = SetValue(aNodeValue);
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2006-09-05 10:22:54 +00:00
|
|
|
nsresult
|
2014-06-20 02:01:40 +00:00
|
|
|
Attr::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
|
1999-01-12 08:45:23 +00:00
|
|
|
{
|
2005-06-01 13:46:20 +00:00
|
|
|
nsAutoString value;
|
2013-04-09 15:29:44 +00:00
|
|
|
const_cast<Attr*>(this)->GetValue(value);
|
1999-01-12 08:45:23 +00:00
|
|
|
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<mozilla::dom::NodeInfo> ni = aNodeInfo;
|
2016-01-11 18:01:31 +00:00
|
|
|
*aResult = new Attr(nullptr, ni.forget(), value);
|
2006-09-05 10:22:54 +00:00
|
|
|
if (!*aResult) {
|
1999-01-12 08:45:23 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2006-09-05 10:22:54 +00:00
|
|
|
NS_ADDREF(*aResult);
|
2005-10-27 14:09:23 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
1999-01-12 08:45:23 +00:00
|
|
|
}
|
|
|
|
|
2010-04-19 15:40:15 +00:00
|
|
|
already_AddRefed<nsIURI>
|
2013-09-24 21:56:52 +00:00
|
|
|
Attr::GetBaseURI(bool aTryUseXHRDocBaseURI) const
|
2010-04-19 15:40:15 +00:00
|
|
|
{
|
2014-04-10 16:09:50 +00:00
|
|
|
Element* parent = GetElement();
|
2010-04-19 15:40:15 +00:00
|
|
|
|
2013-09-24 21:56:52 +00:00
|
|
|
return parent ? parent->GetBaseURI(aTryUseXHRDocBaseURI) : nullptr;
|
2010-04-19 15:40:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
void
|
2014-08-05 10:10:00 +00:00
|
|
|
Attr::GetTextContentInternal(nsAString& aTextContent,
|
|
|
|
ErrorResult& aError)
|
2003-06-24 21:39:39 +00:00
|
|
|
{
|
2011-10-18 11:19:44 +00:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
|
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
GetValue(aTextContent);
|
2003-06-24 21:39:39 +00:00
|
|
|
}
|
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::SetTextContentInternal(const nsAString& aTextContent,
|
|
|
|
ErrorResult& aError)
|
2003-06-24 21:39:39 +00:00
|
|
|
{
|
2011-10-18 11:19:44 +00:00
|
|
|
OwnerDoc()->WarnOnceAbout(nsIDocument::eTextContent);
|
|
|
|
|
2012-10-09 12:31:24 +00:00
|
|
|
SetNodeValueInternal(aTextContent, aError);
|
2011-06-14 07:56:48 +00:00
|
|
|
}
|
2003-06-24 21:39:39 +00:00
|
|
|
|
2006-01-27 04:10:30 +00:00
|
|
|
NS_IMETHODIMP
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetIsId(bool* aReturn)
|
2006-01-27 04:10:30 +00:00
|
|
|
{
|
2014-05-30 07:36:53 +00:00
|
|
|
*aReturn = mNodeInfo->Equals(nsGkAtoms::id, kNameSpaceID_None);
|
2006-01-27 04:10:30 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::IsNodeOfType(uint32_t aFlags) const
|
2006-05-05 06:52:21 +00:00
|
|
|
{
|
|
|
|
return !(aFlags & ~eATTRIBUTE);
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetChildCount() const
|
2006-01-25 20:49:56 +00:00
|
|
|
{
|
2012-04-03 07:25:39 +00:00
|
|
|
return 0;
|
2006-01-25 20:49:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsIContent *
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetChildAt(uint32_t aIndex) const
|
2006-01-25 20:49:56 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2006-01-25 20:49:56 +00:00
|
|
|
}
|
2008-07-11 20:42:19 +00:00
|
|
|
|
|
|
|
nsIContent * const *
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::GetChildArray(uint32_t* aChildCount) const
|
2008-07-11 20:42:19 +00:00
|
|
|
{
|
2012-04-03 07:25:39 +00:00
|
|
|
*aChildCount = 0;
|
2013-04-03 01:14:24 +00:00
|
|
|
return nullptr;
|
2009-01-02 17:00:18 +00:00
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::IndexOf(const nsINode* aPossibleChild) const
|
2006-01-25 20:49:56 +00:00
|
|
|
{
|
2012-04-03 07:25:39 +00:00
|
|
|
return -1;
|
2006-01-25 20:49:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::InsertChildAt(nsIContent* aKid, uint32_t aIndex,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNotify)
|
2006-01-25 20:49:56 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2012-03-29 21:09:07 +00:00
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::RemoveChildAt(uint32_t aIndex, bool aNotify)
|
2006-01-25 20:49:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-03-07 17:08:51 +00:00
|
|
|
nsresult
|
2014-03-18 04:48:19 +00:00
|
|
|
Attr::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2006-03-07 17:08:51 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
aVisitor.mCanHandle = true;
|
2006-03-07 17:08:51 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-08-19 23:40:42 +00:00
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::Initialize()
|
2005-08-19 23:40:42 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
sInitialized = true;
|
2005-08-19 23:40:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-04-09 15:29:44 +00:00
|
|
|
Attr::Shutdown()
|
2005-08-19 23:40:42 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
sInitialized = false;
|
2005-08-19 23:40:42 +00:00
|
|
|
}
|
2013-04-09 15:29:44 +00:00
|
|
|
|
2013-04-09 15:29:47 +00:00
|
|
|
JSObject*
|
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
|
|
|
Attr::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-04-09 15:29:47 +00:00
|
|
|
{
|
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
|
|
|
return AttrBinding::Wrap(aCx, this, aGivenProto);
|
2013-04-09 15:29:47 +00:00
|
|
|
}
|
|
|
|
|
2013-04-09 15:29:44 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|