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;
|
|
|
|
|
2013-12-03 18:40:11 +04:00
|
|
|
nsresult NS_NewXMLElement(
|
|
|
|
Element** aInstancePtrResult,
|
2014-06-20 06:01:40 +04:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) {
|
2020-03-17 17:53:30 +03:00
|
|
|
RefPtr<mozilla::dom::NodeInfo> nodeInfo(std::move(aNodeInfo));
|
|
|
|
auto* nim = nodeInfo->NodeInfoManager();
|
|
|
|
RefPtr<nsXMLElement> it = new (nim) nsXMLElement(nodeInfo.forget());
|
|
|
|
|
2018-09-21 23:45:49 +03:00
|
|
|
it.forget(aInstancePtrResult);
|
2000-12-23 13:56:31 +03:00
|
|
|
return NS_OK;
|
1998-11-12 01:06:16 +03: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
|
|
|
JSObject* nsXMLElement::WrapNode(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-26 00:20:54 +03:00
|
|
|
return Element_Binding::Wrap(aCx, this, aGivenProto);
|
2012-11-22 15:09:57 +04:00
|
|
|
}
|
|
|
|
|
2024-02-20 18:05:40 +03:00
|
|
|
void nsXMLElement::UnbindFromTree(UnbindContext& aContext) {
|
2019-03-25 01:13:53 +03:00
|
|
|
nsAtom* property;
|
|
|
|
switch (GetPseudoElementType()) {
|
|
|
|
case PseudoStyleType::marker:
|
|
|
|
property = nsGkAtoms::markerPseudoProperty;
|
|
|
|
break;
|
2019-02-19 16:44:33 +03:00
|
|
|
case PseudoStyleType::before:
|
2019-03-25 01:13:53 +03:00
|
|
|
property = nsGkAtoms::beforePseudoProperty;
|
2017-04-16 18:29:49 +03:00
|
|
|
break;
|
2019-03-25 01:13:53 +03:00
|
|
|
case PseudoStyleType::after:
|
|
|
|
property = nsGkAtoms::afterPseudoProperty;
|
2017-04-16 18:29:49 +03:00
|
|
|
break;
|
2019-03-25 01:13:53 +03:00
|
|
|
default:
|
|
|
|
property = nullptr;
|
|
|
|
}
|
|
|
|
if (property) {
|
|
|
|
MOZ_ASSERT(GetParent());
|
|
|
|
MOZ_ASSERT(GetParent()->IsElement());
|
2020-02-06 19:06:49 +03:00
|
|
|
GetParent()->RemoveProperty(property);
|
2017-04-16 18:29:49 +03:00
|
|
|
}
|
2024-02-20 18:05:40 +03:00
|
|
|
Element::UnbindFromTree(aContext);
|
2017-04-16 18:29:49 +03:00
|
|
|
}
|
|
|
|
|
2006-09-05 14:22:54 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(nsXMLElement)
|