Backed out 2 changesets (bug 1422931) for crashtest failures on dom/base/crashtests/1419799.html r=backout on a CLOSED TREE

Backed out changeset 60d9744e3fc4 (bug 1422931)
Backed out changeset cf554d5d70cc (bug 1422931)
This commit is contained in:
Narcis Beleuzu 2017-12-08 18:27:56 +02:00
Родитель 975f015349
Коммит f0d93dda2c
14 изменённых файлов: 12 добавлений и 94 удалений

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsIAnonymousContentCreator.h"
#include "nsIFrame.h"
#include "nsCSSAnonBoxes.h"
#include "nsDocument.h"
namespace mozilla {
namespace dom {
@ -67,8 +66,7 @@ ExplicitChildIterator::ExplicitChildIterator(const nsIContent* aParent,
mIsFirst(aStartAtBeginning),
mIndexInInserted(0)
{
mParentAsSlot = nsDocument::IsWebComponentsEnabled(mParent) ?
HTMLSlotElement::FromContent(mParent) : nullptr;
mParentAsSlot = HTMLSlotElement::FromContent(mParent);
}
nsIContent*

Просмотреть файл

@ -1,6 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<!-- Testing slot element with "dom.webcomponents.enabled" set to false -->
<slot><div></div></slot>
</html>

Просмотреть файл

@ -236,5 +236,4 @@ load 1406109-1.html
pref(dom.webcomponents.enabled,true) load 1324463.html
pref(dom.webcomponents.customelements.enabled,true) load 1413815.html
load 1411473.html
pref(dom.webcomponents.enabled,false) load 1422931.html
pref(dom.webcomponents.enabled,true) load 1419799.html

Просмотреть файл

@ -7534,7 +7534,7 @@ nsContentUtils::IsContentInsertionPoint(nsIContent* aContent)
bool
nsContentUtils::HasDistributedChildren(nsIContent* aContent)
{
if (!aContent || !nsDocument::IsWebComponentsEnabled(aContent)) {
if (!aContent) {
return false;
}

Просмотреть файл

@ -1538,7 +1538,6 @@ nsIDocument::nsIDocument()
mBufferingCSPViolations(false),
mAllowPaymentRequest(false),
mEncodingMenuDisabled(false),
mIsWebComponentsEnabled(false),
mIsScopedStyleEnabled(eScopedStyle_Unknown),
mCompatMode(eCompatibility_FullStandards),
mReadyState(ReadyState::READYSTATE_UNINITIALIZED),
@ -2721,48 +2720,6 @@ nsDocument::IsSynthesized() {
return synthesized;
}
bool
nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
{
JS::Rooted<JSObject*> obj(aCx, aObject);
JSAutoCompartment ac(aCx, obj);
JS::Rooted<JSObject*> global(aCx, JS_GetGlobalForObject(aCx, obj));
nsCOMPtr<nsPIDOMWindowInner> window =
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(global));
nsIDocument* doc = window ? window->GetExtantDoc() : nullptr;
if (!doc) {
return false;
}
// Once it is enabled for a document, it stays enabled.
if (doc->IsWebComponentsEnabled()) {
return true;
}
bool enabled = nsContentUtils::IsWebComponentsEnabled();
doc->SetWebComponentsEnabled(enabled);
return enabled;
}
bool
nsDocument::IsWebComponentsEnabled(const nsINode* aNode)
{
nsIDocument* doc = aNode->OwnerDoc();
// Once it is enabled for a document, it stays enabled.
if (doc->IsWebComponentsEnabled()) {
return true;
}
bool enabled = nsContentUtils::IsWebComponentsEnabled();
doc->SetWebComponentsEnabled(enabled);
return enabled;
}
nsresult
nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,

Просмотреть файл

@ -665,11 +665,6 @@ public:
virtual void ResolveScheduledSVGPresAttrs() override;
bool IsSynthesized();
// Check whether web components are enabled for the global of aObject.
static bool IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject);
// Check whether web components are enabled for the document this node belongs
// to.
static bool IsWebComponentsEnabled(const nsINode* aNode);
private:
void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet);
void SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages);

Просмотреть файл

@ -3256,16 +3256,6 @@ public:
virtual bool AllowPaymentRequest() const = 0;
virtual void SetAllowPaymentRequest(bool aAllowPaymentRequest) = 0;
bool IsWebComponentsEnabled() const
{
return mIsWebComponentsEnabled;
}
void SetWebComponentsEnabled(bool aEnabled)
{
mIsWebComponentsEnabled = aEnabled;
}
protected:
bool GetUseCounter(mozilla::UseCounter aUseCounter)
{
@ -3622,10 +3612,6 @@ protected:
// True if the encoding menu should be disabled.
bool mEncodingMenuDisabled : 1;
// True if dom.webcomponents.enabled pref is set. It can not be unset once
// set to true.
bool mIsWebComponentsEnabled : 1;
// Whether <style scoped> support is enabled in this document.
enum { eScopedStyle_Unknown, eScopedStyle_Disabled, eScopedStyle_Enabled };
unsigned int mIsScopedStyleEnabled : 2;

Просмотреть файл

@ -21,7 +21,6 @@
#ifdef DEBUG
#include "nsRange.h"
#endif
#include "nsDocument.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -158,12 +157,6 @@ void nsTextNode::UnbindFromTree(bool aDeep, bool aNullParent)
nsGenericDOMDataNode::UnbindFromTree(aDeep, aNullParent);
}
bool
nsTextNode::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
{
return nsDocument::IsWebComponentsEnabled(aCx, aObject);
}
#ifdef DEBUG
void
nsTextNode::List(FILE* out, int32_t aIndent) const

Просмотреть файл

@ -75,10 +75,6 @@ public:
virtual nsIDOMNode* AsDOMNode() override { return this; }
// Need to have a copy here because including nsDocument.h in this file will
// fail to build on Windows.
static bool IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject);
#ifdef DEBUG
virtual void List(FILE* out, int32_t aIndent) const override;
virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const override;

