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
|
|
|
|
2013-03-13 01:31:53 +04:00
|
|
|
class DOMImplementation MOZ_FINAL : public nsIDOMDOMImplementation
|
2012-10-21 11:38:41 +04:00
|
|
|
, public nsWrapperCache
|
|
|
|
{
|
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;
|
|
|
|
}
|
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) MOZ_OVERRIDE;
|
2012-10-21 11:38:41 +04:00
|
|
|
|
2013-03-13 01:31:53 +04:00
|
|
|
// nsIDOMDOMImplementation
|
|
|
|
NS_DECL_NSIDOMDOMIMPLEMENTATION
|
|
|
|
|
2012-10-21 11:38:41 +04:00
|
|
|
bool HasFeature(const nsAString& aFeature, const nsAString& aVersion);
|
|
|
|
|
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
|