Bug 1778211 - Reject xpidl CDATA containing 'virtual', r=xpcom-reviewers,necko-reviewers,mccr8,dragana
We'll probably want to do something more accurate in the future with a custom clang static analysis pass which validates that XPIDL interfaces have the expected vtable and struct layout, however doing so would be more involved than the string matching done in this patch. In addition to checking for extra virtual methods, we'll likely also want to check for data members on interfaces, and reject them unless the class is marked as `[builtinclass]` in addition to some other attribute which we'll need to add to prevent them from being implemented in Rust (as c++ data members will not be reflected by the rust macro). There were 2 instances of a comment which contained the word 'virtual' within a CDATA block. These comments were moved out of the CDATA block to avoid triggering the error. Differential Revision: https://phabricator.services.mozilla.com/D151068
This commit is contained in:
@@ -22,6 +22,9 @@ class LocalAccessible;
|
||||
}
|
||||
%}
|
||||
|
||||
[ptr] native InternalAccessible(mozilla::a11y::Accessible);
|
||||
[ptr] native InternalLocalAccessible(mozilla::a11y::LocalAccessible);
|
||||
|
||||
/**
|
||||
* A cross-platform interface that supports platform-specific
|
||||
* accessibility APIs like MSAA and ATK. Contains the sum of what's needed
|
||||
@@ -342,10 +345,8 @@ interface nsIAccessible : nsISupports
|
||||
*/
|
||||
void announce(in AString announcement, in unsigned short priority);
|
||||
|
||||
%{C++
|
||||
virtual mozilla::a11y::LocalAccessible* ToInternalAccessible() const = 0;
|
||||
virtual mozilla::a11y::Accessible* ToInternalGeneric() const = 0;
|
||||
%}
|
||||
[notxpcom, nostdcall] InternalLocalAccessible toInternalAccessible();
|
||||
[notxpcom, nostdcall] InternalAccessible toInternalGeneric();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
#define NS_ACCESSIBLE_MAC_EVENT_TOPIC "accessible-mac-event"
|
||||
%}
|
||||
|
||||
native NativeObjectId(id);
|
||||
|
||||
/**
|
||||
* A generic NSISupports wrapper for native NSObjects.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(4582bb77-de03-4ed1-a9b4-d482d97c0129)]
|
||||
interface nsIAccessibleMacNSObjectWrapper : nsISupports
|
||||
{
|
||||
%{C++
|
||||
virtual id GetNativeObject() const = 0;
|
||||
%}
|
||||
[noscript, notxpcom, nostdcall] NativeObjectId GetNativeObject();
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(9d27cf21-66fc-47dc-8a07-98edb18707b1)]
|
||||
|
||||
@@ -51,7 +51,7 @@ xpcAccessibleGeneric::~xpcAccessibleGeneric() {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessible
|
||||
|
||||
LocalAccessible* xpcAccessibleGeneric::ToInternalAccessible() const {
|
||||
LocalAccessible* xpcAccessibleGeneric::ToInternalAccessible() {
|
||||
return mIntl->AsLocal();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ class xpcAccessibleGeneric : public xpcAccessible,
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIAccessible
|
||||
LocalAccessible* ToInternalAccessible() const final;
|
||||
Accessible* ToInternalGeneric() const final { return mIntl; }
|
||||
LocalAccessible* ToInternalAccessible() final;
|
||||
Accessible* ToInternalGeneric() final { return mIntl; }
|
||||
|
||||
// xpcAccessibleGeneric
|
||||
virtual void Shutdown();
|
||||
|
||||
@@ -20,10 +20,7 @@ class xpcAccessibleMacNSObjectWrapper : public nsIAccessibleMacNSObjectWrapper {
|
||||
explicit xpcAccessibleMacNSObjectWrapper(id aTextMarker);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLEMACNSOBJECTWRAPPER;
|
||||
|
||||
// Get the wrapped NSObject for this interface.
|
||||
id GetNativeObject() const final;
|
||||
NS_DECL_NSIACCESSIBLEMACNSOBJECTWRAPPER
|
||||
|
||||
protected:
|
||||
virtual ~xpcAccessibleMacNSObjectWrapper();
|
||||
|
||||
@@ -33,7 +33,7 @@ xpcAccessibleMacNSObjectWrapper::xpcAccessibleMacNSObjectWrapper(id aNativeObj)
|
||||
|
||||
xpcAccessibleMacNSObjectWrapper::~xpcAccessibleMacNSObjectWrapper() { [mNativeObject release]; }
|
||||
|
||||
id xpcAccessibleMacNSObjectWrapper::GetNativeObject() const { return mNativeObject; }
|
||||
id xpcAccessibleMacNSObjectWrapper::GetNativeObject() { return mNativeObject; }
|
||||
|
||||
// xpcAccessibleMacInterface
|
||||
|
||||
|
||||
@@ -3546,6 +3546,6 @@ nsNodeWeakReference::QueryReferentFromScript(const nsIID& aIID,
|
||||
}
|
||||
|
||||
size_t nsNodeWeakReference::SizeOfOnlyThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,6 @@ class nsNodeWeakReference final : public nsIWeakReference {
|
||||
|
||||
// nsIWeakReference
|
||||
NS_DECL_NSIWEAKREFERENCE
|
||||
size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
void NoticeNodeDestruction() { mObject = nullptr; }
|
||||
|
||||
|
||||
@@ -618,6 +618,12 @@ WebrtcTCPSocket::OnUpgradeFailed(nsresult aErrorCode) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebrtcTCPSocket::OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// nsIRequestObserver (from nsIStreamListener)
|
||||
NS_IMETHODIMP
|
||||
WebrtcTCPSocket::OnStartRequest(nsIRequest* aRequest) {
|
||||
|
||||
@@ -58,11 +58,6 @@ class WebrtcTCPSocket : public nsIHttpUpgradeListener,
|
||||
|
||||
size_t CountUnwrittenBytes() const;
|
||||
|
||||
nsresult OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~WebrtcTCPSocket();
|
||||
|
||||
|
||||
@@ -90,11 +90,14 @@ DynamicImage::GetHeight(int32_t* aHeight) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult DynamicImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const {
|
||||
void DynamicImage::MediaFeatureValuesChangedAllDocuments(
|
||||
const mozilla::MediaFeatureChange& aChange) {}
|
||||
|
||||
nsresult DynamicImage::GetNativeSizes(nsTArray<IntSize>&) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
size_t DynamicImage::GetNativeSizesLength() const { return 0; }
|
||||
size_t DynamicImage::GetNativeSizesLength() { return 0; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
DynamicImage::GetIntrinsicSize(nsSize* aSize) {
|
||||
|
||||
@@ -28,8 +28,6 @@ class DynamicImage : public Image {
|
||||
}
|
||||
|
||||
// Inherited methods from Image.
|
||||
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
|
||||
size_t GetNativeSizesLength() const override;
|
||||
virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
|
||||
virtual size_t SizeOfSourceWithComputedFallback(
|
||||
SizeOfState& aState) const override;
|
||||
|
||||
@@ -103,11 +103,14 @@ ImageWrapper::GetHeight(int32_t* aHeight) {
|
||||
return mInnerImage->GetHeight(aHeight);
|
||||
}
|
||||
|
||||
nsresult ImageWrapper::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const {
|
||||
void ImageWrapper::MediaFeatureValuesChangedAllDocuments(
|
||||
const mozilla::MediaFeatureChange& aChange) {}
|
||||
|
||||
nsresult ImageWrapper::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) {
|
||||
return mInnerImage->GetNativeSizes(aNativeSizes);
|
||||
}
|
||||
|
||||
size_t ImageWrapper::GetNativeSizesLength() const {
|
||||
size_t ImageWrapper::GetNativeSizesLength() {
|
||||
return mInnerImage->GetNativeSizesLength();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,6 @@ class ImageWrapper : public Image {
|
||||
NS_DECL_IMGICONTAINER
|
||||
|
||||
// Inherited methods from Image.
|
||||
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
|
||||
size_t GetNativeSizesLength() const override;
|
||||
virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
|
||||
|
||||
virtual size_t SizeOfSourceWithComputedFallback(
|
||||
|
||||
@@ -42,7 +42,7 @@ OrientedImage::GetHeight(int32_t* aHeight) {
|
||||
}
|
||||
}
|
||||
|
||||
nsresult OrientedImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const {
|
||||
nsresult OrientedImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) {
|
||||
nsresult rv = InnerImage()->GetNativeSizes(aNativeSizes);
|
||||
|
||||
if (mOrientation.SwapsWidthAndHeight()) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class OrientedImage : public ImageWrapper {
|
||||
|
||||
NS_IMETHOD GetWidth(int32_t* aWidth) override;
|
||||
NS_IMETHOD GetHeight(int32_t* aHeight) override;
|
||||
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
|
||||
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) override;
|
||||
NS_IMETHOD GetIntrinsicSize(nsSize* aSize) override;
|
||||
Maybe<AspectRatio> GetIntrinsicRatio() override;
|
||||
NS_IMETHOD_(already_AddRefed<SourceSurface>)
|
||||
|
||||
@@ -205,7 +205,11 @@ RasterImage::GetHeight(int32_t* aHeight) {
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
nsresult RasterImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const {
|
||||
void RasterImage::MediaFeatureValuesChangedAllDocuments(
|
||||
const mozilla::MediaFeatureChange& aChange) {}
|
||||
|
||||
//******************************************************************************
|
||||
nsresult RasterImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) {
|
||||
if (mError) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@@ -224,7 +228,7 @@ nsresult RasterImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const {
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
size_t RasterImage::GetNativeSizesLength() const {
|
||||
size_t RasterImage::GetNativeSizesLength() {
|
||||
if (mError || !LoadHasSize()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -156,8 +156,6 @@ class RasterImage final : public ImageResource,
|
||||
NS_DECL_IMGICONTAINERDEBUG
|
||||
#endif
|
||||
|
||||
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
|
||||
size_t GetNativeSizesLength() const override;
|
||||
virtual nsresult StartAnimation() override;
|
||||
virtual nsresult StopAnimation() override;
|
||||
|
||||
|
||||
@@ -465,12 +465,12 @@ VectorImage::GetWidth(int32_t* aWidth) {
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
nsresult VectorImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) const {
|
||||
nsresult VectorImage::GetNativeSizes(nsTArray<IntSize>& aNativeSizes) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//******************************************************************************
|
||||
size_t VectorImage::GetNativeSizesLength() const { return 0; }
|
||||
size_t VectorImage::GetNativeSizesLength() { return 0; }
|
||||
|
||||
//******************************************************************************
|
||||
NS_IMETHODIMP_(void)
|
||||
|
||||
@@ -36,9 +36,6 @@ class VectorImage final : public ImageResource, public nsIStreamListener {
|
||||
// (no public constructor - use ImageFactory)
|
||||
|
||||
// Methods inherited from Image
|
||||
void MediaFeatureValuesChangedAllDocuments(const MediaFeatureChange&) final;
|
||||
nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
|
||||
size_t GetNativeSizesLength() const override;
|
||||
virtual size_t SizeOfSourceWithComputedFallback(
|
||||
SizeOfState& aState) const override;
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ native ImageResolution(mozilla::image::Resolution);
|
||||
native TempRefSourceSurface(already_AddRefed<mozilla::gfx::SourceSurface>);
|
||||
native TempRefImgIContainer(already_AddRefed<imgIContainer>);
|
||||
native nsIntSizeByVal(nsIntSize);
|
||||
[ref] native MediaFeatureChange(mozilla::MediaFeatureChange);
|
||||
|
||||
|
||||
/**
|
||||
@@ -674,20 +675,18 @@ interface imgIContainer : nsISupports
|
||||
*/
|
||||
[noscript, notxpcom] void propagateUseCounters(in Document aReferencingDocument);
|
||||
|
||||
%{C++
|
||||
/*
|
||||
* Called when media feature values that apply to all documents (such as
|
||||
* those based on system metrics) have changed. If this image is a type
|
||||
* that can respond to media queries (i.e., an SVG image), this function
|
||||
* is overridden to handle restyling and invalidating the image.
|
||||
*/
|
||||
virtual void MediaFeatureValuesChangedAllDocuments(const mozilla::MediaFeatureChange& aChange) {}
|
||||
[notxpcom, nostdcall] void mediaFeatureValuesChangedAllDocuments([const] in MediaFeatureChange aChange);
|
||||
|
||||
/*
|
||||
* Get the set of sizes the image can decode to natively.
|
||||
*/
|
||||
virtual nsresult GetNativeSizes(nsTArray<nsIntSize>& aNativeSizes) const = 0;
|
||||
[nostdcall] Array<nsIntSizeByVal> getNativeSizes();
|
||||
|
||||
virtual size_t GetNativeSizesLength() const = 0;
|
||||
%}
|
||||
[nostdcall, notxpcom] size_t getNativeSizesLength();
|
||||
};
|
||||
|
||||
@@ -142,14 +142,6 @@ class ImageDecoderListener final : public nsIStreamListener,
|
||||
// imgIContainer
|
||||
NS_FORWARD_IMGICONTAINER(mImage->)
|
||||
|
||||
nsresult GetNativeSizes(nsTArray<nsIntSize>& aNativeSizes) const override {
|
||||
return mImage->GetNativeSizes(aNativeSizes);
|
||||
}
|
||||
|
||||
size_t GetNativeSizesLength() const override {
|
||||
return mImage->GetNativeSizesLength();
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~ImageDecoderListener() = default;
|
||||
|
||||
|
||||
@@ -28,7 +28,11 @@ class FileDescriptor;
|
||||
|
||||
%}
|
||||
|
||||
[scriptable, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
|
||||
[ptr] native ContentParent(mozilla::dom::ContentParent);
|
||||
[ref] native FileDescriptor(mozilla::ipc::FileDescriptor);
|
||||
native MallocSizeOf(mozilla::MallocSizeOf);
|
||||
|
||||
[scriptable, builtinclass, uuid(D85A17C2-AA7C-11d2-9B8C-00805F8A16D9)]
|
||||
interface nsIStringBundle : nsISupports
|
||||
{
|
||||
AString GetStringFromID(in long aID);
|
||||
@@ -67,13 +71,11 @@ interface nsIStringBundle : nsISupports
|
||||
// Preloads string bundle data asynchronously
|
||||
void asyncPreload();
|
||||
|
||||
%{C++
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
||||
virtual size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
||||
%}
|
||||
[notxpcom, nostdcall] size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||
[notxpcom, nostdcall] size_t SizeOfIncludingThisIfUnshared(in MallocSizeOf aMallocSizeOf);
|
||||
};
|
||||
|
||||
[scriptable, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)]
|
||||
[scriptable, builtinclass, uuid(D85A17C0-AA7C-11d2-9B8C-00805F8A16D9)]
|
||||
interface nsIStringBundleService : nsISupports
|
||||
{
|
||||
nsIStringBundle createBundle(in string aURLSpec);
|
||||
@@ -99,13 +101,11 @@ interface nsIStringBundleService : nsISupports
|
||||
*/
|
||||
void flushBundles();
|
||||
|
||||
%{C++
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
||||
[notxpcom, nostdcall] size_t sizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||
|
||||
virtual void SendContentBundles(mozilla::dom::ContentParent* aContentParent) const = 0;
|
||||
[notxpcom, nostdcall] void sendContentBundles(in ContentParent aContentParent);
|
||||
|
||||
virtual void RegisterContentBundle(const nsCString& aBundleURL,
|
||||
const mozilla::ipc::FileDescriptor& aMapFile,
|
||||
size_t aMapSize) = 0;
|
||||
%}
|
||||
[notxpcom, nostdcall] void registerContentBundle(in ACString aBundleURL,
|
||||
[const] in FileDescriptor aMapFile,
|
||||
in size_t aMapSize);
|
||||
};
|
||||
|
||||
@@ -117,20 +117,48 @@ class StringBundleProxy : public nsIStringBundle {
|
||||
explicit StringBundleProxy(already_AddRefed<nsIStringBundle> aTarget)
|
||||
: mMutex("StringBundleProxy::mMutex"), mTarget(aTarget) {}
|
||||
|
||||
NS_FORWARD_NSISTRINGBUNDLE(Target()->);
|
||||
|
||||
void Retarget(nsIStringBundle* aTarget) {
|
||||
MutexAutoLock automon(mMutex);
|
||||
mTarget = aTarget;
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override {
|
||||
// Forward nsIStringBundle methods (other than the `SizeOf*` methods) to
|
||||
// `Target()`.
|
||||
NS_IMETHOD GetStringFromID(int32_t aID, nsAString& _retval) override {
|
||||
return Target()->GetStringFromID(aID, _retval);
|
||||
}
|
||||
NS_IMETHOD GetStringFromAUTF8Name(const nsACString& aName,
|
||||
nsAString& _retval) override {
|
||||
return Target()->GetStringFromAUTF8Name(aName, _retval);
|
||||
}
|
||||
NS_IMETHOD GetStringFromName(const char* aName, nsAString& _retval) override {
|
||||
return Target()->GetStringFromName(aName, _retval);
|
||||
}
|
||||
NS_IMETHOD FormatStringFromID(int32_t aID, const nsTArray<nsString>& params,
|
||||
nsAString& _retval) override {
|
||||
return Target()->FormatStringFromID(aID, params, _retval);
|
||||
}
|
||||
NS_IMETHOD FormatStringFromAUTF8Name(const nsACString& aName,
|
||||
const nsTArray<nsString>& params,
|
||||
nsAString& _retval) override {
|
||||
return Target()->FormatStringFromAUTF8Name(aName, params, _retval);
|
||||
}
|
||||
NS_IMETHOD FormatStringFromName(const char* aName,
|
||||
const nsTArray<nsString>& params,
|
||||
nsAString& _retval) override {
|
||||
return Target()->FormatStringFromName(aName, params, _retval);
|
||||
}
|
||||
NS_IMETHOD GetSimpleEnumeration(nsISimpleEnumerator** _retval) override {
|
||||
return Target()->GetSimpleEnumeration(_retval);
|
||||
}
|
||||
NS_IMETHOD AsyncPreload() override { return Target()->AsyncPreload(); }
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) override {
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThisIfUnshared(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) override {
|
||||
return mRefCnt == 1 ? SizeOfIncludingThis(aMallocSizeOf) : 0;
|
||||
}
|
||||
|
||||
@@ -220,8 +248,7 @@ class SharedStringBundle final : public nsStringBundleBase {
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
size_t SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) override;
|
||||
|
||||
static SharedStringBundle* Cast(nsIStringBundle* aStringBundle) {
|
||||
return static_cast<SharedStringBundle*>(aStringBundle);
|
||||
@@ -322,7 +349,7 @@ nsStringBundleBase::AsyncPreload() {
|
||||
}
|
||||
|
||||
size_t nsStringBundle::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
size_t n = 0;
|
||||
if (mProps) {
|
||||
n += mProps->SizeOfIncludingThis(aMallocSizeOf);
|
||||
@@ -330,8 +357,13 @@ size_t nsStringBundle::SizeOfIncludingThis(
|
||||
return aMallocSizeOf(this) + n;
|
||||
}
|
||||
|
||||
size_t nsStringBundleBase::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t nsStringBundleBase::SizeOfIncludingThisIfUnshared(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
if (mRefCnt == 1) {
|
||||
return SizeOfIncludingThis(aMallocSizeOf);
|
||||
} else {
|
||||
@@ -340,7 +372,7 @@ size_t nsStringBundleBase::SizeOfIncludingThisIfUnshared(
|
||||
}
|
||||
|
||||
size_t SharedStringBundle::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
size_t n = 0;
|
||||
if (mStringMap) {
|
||||
n += aMallocSizeOf(mStringMap);
|
||||
@@ -733,7 +765,7 @@ nsresult nsStringBundleService::Init() {
|
||||
}
|
||||
|
||||
size_t nsStringBundleService::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
size_t n = mBundleMap.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
for (const auto& data : mBundleMap.Values()) {
|
||||
n += aMallocSizeOf(data);
|
||||
@@ -779,8 +811,7 @@ nsStringBundleService::FlushBundles() {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsStringBundleService::SendContentBundles(
|
||||
ContentParent* aContentParent) const {
|
||||
void nsStringBundleService::SendContentBundles(ContentParent* aContentParent) {
|
||||
nsTArray<StringBundleDescriptor> bundles;
|
||||
|
||||
for (auto* entry : mSharedBundles) {
|
||||
@@ -795,7 +826,7 @@ void nsStringBundleService::SendContentBundles(
|
||||
}
|
||||
|
||||
void nsStringBundleService::RegisterContentBundle(
|
||||
const nsCString& aBundleURL, const FileDescriptor& aMapFile,
|
||||
const nsACString& aBundleURL, const FileDescriptor& aMapFile,
|
||||
size_t aMapSize) {
|
||||
RefPtr<StringBundleProxy> proxy;
|
||||
|
||||
@@ -812,7 +843,8 @@ void nsStringBundleService::RegisterContentBundle(
|
||||
delete cacheEntry;
|
||||
}
|
||||
|
||||
auto bundle = MakeBundleRefPtr<SharedStringBundle>(aBundleURL.get());
|
||||
auto bundle = MakeBundleRefPtr<SharedStringBundle>(
|
||||
PromiseFlatCString(aBundleURL).get());
|
||||
bundle->SetMapFile(aMapFile, aMapSize);
|
||||
|
||||
if (proxy) {
|
||||
|
||||
@@ -57,9 +57,6 @@ class nsStringBundleBase : public nsIStringBundle, public nsIMemoryReporter {
|
||||
bool mAttemptedLoad;
|
||||
bool mLoaded;
|
||||
|
||||
size_t SizeOfIncludingThisIfUnshared(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
public:
|
||||
static nsresult FormatString(const char16_t* formatStr,
|
||||
const nsTArray<nsString>& aParams,
|
||||
@@ -74,8 +71,7 @@ class nsStringBundle : public nsStringBundleBase {
|
||||
|
||||
nsresult LoadProperties() override;
|
||||
|
||||
size_t SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) override;
|
||||
|
||||
protected:
|
||||
friend class nsStringBundleBase;
|
||||
|
||||
@@ -45,16 +45,6 @@ class nsStringBundleService : public nsIStringBundleService,
|
||||
return NS_OK;
|
||||
};
|
||||
|
||||
size_t SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
void SendContentBundles(
|
||||
mozilla::dom::ContentParent* aContentParent) const override;
|
||||
|
||||
void RegisterContentBundle(const nsCString& aBundleURL,
|
||||
const mozilla::ipc::FileDescriptor& aMapFile,
|
||||
size_t aMapSize) override;
|
||||
|
||||
private:
|
||||
virtual ~nsStringBundleService();
|
||||
|
||||
|
||||
@@ -796,5 +796,8 @@ ClassifierDummyChannel::SetEarlyHintObserver(nsIEarlyHintObserver* aObserver) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void ClassifierDummyChannel::SetConnectionInfo(
|
||||
mozilla::net::nsHttpConnectionInfo* aInfo) {}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -280,6 +280,9 @@ NullHttpChannel::GetEncodedBodySize(uint64_t* aEncodedBodySize) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void NullHttpChannel::SetSource(
|
||||
mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource) {}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// NullHttpChannel::nsIChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -12,6 +12,8 @@ interface nsIReferrerInfo;
|
||||
#include "GeckoProfiler.h"
|
||||
%}
|
||||
|
||||
native UniqueProfileChunkedBuffer(mozilla::UniquePtr<mozilla::ProfileChunkedBuffer>);
|
||||
|
||||
/**
|
||||
* nsIHttpChannel
|
||||
*
|
||||
@@ -489,7 +491,5 @@ interface nsIHttpChannel : nsIIdentChannel
|
||||
in AString aURL,
|
||||
in AString aContentType);
|
||||
|
||||
%{ C++
|
||||
virtual void SetSource(mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource) {}
|
||||
%}
|
||||
[notxpcom, nostdcall] void setSource(in UniqueProfileChunkedBuffer aSource);
|
||||
};
|
||||
|
||||
@@ -21,9 +21,11 @@ enum class RequestMode : uint8_t;
|
||||
}
|
||||
}
|
||||
%}
|
||||
[ptr] native nsHttpConnectionInfo(mozilla::net::nsHttpConnectionInfo);
|
||||
[ptr] native StringArray(nsTArray<nsCString>);
|
||||
[ref] native CStringArrayRef(const nsTArray<nsCString>);
|
||||
[ref] native securityMessagesArray(nsCOMArray<nsISecurityConsoleMessage>);
|
||||
[ptr] native WebSocketConnectionBase(mozilla::net::WebSocketConnectionBase);
|
||||
|
||||
native TimeStamp(mozilla::TimeStamp);
|
||||
native RequestMode(mozilla::dom::RequestMode);
|
||||
@@ -50,9 +52,7 @@ interface nsIHttpUpgradeListener : nsISupports
|
||||
|
||||
[must_use] void onUpgradeFailed(in nsresult aErrorCode);
|
||||
|
||||
%{C++
|
||||
virtual nsresult OnWebSocketConnectionAvailable(mozilla::net::WebSocketConnectionBase* aConnection) = 0;
|
||||
%}
|
||||
void onWebSocketConnectionAvailable(in WebSocketConnectionBase aConnection);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -468,8 +468,6 @@ interface nsIHttpChannelInternal : nsISupports
|
||||
*/
|
||||
[must_use] void setEarlyHintObserver(in nsIEarlyHintObserver aObserver);
|
||||
|
||||
%{ C++
|
||||
virtual void SetConnectionInfo(mozilla::net::nsHttpConnectionInfo* aInfo) {}
|
||||
%}
|
||||
[notxpcom, nostdcall] void setConnectionInfo(in nsHttpConnectionInfo aInfo);
|
||||
|
||||
};
|
||||
|
||||
@@ -1054,6 +1054,11 @@ nsViewSourceChannel::LogMimeTypeMismatch(const nsACString& aMessageName,
|
||||
aContentType);
|
||||
}
|
||||
|
||||
// FIXME: Should this forward to mHttpChannel? This was previously handled by a
|
||||
// default empty implementation.
|
||||
void nsViewSourceChannel::SetSource(
|
||||
mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aSource) {}
|
||||
|
||||
const nsTArray<mozilla::net::PreferredAlternativeDataTypeParams>&
|
||||
nsViewSourceChannel::PreferredAlternativeDataTypes() {
|
||||
if (mCacheInfoChannel) {
|
||||
@@ -1080,6 +1085,11 @@ void nsViewSourceChannel::DoDiagnosticAssertWhenOnStopNotCalledOnDestroy() {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Should this forward to mHttpChannelInternal? This was previously
|
||||
// handled by a default empty implementation.
|
||||
void nsViewSourceChannel::SetConnectionInfo(
|
||||
mozilla::net::nsHttpConnectionInfo* aInfo) {}
|
||||
|
||||
// nsIChildChannel methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/net/IPCTransportProvider.h"
|
||||
|
||||
#include "IPCTransportProvider.h"
|
||||
#include "nsISocketTransport.h"
|
||||
#include "nsIAsyncInputStream.h"
|
||||
#include "nsIAsyncOutputStream.h"
|
||||
@@ -51,6 +52,12 @@ TransportProviderParent::OnTransportAvailable(
|
||||
NS_IMETHODIMP
|
||||
TransportProviderParent::OnUpgradeFailed(nsresult aErrorCode) { return NS_OK; }
|
||||
|
||||
NS_IMETHODIMP
|
||||
TransportProviderParent::OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void TransportProviderParent::MaybeNotify() {
|
||||
if (!mListener || !mTransport) {
|
||||
return;
|
||||
|
||||
@@ -58,11 +58,7 @@ class TransportProviderParent final : public PTransportProviderParent,
|
||||
NS_DECL_NSITRANSPORTPROVIDER
|
||||
NS_DECL_NSIHTTPUPGRADELISTENER
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override{};
|
||||
nsresult OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override {}
|
||||
|
||||
private:
|
||||
~TransportProviderParent() = default;
|
||||
|
||||
@@ -3719,7 +3719,8 @@ WebSocketChannel::OnTransportAvailable(nsISocketTransport* aTransport,
|
||||
return OnTransportAvailableInternal();
|
||||
}
|
||||
|
||||
nsresult WebSocketChannel::OnWebSocketConnectionAvailable(
|
||||
NS_IMETHODIMP
|
||||
WebSocketChannel::OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) {
|
||||
if (!NS_IsMainThread()) {
|
||||
RefPtr<WebSocketChannel> self = this;
|
||||
|
||||
@@ -118,8 +118,6 @@ class WebSocketChannel : public BaseWebSocketChannel,
|
||||
bool IsEncrypted() const override;
|
||||
|
||||
nsresult OnTransportAvailableInternal();
|
||||
nsresult OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) override;
|
||||
void OnError(nsresult aStatus) override;
|
||||
void OnTCPClosed() override;
|
||||
nsresult OnDataReceived(uint8_t* aData, uint32_t aCount) override;
|
||||
|
||||
@@ -118,6 +118,12 @@ WebSocketConnectionChild::OnUpgradeFailed(nsresult aReason) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WebSocketConnectionChild::OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult WebSocketConnectionChild::RecvWriteOutputData(
|
||||
nsTArray<uint8_t>&& aData) {
|
||||
LOG(("WebSocketConnectionChild::RecvWriteOutputData %p\n", this));
|
||||
|
||||
@@ -37,11 +37,6 @@ class WebSocketConnectionChild final : public PWebSocketConnectionChild,
|
||||
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
nsresult OnWebSocketConnectionAvailable(
|
||||
WebSocketConnectionBase* aConnection) override {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
void OnError(nsresult aStatus) override;
|
||||
void OnTCPClosed() override;
|
||||
nsresult OnDataReceived(uint8_t* aData, uint32_t aCount) override;
|
||||
|
||||
@@ -255,7 +255,6 @@ interface mozIStorageStatement : mozIStorageBaseStatement {
|
||||
[noscript] void getSharedString(in unsigned long aIndex, out unsigned long aByteLength, [shared,retval] out wstring aResult);
|
||||
[noscript] void getSharedBlob(in unsigned long aIndex, out unsigned long aByteLength, [shared,retval] out octetPtr aResult);
|
||||
|
||||
%{C++
|
||||
/**
|
||||
* Getters for native code that return their values as
|
||||
* the return type, for convenience and sanity.
|
||||
@@ -263,6 +262,7 @@ interface mozIStorageStatement : mozIStorageBaseStatement {
|
||||
* Not virtual; no vtable bloat.
|
||||
*/
|
||||
|
||||
%{C++
|
||||
inline int32_t AsInt32(uint32_t idx) {
|
||||
int32_t v = 0;
|
||||
mozilla::DebugOnly<nsresult> rv = GetInt32(idx, &v);
|
||||
|
||||
@@ -82,7 +82,6 @@ interface mozIStorageValueArray : nsISupports {
|
||||
[noscript] void getSharedString(in unsigned long aIndex, out unsigned long aByteLength, [shared,retval] out wstring aResult);
|
||||
[noscript] void getSharedBlob(in unsigned long aIndex, out unsigned long aByteLength, [shared,retval] out octetPtr aResult);
|
||||
|
||||
%{C++
|
||||
/**
|
||||
* Getters for native code that return their values as
|
||||
* the return type, for convenience and sanity.
|
||||
@@ -90,6 +89,7 @@ interface mozIStorageValueArray : nsISupports {
|
||||
* Not virtual; no vtable bloat.
|
||||
*/
|
||||
|
||||
%{C++
|
||||
inline int32_t AsInt32(uint32_t idx) {
|
||||
int32_t v = 0;
|
||||
mozilla::DebugOnly<nsresult> rv = GetInt32(idx, &v);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
[ref] native nsCString(const nsCString);
|
||||
[ref] native StringArrayRef(const nsTArray<nsCString>);
|
||||
native ProfileDataBufferMozPromise(RefPtr<mozilla::MozPromise<FallibleTArray<uint8_t>, nsresult, true>>);
|
||||
|
||||
/**
|
||||
* Start-up parameters for subprocesses are passed through nsIObserverService,
|
||||
@@ -203,7 +204,5 @@ interface nsIProfiler : nsISupports
|
||||
[implicit_jscontext]
|
||||
Promise getSymbolTable(in ACString aDebugPath, in ACString aBreakpadID);
|
||||
|
||||
%{C++
|
||||
virtual RefPtr<mozilla::MozPromise<FallibleTArray<uint8_t>, nsresult, true>> GetProfileDataAsGzippedArrayBufferAndroid(double aSinceTime) = 0;
|
||||
%}
|
||||
[notxpcom, nostdcall] ProfileDataBufferMozPromise getProfileDataAsGzippedArrayBufferAndroid(in double aSinceTime);
|
||||
};
|
||||
|
||||
@@ -60,9 +60,6 @@ class nsProfiler final : public nsIProfiler {
|
||||
RefPtr<SymbolTablePromise> GetSymbolTableMozPromise(
|
||||
const nsACString& aDebugPath, const nsACString& aBreakpadID);
|
||||
|
||||
RefPtr<nsProfiler::GatheringPromiseAndroid>
|
||||
GetProfileDataAsGzippedArrayBufferAndroid(double aSinceTime) override;
|
||||
|
||||
struct ExitProfile {
|
||||
nsCString mJSON;
|
||||
uint64_t mBufferPositionAtGatherTime;
|
||||
|
||||
@@ -19,6 +19,7 @@ struct PrintSettingsInitializer;
|
||||
*/
|
||||
native nsNativeIntMargin(nsIntMargin);
|
||||
[ref] native nsNativeIntMarginRef(nsIntMargin);
|
||||
native PrintSettingsInitializer(mozilla::PrintSettingsInitializer);
|
||||
|
||||
interface nsIOutputStream;
|
||||
|
||||
@@ -362,12 +363,12 @@ interface nsIPrintSettings : nsISupports
|
||||
*/
|
||||
attribute Array<long> pageRanges;
|
||||
|
||||
%{C++
|
||||
/**
|
||||
* Get a PrintSettingsInitializer populated with the relevant current settings.
|
||||
*/
|
||||
virtual mozilla::PrintSettingsInitializer GetSettingsInitializer() = 0;
|
||||
[notxpcom, nostdcall] PrintSettingsInitializer getSettingsInitializer();
|
||||
|
||||
%{C++
|
||||
static bool IsPageSkipped(int32_t aPageNum, const nsTArray<int32_t>& aRanges);
|
||||
%}
|
||||
};
|
||||
|
||||
@@ -69,8 +69,6 @@ class nsPrintSettings : public nsIPrintSettings {
|
||||
*/
|
||||
virtual void InitWithInitializer(const PrintSettingsInitializer& aSettings);
|
||||
|
||||
PrintSettingsInitializer GetSettingsInitializer() final;
|
||||
|
||||
nsPrintSettings& operator=(const nsPrintSettings& rhs);
|
||||
|
||||
// Sets a default file name for the print settings.
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
%}
|
||||
|
||||
native MallocSizeOf(mozilla::MallocSizeOf);
|
||||
|
||||
/**
|
||||
* An instance of |nsIWeakReference| is a proxy object that cooperates with
|
||||
* its referent to give clients a non-owning, non-dangling reference. Clients
|
||||
@@ -45,7 +47,7 @@
|
||||
* @see nsWeakReference
|
||||
* @see nsWeakPtr
|
||||
*/
|
||||
[scriptable, uuid(9188bc85-f92e-11d2-81ef-0060083a0bcf)]
|
||||
[scriptable, builtinclass, uuid(9188bc85-f92e-11d2-81ef-0060083a0bcf)]
|
||||
interface nsIWeakReference : nsISupports
|
||||
{
|
||||
/**
|
||||
@@ -57,9 +59,8 @@ interface nsIWeakReference : nsISupports
|
||||
[binaryname(QueryReferentFromScript)]
|
||||
void QueryReferent( in nsIIDRef uuid, [iid_is(uuid), retval] out nsQIResult result );
|
||||
|
||||
[notxpcom, nostdcall] size_t sizeOfOnlyThis(in MallocSizeOf aMallocSizeOf);
|
||||
%{C++
|
||||
virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the referring object is alive. Otherwise, false.
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,6 @@ class nsWeakReference final : public nsIWeakReference {
|
||||
|
||||
// nsIWeakReference...
|
||||
NS_DECL_NSIWEAKREFERENCE
|
||||
size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
private:
|
||||
friend class nsSupportsWeakReference;
|
||||
@@ -147,8 +146,7 @@ nsresult nsIWeakReference::QueryReferent(const nsIID& aIID,
|
||||
return mObject->QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
size_t nsWeakReference::SizeOfOnlyThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
size_t nsWeakReference::SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ typedef long long int64_t ;
|
||||
typedef unsigned long nsrefcnt ;
|
||||
typedef unsigned long nsresult ;
|
||||
|
||||
// XXX need this built into xpidl compiler so that it's really size_t or size_t
|
||||
// and it's scriptable:
|
||||
typedef unsigned long size_t;
|
||||
// If we ever want to use `size_t` in scriptable interfaces, this will need to
|
||||
// be built into the xpidl compiler, as the size varies based on platform.
|
||||
native size_t(size_t);
|
||||
|
||||
[ptr] native voidPtr(void);
|
||||
[ptr] native charPtr(char);
|
||||
|
||||
@@ -13,13 +13,15 @@ interface nsISimpleEnumerator;
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
%}
|
||||
|
||||
native MallocSizeOf(mozilla::MallocSizeOf);
|
||||
|
||||
[scriptable, uuid(283EE646-1AEF-11D4-98B3-00C04fA0CE9A)]
|
||||
interface nsIPropertyElement : nsISupports {
|
||||
attribute AUTF8String key;
|
||||
attribute AString value;
|
||||
};
|
||||
|
||||
[scriptable, uuid(706867af-0400-4faa-beb1-0dae87308784)]
|
||||
[scriptable, builtinclass, uuid(706867af-0400-4faa-beb1-0dae87308784)]
|
||||
interface nsIPersistentProperties : nsIProperties
|
||||
{
|
||||
/**
|
||||
@@ -53,8 +55,6 @@ interface nsIPersistentProperties : nsIProperties
|
||||
*/
|
||||
AString setStringProperty(in AUTF8String key, in AString value);
|
||||
|
||||
%{C++
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
||||
%}
|
||||
[notxpcom, nostdcall] size_t sizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||
};
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ nsPersistentProperties::nsPersistentProperties()
|
||||
nsPersistentProperties::~nsPersistentProperties() = default;
|
||||
|
||||
size_t nsPersistentProperties::SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
// The memory used by mTable is accounted for in mArena.
|
||||
size_t n = 0;
|
||||
n += mArena.SizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
@@ -24,9 +24,6 @@ class nsPersistentProperties final : public nsIPersistentProperties {
|
||||
NS_DECL_NSIPROPERTIES
|
||||
NS_DECL_NSIPERSISTENTPROPERTIES
|
||||
|
||||
size_t SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
private:
|
||||
~nsPersistentProperties();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import re
|
||||
from ply import lex
|
||||
from ply import yacc
|
||||
import six
|
||||
import textwrap
|
||||
from collections import namedtuple
|
||||
|
||||
"""A type conforms to the following pattern:
|
||||
@@ -311,17 +312,21 @@ class RustNoncompat(Exception):
|
||||
|
||||
|
||||
class IDLError(Exception):
|
||||
def __init__(self, message, location, warning=False):
|
||||
def __init__(self, message, location, warning=False, notes=None):
|
||||
self.message = message
|
||||
self.location = location
|
||||
self.warning = warning
|
||||
self.notes = notes
|
||||
|
||||
def __str__(self):
|
||||
return "%s: %s, %s" % (
|
||||
error = "%s: %s, %s" % (
|
||||
self.warning and "warning" or "error",
|
||||
self.message,
|
||||
self.location,
|
||||
)
|
||||
if self.notes is not None:
|
||||
error += "\nnote: %s" % self.notes
|
||||
return error
|
||||
|
||||
|
||||
class Include(object):
|
||||
@@ -431,7 +436,20 @@ class CDATA(object):
|
||||
self.location = location
|
||||
|
||||
def resolve(self, parent):
|
||||
pass
|
||||
# This can be a false-positive if the word `virtual` is included in a
|
||||
# comment, however this doesn't seem to happen very often.
|
||||
if isinstance(parent, Interface) and re.search(r"\bvirtual\b", self.data):
|
||||
raise IDLError(
|
||||
"cannot declare a C++ `virtual` member in XPIDL interface",
|
||||
self.location,
|
||||
notes=textwrap.fill(
|
||||
"""All virtual members must be declared directly using XPIDL.
|
||||
Both the Rust bindings and XPConnect rely on the per-platform
|
||||
vtable layouts generated by the XPIDL compiler to allow
|
||||
cross-language XPCOM method calls between JS and C++.
|
||||
Consider using a `[notxpcom, nostdcall]` method instead."""
|
||||
),
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "cdata: %s\n\t%r\n" % (self.location.get(), self.data)
|
||||
|
||||
@@ -331,14 +331,21 @@ def link_to_cpp(interfaces, fd, header_fd):
|
||||
)
|
||||
)
|
||||
|
||||
def is_type_reflectable(type):
|
||||
# All native types end up getting tagged as void*, or as wrapper types around void*
|
||||
if type["tag"] == "TD_VOID":
|
||||
return False
|
||||
if type["tag"] in ("TD_ARRAY", "TD_LEGACY_ARRAY"):
|
||||
return is_type_reflectable(type["element"])
|
||||
return True
|
||||
|
||||
def is_method_reflectable(method):
|
||||
if "hidden" in method["flags"]:
|
||||
return False
|
||||
|
||||
for param in method["params"]:
|
||||
# Reflected methods can't use native types. All native types end up
|
||||
# getting tagged as void*, so this check is easy.
|
||||
if param["type"]["tag"] == "TD_VOID":
|
||||
# Reflected methods can't use non-reflectable types.
|
||||
if not is_type_reflectable(param["type"]):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@@ -26,6 +26,7 @@ class nsITimer;
|
||||
typedef void (*nsTimerCallbackFunc) (nsITimer *aTimer, void *aClosure);
|
||||
%}
|
||||
|
||||
native MallocSizeOf(mozilla::MallocSizeOf);
|
||||
native nsTimerCallbackFunc(nsTimerCallbackFunc);
|
||||
[ref] native TimeDuration(mozilla::TimeDuration);
|
||||
|
||||
@@ -242,9 +243,7 @@ interface nsITimer : nsISupports
|
||||
*/
|
||||
[noscript] readonly attribute unsigned long allowedEarlyFiringMicroseconds;
|
||||
|
||||
%{C++
|
||||
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const = 0;
|
||||
%}
|
||||
[notxpcom, nostdcall] size_t sizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
@@ -781,7 +781,7 @@ void nsTimerImpl::SetHolder(nsTimerImplHolder* aHolder) { mHolder = aHolder; }
|
||||
|
||||
nsTimer::~nsTimer() = default;
|
||||
|
||||
size_t nsTimer::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
|
||||
size_t nsTimer::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
|
||||
return aMallocSizeOf(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -209,9 +209,6 @@ class nsTimer final : public nsITimer {
|
||||
: NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
virtual size_t SizeOfIncludingThis(
|
||||
mozilla::MallocSizeOf aMallocSizeOf) const override;
|
||||
|
||||
// Create a timer targeting the given target. nullptr indicates that the
|
||||
// current thread should be used as the timer's target.
|
||||
static RefPtr<nsTimer> WithEventTarget(nsIEventTarget* aTarget);
|
||||
|
||||
Reference in New Issue
Block a user