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
|
|
|
|
|
2013-03-13 01:31:53 +04:00
|
|
|
#include "nsIDOMDOMImplementation.h"
|
2012-10-21 11:38:41 +04:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#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
|
|
|
|
|
|
|
class nsIDOMDocument;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2012-12-29 05:34:02 +04:00
|
|
|
class DocumentType;
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class DOMImplementation final : public nsIDOMDOMImplementation
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsWrapperCache
|
2012-10-21 11:38:41 +04:00
|
|
|
{
|
2014-06-25 06:09:15 +04:00
|
|
|
~DOMImplementation()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-21 11:38:41 +04:00
|
|
|
public:
|
|
|
|
DOMImplementation(nsIDocument* aOwner,
|
2013-04-04 13:32:29 +04:00
|
|
|
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)
|
|
|
|
|
|
|
|
nsIDocument* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mOwner;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2013-03-13 01:31:53 +04:00
|
|
|
// nsIDOMDOMImplementation
|
|
|
|
NS_DECL_NSIDOMDOMIMPLEMENTATION
|
|
|
|
|
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>
|
2012-10-21 11:38:41 +04:00
|
|
|
CreateDocumentType(const nsAString& aQualifiedName,
|
|
|
|
const nsAString& aPublicId,
|
|
|
|
const nsAString& aSystemId,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<nsIDocument>
|
|
|
|
CreateDocument(const nsAString& aNamespaceURI,
|
|
|
|
const nsAString& aQualifiedName,
|
|
|
|
nsIDOMDocumentType* aDoctype,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
|
|
|
already_AddRefed<nsIDocument>
|
2013-03-21 16:55:08 +04:00
|
|
|
CreateHTMLDocument(const Optional<nsAString>& aTitle, ErrorResult& aRv);
|
2012-10-21 11:38:41 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsresult CreateDocument(const nsAString& aNamespaceURI,
|
|
|
|
const nsAString& aQualifiedName,
|
|
|
|
nsIDOMDocumentType* aDoctype,
|
|
|
|
nsIDocument** aDocument,
|
|
|
|
nsIDOMDocument** aDOMDocument);
|
|
|
|
nsresult CreateHTMLDocument(const nsAString& aTitle,
|
|
|
|
nsIDocument** aDocument,
|
|
|
|
nsIDOMDocument** aDOMDocument);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocument> mOwner;
|
|
|
|
nsWeakPtr mScriptObject;
|
|
|
|
nsCOMPtr<nsIURI> mDocumentURI;
|
|
|
|
nsCOMPtr<nsIURI> mBaseURI;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_DOMImplementation_h
|