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/. */
|
1998-11-12 01:06:16 +03:00
|
|
|
|
|
|
|
#include "nsXMLElement.h"
|
2012-11-22 15:09:57 +04:00
|
|
|
#include "mozilla/dom/ElementBinding.h"
|
2013-10-03 00:09:18 +04:00
|
|
|
#include "mozilla/dom/ElementInlines.h"
|
2011-08-11 17:29:50 +04:00
|
|
|
#include "nsContentUtils.h" // nsAutoScriptBlocker
|
2006-04-24 09:40:11 +04:00
|
|
|
|
2017-04-16 18:29:49 +03:00
|
|
|
using namespace mozilla;
|
2012-11-15 02:10:08 +04:00
|
|
|
using namespace mozilla::dom;
|
|
|
|
|
1998-11-12 01:06:16 +03:00
|
|
|
nsresult
|
2013-12-03 18:40:11 +04:00
|
|
|
NS_NewXMLElement(Element** aInstancePtrResult,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
1998-11-12 01:06:16 +03:00
|
|
|
{
|
2008-02-03 02:41:24 +03:00
|
|
|
nsXMLElement* it = new nsXMLElement(aNodeInfo);
|
2004-05-19 00:58:12 +04:00
|
|
|
NS_ADDREF(*aInstancePtrResult = it);
|
2000-12-23 13:56:31 +03:00
|
|
|
return NS_OK;
|
1998-11-12 01:06:16 +03:00
|
|
|
}
|
|
|
|
|
2012-11-22 15:09:57 +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
|
|
|
nsXMLElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2012-11-22 15:09:57 +04:00
|
|
|
{
|
2018-06-26 00:20:54 +03:00
|
|
|
return Element_Binding::Wrap(aCx, this, aGivenProto);
|
2012-11-22 15:09:57 +04:00
|
|
|
}
|
|
|
|
|
2017-04-16 18:29:49 +03:00
|
|
|
void
|
|
|
|
nsXMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|
|
|
{
|
|
|
|
CSSPseudoElementType pseudoType = GetPseudoElementType();
|
|
|
|
bool isBefore = pseudoType == CSSPseudoElementType::before;
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* property = isBefore
|
2017-04-16 18:29:49 +03:00
|
|
|
? nsGkAtoms::beforePseudoProperty : nsGkAtoms::afterPseudoProperty;
|
|
|
|
|
|
|
|
switch (pseudoType) {
|
|
|
|
case CSSPseudoElementType::before:
|
|
|
|
case CSSPseudoElementType::after: {
|
|
|
|
MOZ_ASSERT(GetParent());
|
|
|
|
MOZ_ASSERT(GetParent()->IsElement());
|
|
|
|
GetParent()->DeleteProperty(property);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Element::UnbindFromTree(aDeep, aNullParent);
|
|
|
|
}
|
|
|
|
|
2006-09-05 14:22:54 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(nsXMLElement)
|