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/. */
|
2013-02-08 16:50:30 +04:00
|
|
|
|
|
|
|
#include "mozilla/dom/HTMLLinkElement.h"
|
|
|
|
|
2014-03-17 10:56:54 +04:00
|
|
|
#include "mozilla/AsyncEventDispatcher.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-03-18 08:48:21 +04:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2014-05-21 21:08:12 +04:00
|
|
|
#include "mozilla/Preferences.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/dom/HTMLLinkElementBinding.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsContentUtils.h"
|
1998-09-03 03:53:16 +04:00
|
|
|
#include "nsGenericHTMLElement.h"
|
2006-12-26 20:47:52 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2014-03-11 16:04:26 +04:00
|
|
|
#include "nsDOMTokenList.h"
|
2016-08-19 03:03:49 +03:00
|
|
|
#include "nsIContentInlines.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIDOMEvent.h"
|
1999-02-23 22:18:12 +03:00
|
|
|
#include "nsIDOMStyleSheet.h"
|
2014-05-21 21:08:12 +04:00
|
|
|
#include "nsINode.h"
|
1999-02-23 22:18:12 +03:00
|
|
|
#include "nsIStyleSheetLinkingElement.h"
|
2000-07-28 03:17:53 +04:00
|
|
|
#include "nsIURL.h"
|
2005-06-16 03:52:46 +04:00
|
|
|
#include "nsPIDOMWindow.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsReadableUtils.h"
|
|
|
|
#include "nsStyleConsts.h"
|
2016-05-05 06:41:24 +03:00
|
|
|
#include "nsStyleLinkElement.h"
|
2013-07-10 13:56:47 +04:00
|
|
|
#include "nsUnicharUtils.h"
|
1998-09-01 05:27:08 +04:00
|
|
|
|
2015-12-01 20:22:20 +03:00
|
|
|
#define LINK_ELEMENT_FLAG_BIT(n_) \
|
|
|
|
NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
|
|
|
|
|
|
|
|
// Link element specific bits
|
|
|
|
enum {
|
|
|
|
// Indicates that a DNS Prefetch has been requested from this Link element.
|
|
|
|
HTML_LINK_DNS_PREFETCH_REQUESTED = LINK_ELEMENT_FLAG_BIT(0),
|
|
|
|
|
|
|
|
// Indicates that a DNS Prefetch was added to the deferral queue
|
|
|
|
HTML_LINK_DNS_PREFETCH_DEFERRED = LINK_ELEMENT_FLAG_BIT(1)
|
|
|
|
};
|
|
|
|
|
|
|
|
#undef LINK_ELEMENT_FLAG_BIT
|
|
|
|
|
|
|
|
ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2);
|
|
|
|
|
2004-05-19 00:58:12 +04:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Link)
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2014-06-20 06:01:40 +04:00
|
|
|
HTMLLinkElement::HTMLLinkElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
|
2013-07-10 13:56:47 +04:00
|
|
|
: nsGenericHTMLElement(aNodeInfo)
|
2015-01-07 08:39:46 +03:00
|
|
|
, Link(this)
|
1998-09-01 05:27:08 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::~HTMLLinkElement()
|
1998-09-01 05:27:08 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-08-02 05:29:05 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLLinkElement)
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLLinkElement,
|
2012-10-08 06:39:09 +04:00
|
|
|
nsGenericHTMLElement)
|
|
|
|
tmp->nsStyleLinkElement::Traverse(cb);
|
2014-03-11 16:04:26 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRelList)
|
2012-10-08 06:39:09 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
2013-08-02 05:29:05 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLLinkElement,
|
2012-10-08 06:39:09 +04:00
|
|
|
nsGenericHTMLElement)
|
|
|
|
tmp->nsStyleLinkElement::Unlink();
|
2014-03-11 16:04:26 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRelList)
|
2012-10-08 06:39:09 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
1998-09-01 05:27:08 +04:00
|
|
|
|
2017-09-01 02:29:22 +03:00
|
|
|
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLLinkElement,
|
|
|
|
nsGenericHTMLElement,
|
|
|
|
nsIStyleSheetLinkingElement,
|
|
|
|
Link)
|
1998-09-01 05:27:08 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLLinkElement)
|
1998-09-01 05:27:08 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
bool
|
2013-03-17 18:42:59 +04:00
|
|
|
HTMLLinkElement::Disabled()
|
2013-02-08 16:50:30 +04:00
|
|
|
{
|
2016-10-14 14:25:38 +03:00
|
|
|
StyleSheet* ss = GetSheet();
|
2013-03-17 18:42:59 +04:00
|
|
|
return ss && ss->Disabled();
|
2013-02-08 16:50:30 +04:00
|
|
|
}
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
void
|
2013-03-17 18:42:59 +04:00
|
|
|
HTMLLinkElement::SetDisabled(bool aDisabled)
|
2013-02-08 16:50:30 +04:00
|
|
|
{
|
2016-10-14 14:25:38 +03:00
|
|
|
if (StyleSheet* ss = GetSheet()) {
|
2013-03-17 18:42:59 +04:00
|
|
|
ss->SetDisabled(aDisabled);
|
1999-02-23 22:18:12 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-01 20:22:20 +03:00
|
|
|
void
|
|
|
|
HTMLLinkElement::OnDNSPrefetchRequested()
|
|
|
|
{
|
|
|
|
UnsetFlags(HTML_LINK_DNS_PREFETCH_DEFERRED);
|
|
|
|
SetFlags(HTML_LINK_DNS_PREFETCH_REQUESTED);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLLinkElement::OnDNSPrefetchDeferred()
|
|
|
|
{
|
|
|
|
UnsetFlags(HTML_LINK_DNS_PREFETCH_REQUESTED);
|
|
|
|
SetFlags(HTML_LINK_DNS_PREFETCH_DEFERRED);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
HTMLLinkElement::HasDeferredDNSPrefetchRequest()
|
|
|
|
{
|
|
|
|
return HasFlag(HTML_LINK_DNS_PREFETCH_DEFERRED);
|
|
|
|
}
|
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
nsresult
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2005-04-06 03:54:35 +04:00
|
|
|
{
|
2012-12-07 18:35:14 +04:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2009-11-23 21:48:52 +03:00
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
|
|
|
|
aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2013-12-02 14:26:12 +04:00
|
|
|
|
|
|
|
// Link must be inert in ShadowRoot.
|
|
|
|
if (aDocument && !GetContainingShadow()) {
|
2011-11-14 07:24:41 +04:00
|
|
|
aDocument->RegisterPendingLinkUpdate(this);
|
|
|
|
}
|
2005-04-06 03:54:35 +04:00
|
|
|
|
2015-02-21 01:01:36 +03:00
|
|
|
if (IsInComposedDoc()) {
|
2017-07-10 16:05:56 +03:00
|
|
|
TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender();
|
2015-02-21 01:01:36 +03:00
|
|
|
}
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
void (HTMLLinkElement::*update)() = &HTMLLinkElement::UpdateStyleSheetInternal;
|
2017-06-12 22:34:10 +03:00
|
|
|
nsContentUtils::AddScriptRunner(
|
|
|
|
NewRunnableMethod("dom::HTMLLinkElement::BindToTree", this, update));
|
2005-04-06 03:54:35 +04:00
|
|
|
|
|
|
|
CreateAndDispatchEvent(aDocument, NS_LITERAL_STRING("DOMLinkAdded"));
|
|
|
|
|
2009-11-23 21:48:52 +03:00
|
|
|
return rv;
|
2005-04-06 03:54:35 +04:00
|
|
|
}
|
|
|
|
|
2013-08-08 09:26:32 +04:00
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::LinkAdded()
|
2005-06-16 03:52:46 +04:00
|
|
|
{
|
2011-10-18 14:53:36 +04:00
|
|
|
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkAdded"));
|
2005-06-16 03:52:46 +04:00
|
|
|
}
|
|
|
|
|
2013-08-08 09:26:32 +04:00
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::LinkRemoved()
|
2005-06-16 03:52:46 +04:00
|
|
|
{
|
2011-10-18 14:53:36 +04:00
|
|
|
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkRemoved"));
|
2005-06-16 03:52:46 +04:00
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2004-01-10 02:54:21 +03:00
|
|
|
{
|
2015-12-01 20:22:20 +03:00
|
|
|
// Cancel any DNS prefetches
|
|
|
|
// Note: Must come before ResetLinkState. If called after, it will recreate
|
|
|
|
// mCachedURI based on data that is invalid - due to a call to GetHostname.
|
|
|
|
CancelDNSPrefetch(HTML_LINK_DNS_PREFETCH_DEFERRED,
|
|
|
|
HTML_LINK_DNS_PREFETCH_REQUESTED);
|
2017-07-10 16:05:56 +03:00
|
|
|
CancelPrefetchOrPreload();
|
2015-12-01 20:22:20 +03:00
|
|
|
|
2009-11-23 21:48:52 +03:00
|
|
|
// If this link is ever reinserted into a document, it might
|
|
|
|
// be under a different xml:base, so forget the cached state now.
|
2012-12-07 18:35:14 +04:00
|
|
|
Link::ResetLinkState(false, Link::ElementHasHref());
|
2004-01-10 02:54:21 +03:00
|
|
|
|
2015-05-06 03:55:18 +03:00
|
|
|
// If this is reinserted back into the document it will not be
|
|
|
|
// from the parser.
|
2014-10-02 23:07:24 +04:00
|
|
|
nsCOMPtr<nsIDocument> oldDoc = GetUncomposedDoc();
|
2013-12-02 14:26:12 +04:00
|
|
|
|
|
|
|
// Check for a ShadowRoot because link elements are inert in a
|
|
|
|
// ShadowRoot.
|
|
|
|
ShadowRoot* oldShadowRoot = GetBindingParent() ?
|
|
|
|
GetBindingParent()->GetShadowRoot() : nullptr;
|
|
|
|
|
2005-04-06 03:54:35 +04:00
|
|
|
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMLinkRemoved"));
|
|
|
|
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
2013-12-02 14:26:12 +04:00
|
|
|
|
|
|
|
UpdateStyleSheetInternal(oldDoc, oldShadowRoot);
|
2004-01-10 02:54:21 +03:00
|
|
|
}
|
2005-04-06 03:54:35 +04:00
|
|
|
|
2012-08-28 21:10:07 +04:00
|
|
|
bool
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::ParseAttribute(int32_t aNamespaceID,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom* aAttribute,
|
2013-02-08 16:50:30 +04:00
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
2012-08-28 21:10:07 +04:00
|
|
|
{
|
2014-04-17 15:50:54 +04:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
|
|
if (aAttribute == nsGkAtoms::crossorigin) {
|
|
|
|
ParseCORSValue(aValue, aResult);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-07-10 16:05:56 +03:00
|
|
|
if (aAttribute == nsGkAtoms::as) {
|
|
|
|
ParseAsValue(aValue, aResult);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-04-17 15:50:54 +04:00
|
|
|
if (aAttribute == nsGkAtoms::sizes) {
|
|
|
|
aResult.ParseAtomArray(aValue);
|
|
|
|
return true;
|
|
|
|
}
|
2015-08-13 06:19:11 +03:00
|
|
|
|
|
|
|
if (aAttribute == nsGkAtoms::integrity) {
|
|
|
|
aResult.ParseStringOrAtom(aValue);
|
|
|
|
return true;
|
|
|
|
}
|
2012-08-28 21:10:07 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::CreateAndDispatchEvent(nsIDocument* aDoc,
|
|
|
|
const nsAString& aEventName)
|
2004-01-10 02:54:21 +03:00
|
|
|
{
|
|
|
|
if (!aDoc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// In the unlikely case that both rev is specified *and* rel=stylesheet,
|
|
|
|
// this code will cause the event to fire, on the principle that maybe the
|
2009-01-23 12:02:09 +03:00
|
|
|
// page really does want to specify that its author is a stylesheet. Since
|
2004-01-10 02:54:21 +03:00
|
|
|
// this should never actually happen and the performance hit is minimal,
|
|
|
|
// doing the "right" thing costs virtually nothing here, even if it doesn't
|
|
|
|
// make much sense.
|
2006-04-24 09:40:11 +04:00
|
|
|
static nsIContent::AttrValuesArray strings[] =
|
2012-07-30 18:20:58 +04:00
|
|
|
{&nsGkAtoms::_empty, &nsGkAtoms::stylesheet, nullptr};
|
2006-04-24 09:40:11 +04:00
|
|
|
|
|
|
|
if (!nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
|
2006-12-26 20:47:52 +03:00
|
|
|
nsGkAtoms::rev) &&
|
|
|
|
FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::rel,
|
2006-04-24 09:40:11 +04:00
|
|
|
strings, eIgnoreCase) != ATTR_VALUE_NO_MATCH)
|
2004-01-10 02:54:21 +03:00
|
|
|
return;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<AsyncEventDispatcher> asyncDispatcher =
|
2014-03-17 10:56:54 +04:00
|
|
|
new AsyncEventDispatcher(this, aEventName, true, true);
|
2011-11-16 11:50:19 +04:00
|
|
|
// Always run async in order to avoid running script when the content
|
|
|
|
// sink isn't expecting it.
|
2014-03-17 10:56:54 +04:00
|
|
|
asyncDispatcher->PostDOMEvent();
|
2004-01-10 02:54:21 +03:00
|
|
|
}
|
|
|
|
|
2015-12-01 20:22:20 +03:00
|
|
|
nsresult
|
2017-10-03 01:05:19 +03:00
|
|
|
HTMLLinkElement::BeforeSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
2017-03-16 21:50:41 +03:00
|
|
|
const nsAttrValueOrString* aValue, bool aNotify)
|
2015-12-01 20:22:20 +03:00
|
|
|
{
|
|
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
(aName == nsGkAtoms::href || aName == nsGkAtoms::rel)) {
|
|
|
|
CancelDNSPrefetch(HTML_LINK_DNS_PREFETCH_DEFERRED,
|
|
|
|
HTML_LINK_DNS_PREFETCH_REQUESTED);
|
2017-07-10 16:05:56 +03:00
|
|
|
CancelPrefetchOrPreload();
|
2015-12-01 20:22:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLElement::BeforeSetAttr(aNameSpaceID, aName,
|
|
|
|
aValue, aNotify);
|
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
nsresult
|
2017-10-03 01:05:19 +03:00
|
|
|
HTMLLinkElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
2017-05-19 00:09:01 +03:00
|
|
|
const nsAttrValue* aValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aSubjectPrincipal,
|
|
|
|
bool aNotify)
|
2004-01-10 02:54:21 +03:00
|
|
|
{
|
2015-09-23 04:19:49 +03:00
|
|
|
// It's safe to call ResetLinkState here because our new attr value has
|
|
|
|
// already been set or unset. ResetLinkState needs the updated attribute
|
|
|
|
// value because notifying the document that content states have changed will
|
|
|
|
// call IntrinsicState, which will try to get updated information about the
|
|
|
|
// visitedness from Link.
|
2006-12-26 20:47:52 +03:00
|
|
|
if (aName == nsGkAtoms::href && kNameSpaceID_None == aNameSpaceID) {
|
2015-09-23 04:19:49 +03:00
|
|
|
bool hasHref = aValue;
|
|
|
|
Link::ResetLinkState(!!aNotify, hasHref);
|
2014-10-17 02:00:12 +04:00
|
|
|
if (IsInUncomposedDoc()) {
|
|
|
|
CreateAndDispatchEvent(OwnerDoc(), NS_LITERAL_STRING("DOMLinkChanged"));
|
|
|
|
}
|
2004-01-10 02:54:21 +03:00
|
|
|
}
|
|
|
|
|
2017-10-06 05:40:48 +03:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::href) {
|
|
|
|
mTriggeringPrincipal = nsContentUtils::GetAttrTriggeringPrincipal(
|
|
|
|
this, aValue ? aValue->GetStringValue() : EmptyString(),
|
|
|
|
aSubjectPrincipal);
|
|
|
|
}
|
|
|
|
|
2015-09-23 04:19:49 +03:00
|
|
|
if (aValue) {
|
|
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
(aName == nsGkAtoms::href ||
|
|
|
|
aName == nsGkAtoms::rel ||
|
|
|
|
aName == nsGkAtoms::title ||
|
|
|
|
aName == nsGkAtoms::media ||
|
2017-07-10 16:05:56 +03:00
|
|
|
aName == nsGkAtoms::type ||
|
|
|
|
aName == nsGkAtoms::as ||
|
|
|
|
aName == nsGkAtoms::crossorigin)) {
|
2015-09-23 04:19:49 +03:00
|
|
|
bool dropSheet = false;
|
|
|
|
if (aName == nsGkAtoms::rel) {
|
|
|
|
nsAutoString value;
|
|
|
|
aValue->ToString(value);
|
2017-06-12 17:36:02 +03:00
|
|
|
uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(value);
|
2015-09-23 04:19:49 +03:00
|
|
|
if (GetSheet()) {
|
|
|
|
dropSheet = !(linkTypes & nsStyleLinkElement::eSTYLESHEET);
|
|
|
|
}
|
2014-05-21 21:08:12 +04:00
|
|
|
}
|
|
|
|
|
2015-12-01 20:22:20 +03:00
|
|
|
if ((aName == nsGkAtoms::rel || aName == nsGkAtoms::href) &&
|
2016-02-26 04:41:00 +03:00
|
|
|
IsInComposedDoc()) {
|
2017-07-10 16:05:56 +03:00
|
|
|
TryDNSPrefetchOrPreconnectOrPrefetchOrPreloadOrPrerender();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((aName == nsGkAtoms::as || aName == nsGkAtoms::type ||
|
|
|
|
aName == nsGkAtoms::crossorigin || aName == nsGkAtoms::media) &&
|
|
|
|
IsInComposedDoc()) {
|
|
|
|
UpdatePreload(aName, aValue, aOldValue);
|
2015-12-01 20:22:20 +03:00
|
|
|
}
|
|
|
|
|
2015-09-23 04:19:49 +03:00
|
|
|
UpdateStyleSheetInternal(nullptr, nullptr,
|
|
|
|
dropSheet ||
|
|
|
|
(aName == nsGkAtoms::title ||
|
|
|
|
aName == nsGkAtoms::media ||
|
|
|
|
aName == nsGkAtoms::type));
|
2014-05-21 21:08:12 +04:00
|
|
|
}
|
2015-09-23 04:19:49 +03:00
|
|
|
} else {
|
|
|
|
// Since removing href or rel makes us no longer link to a
|
|
|
|
// stylesheet, force updates for those too.
|
|
|
|
if (aNameSpaceID == kNameSpaceID_None) {
|
|
|
|
if (aName == nsGkAtoms::href ||
|
|
|
|
aName == nsGkAtoms::rel ||
|
|
|
|
aName == nsGkAtoms::title ||
|
|
|
|
aName == nsGkAtoms::media ||
|
|
|
|
aName == nsGkAtoms::type) {
|
|
|
|
UpdateStyleSheetInternal(nullptr, nullptr, true);
|
|
|
|
}
|
2017-07-10 16:05:56 +03:00
|
|
|
if ((aName == nsGkAtoms::as || aName == nsGkAtoms::type ||
|
|
|
|
aName == nsGkAtoms::crossorigin || aName == nsGkAtoms::media) &&
|
|
|
|
IsInComposedDoc()) {
|
|
|
|
UpdatePreload(aName, aValue, aOldValue);
|
|
|
|
}
|
2014-10-17 02:00:12 +04:00
|
|
|
}
|
2010-03-03 23:55:35 +03:00
|
|
|
}
|
|
|
|
|
2015-09-23 04:19:49 +03:00
|
|
|
return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue,
|
2017-10-10 00:33:38 +03:00
|
|
|
aOldValue, aSubjectPrincipal, aNotify);
|
2004-01-10 02:54:21 +03:00
|
|
|
}
|
|
|
|
|
2007-04-23 11:31:21 +04:00
|
|
|
nsresult
|
2016-10-21 05:11:07 +03:00
|
|
|
HTMLLinkElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
|
2007-04-23 11:31:21 +04:00
|
|
|
{
|
2016-10-21 05:11:07 +03:00
|
|
|
return GetEventTargetParentForAnchors(aVisitor);
|
2007-04-23 11:31:21 +04:00
|
|
|
}
|
|
|
|
|
2004-01-10 02:54:21 +03:00
|
|
|
nsresult
|
2014-03-18 08:48:20 +04:00
|
|
|
HTMLLinkElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
1998-09-01 05:27:08 +04:00
|
|
|
{
|
2006-03-07 20:08:51 +03:00
|
|
|
return PostHandleEventForAnchors(aVisitor);
|
1998-09-01 05:27:08 +04:00
|
|
|
}
|
1998-12-11 02:52:46 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::IsLink(nsIURI** aURI) const
|
2007-01-04 13:53:59 +03:00
|
|
|
{
|
|
|
|
return IsHTMLLink(aURI);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::GetLinkTarget(nsAString& aTarget)
|
2007-01-04 13:53:59 +03:00
|
|
|
{
|
2007-03-26 17:19:33 +04:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::target, aTarget);
|
|
|
|
if (aTarget.IsEmpty()) {
|
2007-01-04 13:53:59 +03:00
|
|
|
GetBaseTarget(aTarget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-05 06:41:24 +03:00
|
|
|
static const DOMTokenListSupportedToken sSupportedRelValues[] = {
|
|
|
|
// Keep this in sync with ToLinkMask in nsStyleLinkElement.cpp.
|
2017-10-17 19:38:10 +03:00
|
|
|
// "preload" must come first because it can be disabled.
|
2017-07-10 16:05:56 +03:00
|
|
|
"preload",
|
2017-10-11 10:20:00 +03:00
|
|
|
"prefetch",
|
|
|
|
"dns-prefetch",
|
|
|
|
"stylesheet",
|
|
|
|
"next",
|
|
|
|
"alternate",
|
|
|
|
"preconnect",
|
|
|
|
"icon",
|
|
|
|
"search",
|
|
|
|
nullptr
|
|
|
|
};
|
2017-10-17 19:38:10 +03:00
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
nsDOMTokenList*
|
2014-03-11 16:04:26 +04:00
|
|
|
HTMLLinkElement::RelList()
|
|
|
|
{
|
|
|
|
if (!mRelList) {
|
2017-10-11 10:20:00 +03:00
|
|
|
if (Preferences::GetBool("network.preload")) {
|
|
|
|
mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValues);
|
|
|
|
} else {
|
2017-10-17 19:38:10 +03:00
|
|
|
mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, &sSupportedRelValues[1]);
|
2017-10-11 10:20:00 +03:00
|
|
|
}
|
2014-03-11 16:04:26 +04:00
|
|
|
}
|
|
|
|
return mRelList;
|
|
|
|
}
|
|
|
|
|
2009-07-13 15:48:06 +04:00
|
|
|
already_AddRefed<nsIURI>
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::GetHrefURI() const
|
2000-07-28 03:17:53 +04:00
|
|
|
{
|
2009-07-13 15:48:06 +04:00
|
|
|
return GetHrefURIForAnchors();
|
2000-07-28 03:17:53 +04:00
|
|
|
}
|
2000-08-22 08:14:53 +04:00
|
|
|
|
2009-07-28 20:07:31 +04:00
|
|
|
already_AddRefed<nsIURI>
|
2017-10-06 05:40:48 +03:00
|
|
|
HTMLLinkElement::GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal)
|
2002-04-05 15:29:40 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*aIsInline = false;
|
2017-10-06 05:40:48 +03:00
|
|
|
*aTriggeringPrincipal = nullptr;
|
|
|
|
|
2011-05-11 13:46:59 +04:00
|
|
|
nsAutoString href;
|
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
|
|
|
|
if (href.IsEmpty()) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-05-11 13:46:59 +04:00
|
|
|
}
|
2017-10-06 05:40:48 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPrincipal> prin = mTriggeringPrincipal;
|
|
|
|
prin.forget(aTriggeringPrincipal);
|
|
|
|
|
2013-08-24 06:42:39 +04:00
|
|
|
nsCOMPtr<nsIURI> uri = Link::GetURI();
|
|
|
|
return uri.forget();
|
2002-04-05 15:29:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::GetStyleSheetInfo(nsAString& aTitle,
|
|
|
|
nsAString& aType,
|
|
|
|
nsAString& aMedia,
|
|
|
|
bool* aIsScoped,
|
|
|
|
bool* aIsAlternate)
|
2000-08-22 08:14:53 +04:00
|
|
|
{
|
2001-05-19 06:59:15 +04:00
|
|
|
aTitle.Truncate();
|
|
|
|
aType.Truncate();
|
|
|
|
aMedia.Truncate();
|
2013-01-09 03:25:47 +04:00
|
|
|
*aIsScoped = false;
|
2011-10-17 18:59:28 +04:00
|
|
|
*aIsAlternate = false;
|
2000-08-22 08:14:53 +04:00
|
|
|
|
2002-04-05 15:29:40 +04:00
|
|
|
nsAutoString rel;
|
2006-12-26 20:47:52 +03:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::rel, rel);
|
2017-06-12 17:36:02 +03:00
|
|
|
uint32_t linkTypes = nsStyleLinkElement::ParseLinkTypes(rel);
|
2002-04-05 15:29:40 +04:00
|
|
|
// Is it a stylesheet link?
|
2014-02-27 17:44:52 +04:00
|
|
|
if (!(linkTypes & nsStyleLinkElement::eSTYLESHEET)) {
|
2001-05-19 06:59:15 +04:00
|
|
|
return;
|
2002-04-05 15:29:40 +04:00
|
|
|
}
|
2001-05-19 06:59:15 +04:00
|
|
|
|
2002-04-05 15:29:40 +04:00
|
|
|
nsAutoString title;
|
2006-12-26 20:47:52 +03:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::title, title);
|
2001-05-19 06:59:15 +04:00
|
|
|
title.CompressWhitespace();
|
|
|
|
aTitle.Assign(title);
|
|
|
|
|
2002-04-05 15:29:40 +04:00
|
|
|
// If alternate, does it have title?
|
2014-02-27 17:44:52 +04:00
|
|
|
if (linkTypes & nsStyleLinkElement::eALTERNATE) {
|
2001-05-19 06:59:15 +04:00
|
|
|
if (aTitle.IsEmpty()) { // alternates must have title
|
|
|
|
return;
|
|
|
|
} else {
|
2011-10-17 18:59:28 +04:00
|
|
|
*aIsAlternate = true;
|
2001-05-19 06:59:15 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::media, aMedia);
|
2012-03-10 09:50:34 +04:00
|
|
|
// The HTML5 spec is formulated in terms of the CSSOM spec, which specifies
|
|
|
|
// that media queries should be ASCII lowercased during serialization.
|
|
|
|
nsContentUtils::ASCIIToLower(aMedia);
|
2001-05-19 06:59:15 +04:00
|
|
|
|
|
|
|
nsAutoString mimeType;
|
|
|
|
nsAutoString notUsed;
|
2006-12-26 20:47:52 +03:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::type, aType);
|
2012-02-27 15:57:48 +04:00
|
|
|
nsContentUtils::SplitMimeType(aType, mimeType, notUsed);
|
2004-06-17 04:13:25 +04:00
|
|
|
if (!mimeType.IsEmpty() && !mimeType.LowerCaseEqualsLiteral("text/css")) {
|
2001-05-19 06:59:15 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we get here we assume that we're loading a css file, so set the
|
|
|
|
// type to 'text/css'
|
2004-06-17 04:13:25 +04:00
|
|
|
aType.AssignLiteral("text/css");
|
2000-08-22 08:14:53 +04:00
|
|
|
}
|
2009-12-16 03:04:09 +03:00
|
|
|
|
2012-08-28 21:10:07 +04:00
|
|
|
CORSMode
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::GetCORSMode() const
|
2012-08-28 21:10:07 +04:00
|
|
|
{
|
2017-07-06 15:00:35 +03:00
|
|
|
return AttrValueToCORSMode(GetParsedAttr(nsGkAtoms::crossorigin));
|
2012-08-28 21:10:07 +04:00
|
|
|
}
|
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLLinkElement::IntrinsicState() const
|
2009-12-16 03:04:09 +03:00
|
|
|
{
|
|
|
|
return Link::LinkState() | nsGenericHTMLElement::IntrinsicState();
|
|
|
|
}
|
2012-02-20 07:51:48 +04:00
|
|
|
|
Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.
Here is an example of the output.
> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │ ├──12,772,544 B (12.26%) -- layout
> │ │ ├───4,483,744 B (04.30%) -- frames
> │ │ │ ├──1,653,552 B (01.59%) ── nsInlineFrame
> │ │ │ ├──1,415,760 B (01.36%) ── nsTextFrame
> │ │ │ ├────431,376 B (00.41%) ── nsBlockFrame
> │ │ │ ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │ │ │ ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │ │ │ ├────156,408 B (00.15%) ── nsBulletFrame
> │ │ │ ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │ │ │ ├─────27,656 B (00.03%) ── sundries
> │ │ │ ├─────23,520 B (00.02%) ── nsTableCellFrame
> │ │ │ ├─────16,704 B (00.02%) ── nsImageFrame
> │ │ │ ├─────15,488 B (00.01%) ── nsTableRowFrame
> │ │ │ ├─────13,776 B (00.01%) ── nsTableColFrame
> │ │ │ └─────13,376 B (00.01%) ── nsTableFrame
> │ │ ├───3,412,192 B (03.28%) -- servo-style-structs
> │ │ │ ├──1,288,224 B (01.24%) ── Display
> │ │ │ ├────742,400 B (00.71%) ── Position
> │ │ │ ├────308,736 B (00.30%) ── Font
> │ │ │ ├────226,512 B (00.22%) ── Background
> │ │ │ ├────218,304 B (00.21%) ── TextReset
> │ │ │ ├────214,896 B (00.21%) ── Text
> │ │ │ ├────130,560 B (00.13%) ── Border
> │ │ │ ├─────81,408 B (00.08%) ── UIReset
> │ │ │ ├─────61,440 B (00.06%) ── Padding
> │ │ │ ├─────38,176 B (00.04%) ── UserInterface
> │ │ │ ├─────29,232 B (00.03%) ── Margin
> │ │ │ ├─────21,824 B (00.02%) ── sundries
> │ │ │ ├─────20,080 B (00.02%) ── Color
> │ │ │ ├─────20,080 B (00.02%) ── Column
> │ │ │ └─────10,320 B (00.01%) ── Effects
> │ │ ├───2,227,680 B (02.14%) -- computed-values
> │ │ │ ├──1,182,928 B (01.14%) ── non-dom
> │ │ │ └──1,044,752 B (01.00%) ── dom
> │ │ ├───1,500,016 B (01.44%) ── text-runs
> │ │ ├─────492,640 B (00.47%) ── line-boxes
> │ │ ├─────326,688 B (00.31%) ── frame-properties
> │ │ ├─────301,760 B (00.29%) ── pres-shell
> │ │ ├──────27,648 B (00.03%) ── pres-contexts
> │ │ └─────────176 B (00.00%) ── style-sets
The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.
Other notable things done by the patch are as follows.
- It significantly changes the signatures of the methods measuring nsINode and
its subclasses, in order to handle the tallying of style structs separately
from element-nodes. Likewise for nsIFrame.
- It renames the 'layout/style-structs' sub-tree as
'layout/gecko-style-structs', to clearly distinguish it from the new
'layout/servo-style-structs' sub-tree.
- It adds some FFI functions to access various Rust-side data structures from
C++ code.
- There is a nasty hack used twice to measure Arcs, by stepping backwards from
an interior pointer to a base pointer. It works, but I want to replace it
with something better eventually. The "XXX WARNING" comments have details.
- It makes DMD print a line to the console if it sees a pointer it doesn't
recognise. This is useful for detecting when we are measuring an interior
pointer instead of a base pointer, which is bad but easy to do when Arcs are
involved.
- It removes the Rust code for measuring CVs, because it's now all done on the
C++ side.
MozReview-Commit-ID: BKebACLKtCi
--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 09:37:33 +03:00
|
|
|
void
|
2017-08-25 07:47:54 +03:00
|
|
|
HTMLLinkElement::AddSizeOfExcludingThis(nsWindowSizes& aSizes,
|
Bug 1387956 - Overhaul ComputedValues measurement, and add style structs measurement. r=bholley.
This patch moves measurement of ComputedValues objects from Rust to C++.
Measurement now happens (a) via DOM elements and (b) remaining elements via
the frame tree. Likewise for the style structs hanging off ComputedValues
objects.
Here is an example of the output.
> ├──27,600,448 B (26.49%) -- active/window(https://en.wikipedia.org/wiki/Barack_Obama)
> │ ├──12,772,544 B (12.26%) -- layout
> │ │ ├───4,483,744 B (04.30%) -- frames
> │ │ │ ├──1,653,552 B (01.59%) ── nsInlineFrame
> │ │ │ ├──1,415,760 B (01.36%) ── nsTextFrame
> │ │ │ ├────431,376 B (00.41%) ── nsBlockFrame
> │ │ │ ├────340,560 B (00.33%) ── nsHTMLScrollFrame
> │ │ │ ├────302,544 B (00.29%) ── nsContinuingTextFrame
> │ │ │ ├────156,408 B (00.15%) ── nsBulletFrame
> │ │ │ ├─────73,024 B (00.07%) ── nsPlaceholderFrame
> │ │ │ ├─────27,656 B (00.03%) ── sundries
> │ │ │ ├─────23,520 B (00.02%) ── nsTableCellFrame
> │ │ │ ├─────16,704 B (00.02%) ── nsImageFrame
> │ │ │ ├─────15,488 B (00.01%) ── nsTableRowFrame
> │ │ │ ├─────13,776 B (00.01%) ── nsTableColFrame
> │ │ │ └─────13,376 B (00.01%) ── nsTableFrame
> │ │ ├───3,412,192 B (03.28%) -- servo-style-structs
> │ │ │ ├──1,288,224 B (01.24%) ── Display
> │ │ │ ├────742,400 B (00.71%) ── Position
> │ │ │ ├────308,736 B (00.30%) ── Font
> │ │ │ ├────226,512 B (00.22%) ── Background
> │ │ │ ├────218,304 B (00.21%) ── TextReset
> │ │ │ ├────214,896 B (00.21%) ── Text
> │ │ │ ├────130,560 B (00.13%) ── Border
> │ │ │ ├─────81,408 B (00.08%) ── UIReset
> │ │ │ ├─────61,440 B (00.06%) ── Padding
> │ │ │ ├─────38,176 B (00.04%) ── UserInterface
> │ │ │ ├─────29,232 B (00.03%) ── Margin
> │ │ │ ├─────21,824 B (00.02%) ── sundries
> │ │ │ ├─────20,080 B (00.02%) ── Color
> │ │ │ ├─────20,080 B (00.02%) ── Column
> │ │ │ └─────10,320 B (00.01%) ── Effects
> │ │ ├───2,227,680 B (02.14%) -- computed-values
> │ │ │ ├──1,182,928 B (01.14%) ── non-dom
> │ │ │ └──1,044,752 B (01.00%) ── dom
> │ │ ├───1,500,016 B (01.44%) ── text-runs
> │ │ ├─────492,640 B (00.47%) ── line-boxes
> │ │ ├─────326,688 B (00.31%) ── frame-properties
> │ │ ├─────301,760 B (00.29%) ── pres-shell
> │ │ ├──────27,648 B (00.03%) ── pres-contexts
> │ │ └─────────176 B (00.00%) ── style-sets
The 'servo-style-structs' and 'computed-values' sub-trees are new. (Prior to
this patch, ComputedValues under DOM elements were tallied under the the
'dom/element-nodes' sub-tree, and ComputedValues not under DOM element were
ignored.) 'servo-style-structs/sundries' aggregates all the style structs that
are smaller than 8 KiB.
Other notable things done by the patch are as follows.
- It significantly changes the signatures of the methods measuring nsINode and
its subclasses, in order to handle the tallying of style structs separately
from element-nodes. Likewise for nsIFrame.
- It renames the 'layout/style-structs' sub-tree as
'layout/gecko-style-structs', to clearly distinguish it from the new
'layout/servo-style-structs' sub-tree.
- It adds some FFI functions to access various Rust-side data structures from
C++ code.
- There is a nasty hack used twice to measure Arcs, by stepping backwards from
an interior pointer to a base pointer. It works, but I want to replace it
with something better eventually. The "XXX WARNING" comments have details.
- It makes DMD print a line to the console if it sees a pointer it doesn't
recognise. This is useful for detecting when we are measuring an interior
pointer instead of a base pointer, which is bad but easy to do when Arcs are
involved.
- It removes the Rust code for measuring CVs, because it's now all done on the
C++ side.
MozReview-Commit-ID: BKebACLKtCi
--HG--
extra : rebase_source : 4d9a8c6b198a0ff025b811759a6bfa9f33a260ba
2017-08-11 09:37:33 +03:00
|
|
|
size_t* aNodeSize) const
|
2012-02-20 07:51:48 +04:00
|
|
|
{
|
2017-08-25 07:47:54 +03:00
|
|
|
nsGenericHTMLElement::AddSizeOfExcludingThis(aSizes, aNodeSize);
|
|
|
|
*aNodeSize += Link::SizeOfExcludingThis(aSizes.mState);
|
2012-02-20 07:51:48 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 16:50:30 +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
|
|
|
HTMLLinkElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-02-08 16:50:30 +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 HTMLLinkElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 16:50:30 +04:00
|
|
|
}
|
|
|
|
|
2017-07-10 16:05:56 +03:00
|
|
|
void
|
|
|
|
HTMLLinkElement::GetAs(nsAString& aResult)
|
|
|
|
{
|
|
|
|
GetEnumAttr(nsGkAtoms::as, EmptyCString().get(), aResult);
|
|
|
|
}
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|