Bug 1558571 - Move HTMLDocument.all to Document; r=farre

Differential Revision: https://phabricator.services.mozilla.com/D34569

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-07-08 18:49:45 +00:00
Родитель 0acaebd2c2
Коммит 9f6d9e9359
9 изменённых файлов: 22 добавлений и 34 удалений

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

@ -91,6 +91,7 @@
#include "mozilla/dom/FeaturePolicy.h"
#include "mozilla/dom/FeaturePolicyUtils.h"
#include "mozilla/dom/FramingChecker.h"
#include "mozilla/dom/HTMLAllCollection.h"
#include "mozilla/dom/HTMLSharedElement.h"
#include "mozilla/dom/Navigator.h"
#include "mozilla/dom/Performance.h"
@ -2003,6 +2004,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(Document)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSuppressedEventListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrototypeDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMidasCommandManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAll)
// Traverse all our nsCOMArrays.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPreloadingImages)
@ -5631,6 +5633,13 @@ void Document::CaptureEvents() { WarnOnceAbout(Document::eUseOfCaptureEvents); }
void Document::ReleaseEvents() { WarnOnceAbout(Document::eUseOfReleaseEvents); }
HTMLAllCollection* Document::All() {
if (!mAll) {
mAll = new HTMLAllCollection(this);
}
return mAll;
}
nsresult Document::GetSrcdocData(nsAString& aSrcdocData) {
if (mIsSrcdocDocument) {
nsCOMPtr<nsIInputStreamChannel> inStrmChan = do_QueryInterface(mChannel);

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

@ -185,6 +185,7 @@ class FeaturePolicy;
class FontFaceSet;
class FrameRequestCallback;
class ImageTracker;
class HTMLAllCollection;
class HTMLBodyElement;
class HTMLSharedElement;
class HTMLImageElement;
@ -3579,6 +3580,8 @@ class Document : public nsINode,
void CaptureEvents();
void ReleaseEvents();
mozilla::dom::HTMLAllCollection* All();
static bool IsUnprefixedFullscreenEnabled(JSContext* aCx, JSObject* aObject);
static bool DocumentSupportsL10n(JSContext* aCx, JSObject* aObject);
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
@ -5208,6 +5211,8 @@ class Document : public nsINode,
RefPtr<XULBroadcastManager> mXULBroadcastManager;
RefPtr<XULPersist> mXULPersist;
RefPtr<mozilla::dom::HTMLAllCollection> mAll;
// document lightweight theme for use with :-moz-lwtheme,
// :-moz-lwtheme-brighttext and :-moz-lwtheme-darktext
DocumentTheme mDocLWTheme;

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

@ -8,13 +8,15 @@
#include "mozilla/dom/HTMLAllCollectionBinding.h"
#include "mozilla/dom/Nullable.h"
#include "mozilla/dom/Document.h"
#include "mozilla/dom/Element.h"
#include "nsHTMLDocument.h"
#include "nsContentList.h"
#include "nsGenericHTMLElement.h"
namespace mozilla {
namespace dom {
HTMLAllCollection::HTMLAllCollection(nsHTMLDocument* aDocument)
HTMLAllCollection::HTMLAllCollection(mozilla::dom::Document* aDocument)
: mDocument(aDocument) {
MOZ_ASSERT(mDocument);
}

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

@ -15,12 +15,12 @@
#include <stdint.h>
class nsContentList;
class nsHTMLDocument;
class nsINode;
namespace mozilla {
namespace dom {
class Document;
class Element;
class OwningHTMLCollectionOrElement;
template <typename>
@ -32,7 +32,7 @@ class HTMLAllCollection final : public nsISupports, public nsWrapperCache {
~HTMLAllCollection();
public:
explicit HTMLAllCollection(nsHTMLDocument* aDocument);
explicit HTMLAllCollection(mozilla::dom::Document* aDocument);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(HTMLAllCollection)
@ -80,7 +80,7 @@ class HTMLAllCollection final : public nsISupports, public nsWrapperCache {
*/
Element* Item(uint32_t aIndex);
RefPtr<nsHTMLDocument> mDocument;
RefPtr<mozilla::dom::Document> mDocument;
RefPtr<nsContentList> mCollection;
nsRefPtrHashtable<nsStringHashKey, nsContentList> mNamedMap;
};

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

@ -9,7 +9,6 @@
#include "nsIContentPolicy.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/HTMLAllCollection.h"
#include "nsCommandManager.h"
#include "nsCOMPtr.h"
#include "nsGlobalWindow.h"
@ -158,10 +157,6 @@ nsHTMLDocument::nsHTMLDocument()
nsHTMLDocument::~nsHTMLDocument() {}
NS_IMPL_CYCLE_COLLECTION_INHERITED(nsHTMLDocument, Document, mAll)
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(nsHTMLDocument, Document)
JSObject* nsHTMLDocument::WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return HTMLDocument_Binding::Wrap(aCx, this, aGivenProto);
@ -780,13 +775,6 @@ bool nsHTMLDocument::MatchFormControls(Element* aElement, int32_t aNamespaceID,
return aElement->IsNodeOfType(nsIContent::eHTML_FORM_CONTROL);
}
HTMLAllCollection* nsHTMLDocument::All() {
if (!mAll) {
mAll = new HTMLAllCollection(this);
}
return mAll;
}
nsresult nsHTMLDocument::Clone(dom::NodeInfo* aNodeInfo,
nsINode** aResult) const {
NS_ASSERTION(aNodeInfo->NodeInfoManager() == mNodeInfoManager,

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

@ -27,7 +27,6 @@ class nsILoadGroup;
namespace mozilla {
namespace dom {
class HTMLAllCollection;
template <typename T>
struct Nullable;
class WindowProxyHolder;
@ -49,9 +48,6 @@ class nsHTMLDocument : public mozilla::dom::Document {
nsHTMLDocument();
virtual nsresult Init() override;
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLDocument, Document)
// Document
virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup,
@ -73,8 +69,6 @@ class nsHTMLDocument : public mozilla::dom::Document {
nsContentList* GetExistingForms() const { return mForms; }
mozilla::dom::HTMLAllCollection* All();
// Returns whether an object was found for aName.
bool ResolveName(JSContext* aCx, const nsAString& aName,
JS::MutableHandle<JS::Value> aRetval,
@ -172,8 +166,6 @@ class nsHTMLDocument : public mozilla::dom::Document {
friend class ContentListHolder;
ContentListHolder* mContentListHolder;
RefPtr<mozilla::dom::HTMLAllCollection> mAll;
/** # of forms in the document, synchronously set */
int32_t mNumForms;

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

@ -276,7 +276,7 @@ partial interface Document {
void captureEvents();
void releaseEvents();
//(HTML only)[SameObject] readonly attribute HTMLAllCollection all;
[SameObject] readonly attribute HTMLAllCollection all;
};
// https://fullscreen.spec.whatwg.org/#api

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

@ -9,8 +9,6 @@ interface HTMLDocument : Document {
// DOM tree accessors
[Throws]
getter object (DOMString name);
readonly attribute HTMLAllCollection all;
};
partial interface HTMLDocument {

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

@ -1,8 +1,5 @@
prefs: [dom.security.featurePolicy.enabled:true]
[interfaces.https.html?include=(Document|Window)]
[Document interface: attribute all]
expected: FAIL
[Document interface: attribute oncancel]
expected: FAIL
@ -30,9 +27,6 @@ prefs: [dom.security.featurePolicy.enabled:true]
[Document interface: new Document() must inherit property "onsecuritypolicyviolation" with the proper type]
expected: FAIL
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "all" with the proper type]
expected: FAIL
[Document interface: document.implementation.createDocument(null, "", null) must inherit property "oncancel" with the proper type]
expected: FAIL