Просмотреть файл

@ -16,7 +16,7 @@ NS_NewHTMLSlotElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser)
{
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
if (nsDocument::IsWebComponentsEnabled(nodeInfo->GetDocument())) {
if (nsContentUtils::IsWebComponentsEnabled()) {
already_AddRefed<mozilla::dom::NodeInfo> nodeInfoArg(nodeInfo.forget());
return new mozilla::dom::HTMLSlotElement(nodeInfoArg);
}

Просмотреть файл

@ -245,19 +245,19 @@ dictionary ShadowRootInit {
// https://dom.spec.whatwg.org/#element
partial interface Element {
// Shadow DOM v1
[Throws, Func="nsDocument::IsWebComponentsEnabled"]
[Throws, Pref="dom.webcomponents.enabled"]
ShadowRoot attachShadow(ShadowRootInit shadowRootInitDict);
[BinaryName="shadowRootByMode", Func="nsDocument::IsWebComponentsEnabled"]
[BinaryName="shadowRootByMode", Pref="dom.webcomponents.enabled"]
readonly attribute ShadowRoot? shadowRoot;
[BinaryName="assignedSlotByMode", Func="nsDocument::IsWebComponentsEnabled"]
[BinaryName="assignedSlotByMode", Pref="dom.webcomponents.enabled"]
readonly attribute HTMLSlotElement? assignedSlot;
[CEReactions, Unscopable, SetterThrows, Func="nsDocument::IsWebComponentsEnabled"]
[CEReactions, Unscopable, SetterThrows, Pref="dom.webcomponents.enabled"]
attribute DOMString slot;
// [deprecated] Shadow DOM v0
[Throws, Func="nsDocument::IsWebComponentsEnabled"]
[Throws, Pref="dom.webcomponents.enabled"]
ShadowRoot createShadowRoot();
[Func="nsDocument::IsWebComponentsEnabled"]
[Pref="dom.webcomponents.enabled"]
NodeList getDestinationInsertionPoints();
};

Просмотреть файл

@ -11,7 +11,7 @@
* and create derivative works of this document.
*/
[Func="nsDocument::IsWebComponentsEnabled", Exposed=Window, HTMLConstructor]
[Pref="dom.webcomponents.enabled", Exposed=Window, HTMLConstructor]
interface HTMLSlotElement : HTMLElement {
[CEReactions, SetterThrows] attribute DOMString name;
sequence<Node> assignedNodes(optional AssignedNodesOptions options);

Просмотреть файл

@ -17,7 +17,7 @@ enum ShadowRootMode {
};
// https://dom.spec.whatwg.org/#shadowroot
[Func="nsDocument::IsWebComponentsEnabled"]
[Pref="dom.webcomponents.enabled"]
interface ShadowRoot : DocumentFragment
{
// Shadow DOM v1

Просмотреть файл

@ -19,7 +19,7 @@ interface Text : CharacterData {
};
partial interface Text {
[BinaryName="assignedSlotByMode", Func="nsTextNode::IsWebComponentsEnabled"]
[BinaryName="assignedSlotByMode", Pref="dom.webcomponents.enabled"]
readonly attribute HTMLSlotElement? assignedSlot;
};