mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1212148 - Outline DialogValueHolder::Get() and create the variant directly. r=bz
This commit is contained in:
parent
5779c5c236
commit
b8efcfd366
@ -42,6 +42,7 @@
|
||||
#include "WindowNamedPropertiesHandler.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsVariant.h"
|
||||
|
||||
// Helper Classes
|
||||
#include "nsJSUtils.h"
|
||||
@ -559,6 +560,27 @@ nsTimeout::HasRefCntOne()
|
||||
return mRefCnt.get() == 1;
|
||||
}
|
||||
|
||||
static already_AddRefed<nsIVariant>
|
||||
CreateVoidVariant()
|
||||
{
|
||||
nsRefPtr<nsVariant> writable = new nsVariant();
|
||||
writable->SetAsVoid();
|
||||
return writable.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
DialogValueHolder::Get(nsIPrincipal* aSubject, nsIVariant** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIVariant> result;
|
||||
if (aSubject->SubsumesConsideringDomain(mOrigin)) {
|
||||
result = mValue;
|
||||
} else {
|
||||
result = CreateVoidVariant();
|
||||
}
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
extern uint64_t
|
||||
|
@ -241,15 +241,6 @@ struct IdleObserverHolder
|
||||
}
|
||||
};
|
||||
|
||||
static inline already_AddRefed<nsIVariant>
|
||||
CreateVoidVariant()
|
||||
{
|
||||
nsCOMPtr<nsIWritableVariant> writable =
|
||||
do_CreateInstance(NS_VARIANT_CONTRACTID);
|
||||
writable->SetAsVoid();
|
||||
return writable.forget();
|
||||
}
|
||||
|
||||
// Helper class to manage modal dialog arguments and all their quirks.
|
||||
//
|
||||
// Given our clunky embedding APIs, modal dialog arguments need to be passed
|
||||
@ -271,17 +262,7 @@ public:
|
||||
DialogValueHolder(nsIPrincipal* aSubject, nsIVariant* aValue)
|
||||
: mOrigin(aSubject)
|
||||
, mValue(aValue) {}
|
||||
nsresult Get(nsIPrincipal* aSubject, nsIVariant** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIVariant> result;
|
||||
if (aSubject->SubsumesConsideringDomain(mOrigin)) {
|
||||
result = mValue;
|
||||
} else {
|
||||
result = CreateVoidVariant();
|
||||
}
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
nsresult Get(nsIPrincipal* aSubject, nsIVariant** aResult);
|
||||
void Get(JSContext* aCx, JS::Handle<JSObject*> aScope, nsIPrincipal* aSubject,
|
||||
JS::MutableHandle<JS::Value> aResult, mozilla::ErrorResult& aError)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user