2015-05-03 12:32:37 -07: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 00:38:41 -07: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-12 14:31:53 -07:00
|
|
|
#include "nsIDOMDOMImplementation.h"
|
2012-10-21 00:38:41 -07: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 10:25:00 -07:00
|
|
|
#include "nsString.h"
|
2012-10-21 00:38:41 -07:00
|
|
|
|
|
|
|
class nsIDOMDocument;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2012-12-28 17:34:02 -08:00
|
|
|
class DocumentType;
|
2012-10-21 00:38:41 -07:00
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class DOMImplementation final : public nsIDOMDOMImplementation
|
2015-03-27 11:52:19 -07:00
|
|
|
, public nsWrapperCache
|
2012-10-21 00:38:41 -07:00
|
|
|
{
|
2014-06-24 19:09:15 -07:00
|
|
|
~DOMImplementation()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-21 00:38:41 -07:00
|
|
|
public:
|
|
|
|
DOMImplementation(nsIDocument* aOwner,
|
2013-04-04 02:32:29 -07:00
|
|
|
nsIGlobalObject* aScriptObject,
|
2012-10-21 00:38:41 -07: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 09:28:04 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2012-10-21 00:38:41 -07:00
|
|
|
|
2013-03-12 14:31:53 -07:00
|
|
|
// nsIDOMDOMImplementation
|
|
|
|
NS_DECL_NSIDOMDOMIMPLEMENTATION
|
|
|
|
|
2012-10-21 00:38:41 -07:00
|
|
|
bool HasFeature(const nsAString& aFeature, const nsAString& aVersion);
|
|
|
|
|
2012-12-28 17:34:02 -08:00
|
|
|
already_AddRefed<DocumentType>
|
2012-10-21 00:38:41 -07: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 05:55:08 -07:00
|
|
|
CreateHTMLDocument(const Optional<nsAString>& aTitle, ErrorResult& aRv);
|
2012-10-21 00:38:41 -07: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
|