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-10-21 11:38:41 +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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_DOMImplementation_h
|
|
|
|
#define mozilla_dom_DOMImplementation_h
|
|
|
|
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2019-01-02 16:05:23 +03:00
|
|
|
#include "mozilla/dom/Document.h"
|
2012-10-21 11:38:41 +04:00
|
|
|
#include "nsIScriptGlobalObject.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsIWeakReferenceUtils.h"
|
2013-09-23 21:25:00 +04:00
|
|
|
#include "nsString.h"
|
2012-10-21 11:38:41 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2019-01-02 16:05:23 +03:00
|
|
|
class Document;
|
2012-12-29 05:34:02 +04:00
|
|
|
class DocumentType;
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2018-02-12 23:49:07 +03:00
|
|
|
class DOMImplementation final : public nsISupports, public nsWrapperCache {
|
2014-06-25 06:09:15 +04:00
|
|
|
~DOMImplementation() {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-10-21 11:38:41 +04:00
|
|
|
public:
|
2019-01-02 16:05:23 +03:00
|
|
|
DOMImplementation(Document* aOwner, nsIGlobalObject* aScriptObject,
|
2012-10-21 11:38:41 +04:00
|
|
|
nsIURI* aDocumentURI, nsIURI* aBaseURI)
|
|
|
|
: mOwner(aOwner),
|
|
|
|
mScriptObject(do_GetWeakReference(aScriptObject)),
|
|
|
|
mDocumentURI(aDocumentURI),
|
|
|
|
mBaseURI(aBaseURI) {
|
|
|
|
MOZ_ASSERT(aOwner);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMImplementation)
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
Document* GetParentObject() const { return mOwner; }
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2016-08-28 21:36:46 +03:00
|
|
|
bool HasFeature() { return true; }
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2012-12-29 05:34:02 +04:00
|
|
|
already_AddRefed<DocumentType> CreateDocumentType(
|
2012-10-21 11:38:41 +04:00
|
|
|
const nsAString& aQualifiedName, const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId, ErrorResult& aRv);
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
already_AddRefed<Document> CreateDocument(const nsAString& aNamespaceURI,
|
|
|
|
const nsAString& aQualifiedName,
|
|
|
|
DocumentType* aDoctype,
|
|
|
|
ErrorResult& aRv);
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
already_AddRefed<Document> CreateHTMLDocument(
|
2013-03-21 16:55:08 +04:00
|
|
|
const Optional<nsAString>& aTitle, ErrorResult& aRv);
|
2012-10-21 11:38:41 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsresult CreateDocument(const nsAString& aNamespaceURI,
|
|
|
|
const nsAString& aQualifiedName,
|
2019-01-02 16:05:23 +03:00
|
|
|
DocumentType* aDoctype, Document** aDocument);
|
|
|
|
nsresult CreateHTMLDocument(const nsAString& aTitle, Document** aDocument);
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
nsCOMPtr<Document> mOwner;
|
2012-10-21 11:38:41 +04:00
|
|
|
nsWeakPtr mScriptObject;
|
|
|
|
nsCOMPtr<nsIURI> mDocumentURI;
|
|
|
|
nsCOMPtr<nsIURI> mBaseURI;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_DOMImplementation_h
|