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/. */
|
2011-07-23 09:45:38 +00:00
|
|
|
|
2013-02-08 12:20:11 +00:00
|
|
|
#include "mozilla/dom/HTMLSharedElement.h"
|
2013-02-08 12:20:11 +00:00
|
|
|
#include "mozilla/dom/HTMLBaseElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLDirectoryElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLHeadElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLHtmlElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLParamElementBinding.h"
|
|
|
|
#include "mozilla/dom/HTMLQuoteElementBinding.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
|
2018-08-03 21:16:04 +00:00
|
|
|
#include "mozilla/AsyncEventDispatcher.h"
|
2018-06-22 16:48:42 +00:00
|
|
|
#include "mozilla/MappedDeclarations.h"
|
2013-02-08 12:20:11 +00:00
|
|
|
#include "nsAttrValueInlines.h"
|
2001-10-26 09:31:32 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2004-01-26 19:22:05 +00:00
|
|
|
#include "nsMappedAttributes.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
#include "nsContentUtils.h"
|
2016-04-26 09:48:29 +00:00
|
|
|
#include "nsIContentSecurityPolicy.h"
|
2013-09-07 13:01:08 +00:00
|
|
|
#include "nsIURI.h"
|
2010-11-12 23:29:25 +00:00
|
|
|
|
2013-02-08 12:20:11 +00:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Shared)
|
2001-10-26 09:31:32 +00:00
|
|
|
|
2013-01-04 17:02:14 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2009-09-25 16:50:26 +00:00
|
|
|
|
2013-02-08 12:20:11 +00:00
|
|
|
extern nsAttrValue::EnumTable kListTypeTable[];
|
2001-10-26 09:31:32 +00:00
|
|
|
|
2013-02-08 12:20:11 +00:00
|
|
|
HTMLSharedElement::~HTMLSharedElement()
|
2001-10-26 09:31:32 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-02-08 12:20:11 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLSharedElement)
|
2001-10-26 09:31:32 +00:00
|
|
|
|
2017-11-10 02:22:44 +00:00
|
|
|
void
|
2013-02-08 12:20:11 +00:00
|
|
|
HTMLSharedElement::GetHref(nsAString& aValue)
|
2010-10-07 16:39:01 +00:00
|
|
|
{
|
2016-04-22 21:59:16 +00:00
|
|
|
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::base),
|
|
|
|
"This should only get called for <base> elements");
|
2010-10-07 16:39:01 +00:00
|
|
|
nsAutoString href;
|
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
2011-10-18 10:53:36 +00:00
|
|
|
nsIDocument* doc = OwnerDoc();
|
2011-10-18 11:19:44 +00:00
|
|
|
nsContentUtils::NewURIWithDocumentCharset(
|
2016-04-22 21:59:16 +00:00
|
|
|
getter_AddRefs(uri), href, doc, doc->GetFallbackBaseURI());
|
2011-10-18 11:19:44 +00:00
|
|
|
|
2010-10-07 16:39:01 +00:00
|
|
|
if (!uri) {
|
|
|
|
aValue = href;
|
2017-11-10 02:22:44 +00:00
|
|
|
return;
|
2010-10-07 16:39:01 +00:00
|
|
|
}
|
2017-07-06 12:00:35 +00:00
|
|
|
|
2012-09-02 02:35:17 +00:00
|
|
|
nsAutoCString spec;
|
2010-10-07 16:39:01 +00:00
|
|
|
uri->GetSpec(spec);
|
|
|
|
CopyUTF8toUTF16(spec, aValue);
|
|
|
|
}
|
|
|
|
|
2018-08-03 21:16:04 +00:00
|
|
|
void
|
|
|
|
HTMLSharedElement::DoneAddingChildren(bool aHaveNotified)
|
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::head)) {
|
2018-09-07 01:28:40 +00:00
|
|
|
nsCOMPtr<nsIDocument> doc = GetUncomposedDoc();
|
|
|
|
if (doc) {
|
|
|
|
doc->OnL10nResourceContainerParsed();
|
|
|
|
}
|
|
|
|
|
2018-08-03 21:16:04 +00:00
|
|
|
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
|
|
|
new AsyncEventDispatcher(this,
|
|
|
|
NS_LITERAL_STRING("DOMHeadElementParsed"),
|
|
|
|
CanBubble::eYes,
|
|
|
|
ChromeOnlyDispatch::eYes);
|
|
|
|
// Always run async in order to avoid running script when the content
|
|
|
|
// sink isn't expecting it.
|
|
|
|
asyncDispatcher->PostDOMEvent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-02-08 12:20:11 +00:00
|
|
|
HTMLSharedElement::ParseAttribute(int32_t aNamespaceID,
|
2017-10-02 22:05:19 +00:00
|
|
|
nsAtom* aAttribute,
|
2013-02-08 12:20:11 +00:00
|
|
|
const nsAString& aValue,
|
2017-11-02 03:35:52 +00:00
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
2013-02-08 12:20:11 +00:00
|
|
|
nsAttrValue& aResult)
|
2001-10-26 09:31:32 +00:00
|
|
|
{
|
2010-08-20 06:05:05 +00:00
|
|
|
if (aNamespaceID == kNameSpaceID_None &&
|
2011-08-08 17:31:32 +00:00
|
|
|
mNodeInfo->Equals(nsGkAtoms::dir)) {
|
2010-08-20 06:05:05 +00:00
|
|
|
if (aAttribute == nsGkAtoms::type) {
|
2013-01-04 17:02:14 +00:00
|
|
|
return aResult.ParseEnumValue(aValue, mozilla::dom::kListTypeTable, false);
|
2004-03-04 02:06:28 +00:00
|
|
|
}
|
2010-08-20 06:05:05 +00:00
|
|
|
if (aAttribute == nsGkAtoms::start) {
|
|
|
|
return aResult.ParseIntWithBounds(aValue, 1);
|
2001-10-26 09:31:32 +00:00
|
|
|
}
|
2004-04-12 22:25:17 +00:00
|
|
|
}
|
2001-10-26 09:31:32 +00:00
|
|
|
|
2005-11-29 16:37:15 +00:00
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
2017-11-02 03:35:52 +00:00
|
|
|
aMaybeScriptedPrincipal, aResult);
|
2001-10-26 09:31:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-08-08 17:31:32 +00:00
|
|
|
DirectoryMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
2018-06-22 16:48:42 +00:00
|
|
|
MappedDeclarations& aDecls)
|
2001-10-26 09:31:32 +00:00
|
|
|
{
|
2018-06-22 16:48:42 +00:00
|
|
|
if (!aDecls.PropertyIsSet(eCSSProperty_list_style_type)) {
|
2018-03-29 01:39:07 +00:00
|
|
|
// type: enum
|
|
|
|
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
|
|
|
if (value) {
|
|
|
|
if (value->Type() == nsAttrValue::eEnum) {
|
2018-06-22 16:48:42 +00:00
|
|
|
aDecls.SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
2018-03-29 01:39:07 +00:00
|
|
|
} else {
|
2018-06-22 16:48:42 +00:00
|
|
|
aDecls.SetKeywordValue(eCSSProperty_list_style_type, NS_STYLE_LIST_STYLE_DISC);
|
2004-04-12 22:25:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-22 16:48:42 +00:00
|
|
|
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
2001-10-26 09:31:32 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHODIMP_(bool)
|
2017-10-02 22:05:19 +00:00
|
|
|
HTMLSharedElement::IsAttributeMapped(const nsAtom* aAttribute) const
|
2001-10-26 09:31:32 +00:00
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::dir)) {
|
2004-04-12 22:25:17 +00:00
|
|
|
static const MappedAttributeEntry attributes[] = {
|
2018-04-03 03:21:06 +00:00
|
|
|
{ nsGkAtoms::type },
|
|
|
|
// { nsGkAtoms::compact }, // XXX
|
2017-07-06 12:00:35 +00:00
|
|
|
{ nullptr}
|
2004-04-12 22:25:17 +00:00
|
|
|
};
|
2017-07-06 12:00:35 +00:00
|
|
|
|
2004-04-12 22:25:17 +00:00
|
|
|
static const MappedAttributeEntry* const map[] = {
|
|
|
|
attributes,
|
|
|
|
sCommonAttributeMap,
|
|
|
|
};
|
|
|
|
|
2011-12-18 10:09:27 +00:00
|
|
|
return FindAttributeDependence(aAttribute, map);
|
2001-10-26 09:31:32 +00:00
|
|
|
}
|
|
|
|
|
2004-02-25 21:04:50 +00:00
|
|
|
return nsGenericHTMLElement::IsAttributeMapped(aAttribute);
|
2001-10-26 09:31:32 +00:00
|
|
|
}
|
|
|
|
|
2011-01-14 15:34:39 +00:00
|
|
|
static void
|
|
|
|
SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
|
2010-04-23 16:10:07 +00:00
|
|
|
{
|
2018-04-28 19:50:58 +00:00
|
|
|
MOZ_ASSERT(aDocument, "Need a document!");
|
2010-04-23 16:10:07 +00:00
|
|
|
|
2011-01-14 15:34:39 +00:00
|
|
|
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
|
|
|
child = child->GetNextNode()) {
|
2015-03-03 11:08:59 +00:00
|
|
|
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
2017-12-07 18:13:50 +00:00
|
|
|
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
2010-04-23 16:10:07 +00:00
|
|
|
if (aMustMatch && child != aMustMatch) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-01-14 02:36:24 +00:00
|
|
|
// Resolve the <base> element's href relative to our document's
|
|
|
|
// fallback base URI.
|
2010-04-23 16:10:07 +00:00
|
|
|
nsAutoString href;
|
2017-12-07 18:13:50 +00:00
|
|
|
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
2010-04-23 16:10:07 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> newBaseURI;
|
|
|
|
nsContentUtils::NewURIWithDocumentCharset(
|
2011-01-14 15:34:39 +00:00
|
|
|
getter_AddRefs(newBaseURI), href, aDocument,
|
2016-01-14 02:36:24 +00:00
|
|
|
aDocument->GetFallbackBaseURI());
|
2010-04-23 16:10:07 +00:00
|
|
|
|
2016-04-26 09:48:29 +00:00
|
|
|
// Check if CSP allows this base-uri
|
|
|
|
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
|
|
|
nsresult rv = aDocument->NodePrincipal()->GetCsp(getter_AddRefs(csp));
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Getting CSP Failed");
|
|
|
|
// For all the different error cases we assign a nullptr to
|
|
|
|
// newBaseURI, so we basically call aDocument->SetBaseURI(nullptr);
|
2010-04-23 16:10:07 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
2016-04-26 09:48:29 +00:00
|
|
|
newBaseURI = nullptr;
|
|
|
|
}
|
|
|
|
if (csp && newBaseURI) {
|
|
|
|
// base-uri is only enforced if explicitly defined in the
|
|
|
|
// policy - do *not* consult default-src, see:
|
|
|
|
// http://www.w3.org/TR/CSP2/#directive-default-src
|
|
|
|
bool cspPermitsBaseURI = true;
|
2018-10-23 06:17:13 +00:00
|
|
|
rv = csp->Permits(child->AsElement(), nullptr /* nsICSPEventListener */,
|
|
|
|
newBaseURI,
|
2018-07-10 15:40:21 +00:00
|
|
|
nsIContentSecurityPolicy::BASE_URI_DIRECTIVE,
|
2016-04-26 09:48:29 +00:00
|
|
|
true, &cspPermitsBaseURI);
|
|
|
|
if (NS_FAILED(rv) || !cspPermitsBaseURI) {
|
|
|
|
newBaseURI = nullptr;
|
|
|
|
}
|
2010-04-23 16:10:07 +00:00
|
|
|
}
|
2016-04-26 09:48:29 +00:00
|
|
|
aDocument->SetBaseURI(newBaseURI);
|
|
|
|
aDocument->SetChromeXHRDocBaseURI(nullptr);
|
2010-04-23 16:10:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
aDocument->SetBaseURI(nullptr);
|
2011-01-14 15:34:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
|
|
|
|
nsIContent* aMustMatch)
|
|
|
|
{
|
2018-04-28 19:50:58 +00:00
|
|
|
MOZ_ASSERT(aDocument, "Need a document!");
|
2011-01-14 15:34:39 +00:00
|
|
|
|
|
|
|
for (nsIContent* child = aDocument->GetFirstChild(); child;
|
|
|
|
child = child->GetNextNode()) {
|
2015-03-03 11:08:59 +00:00
|
|
|
if (child->IsHTMLElement(nsGkAtoms::base) &&
|
2017-12-07 18:13:50 +00:00
|
|
|
child->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
2011-01-14 15:34:39 +00:00
|
|
|
if (aMustMatch && child != aMustMatch) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsString target;
|
2017-12-07 18:13:50 +00:00
|
|
|
child->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::target, target);
|
2011-01-14 15:34:39 +00:00
|
|
|
aDocument->SetBaseTarget(target);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aDocument->SetBaseTarget(EmptyString());
|
2010-04-23 16:10:07 +00:00
|
|
|
}
|
|
|
|
|
2009-09-25 16:50:26 +00:00
|
|
|
nsresult
|
2017-10-02 22:05:19 +00:00
|
|
|
HTMLSharedElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
|
2017-06-07 17:28:20 +00:00
|
|
|
const nsAttrValue* aValue,
|
2017-10-09 21:33:38 +00:00
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
|
|
|
bool aNotify)
|
2009-09-25 16:50:26 +00:00
|
|
|
{
|
2017-06-07 17:28:20 +00:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
2011-01-14 15:34:39 +00:00
|
|
|
if (aName == nsGkAtoms::href) {
|
2017-06-07 17:28:20 +00:00
|
|
|
// If the href attribute of a <base> tag is changing, we may need to
|
|
|
|
// update the document's base URI, which will cause all the links on the
|
|
|
|
// page to be re-resolved given the new base.
|
|
|
|
// If the href is being unset (aValue is null), we will need to find a new
|
|
|
|
// <base>.
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::base) && IsInUncomposedDoc()) {
|
|
|
|
SetBaseURIUsingFirstBaseWithHref(GetUncomposedDoc(),
|
|
|
|
aValue ? this : nullptr);
|
|
|
|
}
|
2011-01-14 15:34:39 +00:00
|
|
|
} else if (aName == nsGkAtoms::target) {
|
2017-06-07 17:28:20 +00:00
|
|
|
// The target attribute is in pretty much the same situation as the href
|
|
|
|
// attribute, above.
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::base) && IsInUncomposedDoc()) {
|
|
|
|
SetBaseTargetUsingFirstBaseWithTarget(GetUncomposedDoc(),
|
|
|
|
aValue ? this : nullptr);
|
|
|
|
}
|
2011-01-14 15:34:39 +00:00
|
|
|
}
|
2009-09-25 16:50:26 +00:00
|
|
|
}
|
|
|
|
|
2017-06-07 17:28:20 +00:00
|
|
|
return nsGenericHTMLElement::AfterSetAttr(aNamespaceID, aName, aValue,
|
2017-10-09 21:33:38 +00:00
|
|
|
aOldValue, aSubjectPrincipal, aNotify);
|
2009-09-25 16:50:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-02-08 12:20:11 +00:00
|
|
|
HTMLSharedElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
2018-07-31 18:18:38 +00:00
|
|
|
nsIContent* aBindingParent)
|
2009-09-25 16:50:26 +00:00
|
|
|
{
|
|
|
|
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
2018-07-31 18:18:38 +00:00
|
|
|
aBindingParent);
|
2010-04-23 16:10:07 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2009-09-25 16:50:26 +00:00
|
|
|
|
2011-01-14 15:34:39 +00:00
|
|
|
// The document stores a pointer to its base URI and base target, which we may
|
2009-09-25 16:50:26 +00:00
|
|
|
// need to update here.
|
2011-01-14 15:34:39 +00:00
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::base) &&
|
|
|
|
aDocument) {
|
|
|
|
if (HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
|
|
|
SetBaseURIUsingFirstBaseWithHref(aDocument, this);
|
|
|
|
}
|
|
|
|
if (HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
|
|
|
SetBaseTargetUsingFirstBaseWithTarget(aDocument, this);
|
|
|
|
}
|
2009-09-25 16:50:26 +00:00
|
|
|
}
|
|
|
|
|
2010-04-23 16:10:07 +00:00
|
|
|
return NS_OK;
|
2009-09-25 16:50:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-08 12:20:11 +00:00
|
|
|
HTMLSharedElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2009-09-25 16:50:26 +00:00
|
|
|
{
|
2014-10-02 19:07:24 +00:00
|
|
|
nsIDocument* doc = GetUncomposedDoc();
|
2009-09-25 16:50:26 +00:00
|
|
|
|
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
|
|
|
|
|
|
|
// If we're removing a <base> from a document, we may need to update the
|
2011-01-14 15:34:39 +00:00
|
|
|
// document's base URI and base target
|
|
|
|
if (doc && mNodeInfo->Equals(nsGkAtoms::base)) {
|
|
|
|
if (HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
2012-07-30 14:20:58 +00:00
|
|
|
SetBaseURIUsingFirstBaseWithHref(doc, nullptr);
|
2010-04-23 16:10:07 +00:00
|
|
|
}
|
2011-01-14 15:34:39 +00:00
|
|
|
if (HasAttr(kNameSpaceID_None, nsGkAtoms::target)) {
|
2012-07-30 14:20:58 +00:00
|
|
|
SetBaseTargetUsingFirstBaseWithTarget(doc, nullptr);
|
2010-04-23 16:10:07 +00:00
|
|
|
}
|
2009-09-25 16:50:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-01-12 19:45:38 +00:00
|
|
|
nsMapRuleToAttributesFunc
|
2013-02-08 12:20:11 +00:00
|
|
|
HTMLSharedElement::GetAttributeMappingFunction() const
|
2001-10-26 09:31:32 +00:00
|
|
|
{
|
2011-08-08 17:31:32 +00:00
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::dir)) {
|
|
|
|
return &DirectoryMapAttributesIntoRule;
|
2004-04-12 22:25:17 +00:00
|
|
|
}
|
2005-01-12 19:45:38 +00:00
|
|
|
|
|
|
|
return nsGenericHTMLElement::GetAttributeMappingFunction();
|
2001-10-26 09:31:32 +00:00
|
|
|
}
|
2013-02-08 12:20:11 +00:00
|
|
|
|
2013-02-08 12:20:11 +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
|
|
|
HTMLSharedElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-02-08 12:20:11 +00:00
|
|
|
{
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::param)) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLParamElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:20:11 +00:00
|
|
|
}
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::base)) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLBaseElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:20:11 +00:00
|
|
|
}
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::dir)) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLDirectoryElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:20:11 +00:00
|
|
|
}
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::q) ||
|
|
|
|
mNodeInfo->Equals(nsGkAtoms::blockquote)) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLQuoteElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:20:11 +00:00
|
|
|
}
|
|
|
|
if (mNodeInfo->Equals(nsGkAtoms::head)) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLHeadElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:20:11 +00:00
|
|
|
}
|
|
|
|
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::html));
|
2018-06-25 21:20:54 +00:00
|
|
|
return HTMLHtmlElement_Binding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:20:11 +00:00
|
|
|
}
|
|
|
|
|
2013-02-08 12:20:11 +00:00
|
|
|
} // namespace dom
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|