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