mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 895009. Don't pass in NonNull/OwningNonNull arguments to WebIDL binding consumers. r=peterv
This commit is contained in:
parent
240fa2dbbd
commit
12fbb7f6ba
@ -522,7 +522,8 @@ public:
|
||||
template<class ElementType>
|
||||
void TexImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLenum internalformat, WebGLenum format, WebGLenum type,
|
||||
const ElementType& elt, ErrorResult& rv) {
|
||||
ElementType& elt, ErrorResult& rv)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
nsRefPtr<gfxImageSurface> isurf;
|
||||
@ -559,7 +560,8 @@ public:
|
||||
template<class ElementType>
|
||||
void TexSubImage2D(WebGLenum target, WebGLint level,
|
||||
WebGLint xoffset, WebGLint yoffset, WebGLenum format,
|
||||
WebGLenum type, const ElementType& elt, ErrorResult& rv) {
|
||||
WebGLenum type, ElementType& elt, ErrorResult& rv)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
return;
|
||||
nsRefPtr<gfxImageSurface> isurf;
|
||||
@ -976,8 +978,9 @@ protected:
|
||||
return nsLayoutUtils::SurfaceFromElement(aElement, flags);
|
||||
}
|
||||
template<class ElementType>
|
||||
nsLayoutUtils::SurfaceFromElementResult SurfaceFromElement(const dom::NonNull<ElementType>& aElement) {
|
||||
return SurfaceFromElement(aElement.get());
|
||||
nsLayoutUtils::SurfaceFromElementResult SurfaceFromElement(ElementType& aElement)
|
||||
{
|
||||
return SurfaceFromElement(&aElement);
|
||||
}
|
||||
|
||||
nsresult SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromElementResult& res,
|
||||
|
@ -2022,6 +2022,37 @@ const T& Constify(T& arg)
|
||||
return arg;
|
||||
}
|
||||
|
||||
// Helper for turning (Owning)NonNull<T> into T&
|
||||
template<typename T>
|
||||
T& NonNullHelper(T& aArg)
|
||||
{
|
||||
return aArg;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& NonNullHelper(NonNull<T>& aArg)
|
||||
{
|
||||
return aArg;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& NonNullHelper(const NonNull<T>& aArg)
|
||||
{
|
||||
return aArg;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& NonNullHelper(OwningNonNull<T>& aArg)
|
||||
{
|
||||
return aArg;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T& NonNullHelper(const OwningNonNull<T>& aArg)
|
||||
{
|
||||
return aArg;
|
||||
}
|
||||
|
||||
// Reparent the wrapper of aObj to whatever its native now thinks its
|
||||
// parent should be.
|
||||
nsresult
|
||||
|
@ -4420,6 +4420,11 @@ class CGCallGenerator(CGThing):
|
||||
return False
|
||||
if needsConst(a):
|
||||
arg = CGWrapper(arg, pre="Constify(", post=")")
|
||||
# And convert NonNull<T> to T&
|
||||
if (((a.type.isInterface() or a.type.isCallback()) and
|
||||
not a.type.nullable()) or
|
||||
a.type.isDOMString()):
|
||||
arg = CGWrapper(arg, pre="NonNullHelper(", post=")")
|
||||
args.append(arg)
|
||||
|
||||
# Return values that go in outparams go here
|
||||
|
@ -275,7 +275,6 @@ public:
|
||||
TestInterface* ReceiveWeakSelf();
|
||||
TestInterface* ReceiveWeakNullableSelf();
|
||||
void PassSelf(TestInterface&);
|
||||
void PassSelf2(NonNull<TestInterface>&);
|
||||
void PassNullableSelf(TestInterface*);
|
||||
already_AddRefed<TestInterface> NonNullSelf();
|
||||
void SetNonNullSelf(TestInterface&);
|
||||
@ -297,7 +296,6 @@ public:
|
||||
IndirectlyImplementedInterface* ReceiveWeakOther();
|
||||
IndirectlyImplementedInterface* ReceiveWeakNullableOther();
|
||||
void PassOther(IndirectlyImplementedInterface&);
|
||||
void PassOther2(NonNull<IndirectlyImplementedInterface>&);
|
||||
void PassNullableOther(IndirectlyImplementedInterface*);
|
||||
already_AddRefed<IndirectlyImplementedInterface> NonNullOther();
|
||||
void SetNonNullOther(IndirectlyImplementedInterface&);
|
||||
@ -312,7 +310,6 @@ public:
|
||||
TestExternalInterface* ReceiveWeakExternal();
|
||||
TestExternalInterface* ReceiveWeakNullableExternal();
|
||||
void PassExternal(TestExternalInterface*);
|
||||
void PassExternal2(TestExternalInterface*);
|
||||
void PassNullableExternal(TestExternalInterface*);
|
||||
already_AddRefed<TestExternalInterface> NonNullExternal();
|
||||
void SetNonNullExternal(TestExternalInterface*);
|
||||
@ -327,7 +324,6 @@ public:
|
||||
TestCallbackInterface* ReceiveWeakCallbackInterface();
|
||||
TestCallbackInterface* ReceiveWeakNullableCallbackInterface();
|
||||
void PassCallbackInterface(TestCallbackInterface&);
|
||||
void PassCallbackInterface2(OwningNonNull<TestCallbackInterface>);
|
||||
void PassNullableCallbackInterface(TestCallbackInterface*);
|
||||
already_AddRefed<TestCallbackInterface> NonNullCallbackInterface();
|
||||
void SetNonNullCallbackInterface(TestCallbackInterface&);
|
||||
@ -808,6 +804,28 @@ private:
|
||||
void PassVariadicAny(JSContext*, Sequence<JS::Value>&) MOZ_DELETE;
|
||||
void PassVariadicObject(JSContext*, Sequence<JSObject*>&) MOZ_DELETE;
|
||||
void PassVariadicNullableObject(JSContext*, Sequence<JSObject*>&) MOZ_DELETE;
|
||||
|
||||
// Ensure NonNull does not leak in
|
||||
void PassSelf(NonNull<TestInterface>&) MOZ_DELETE;
|
||||
void PassSelf(OwningNonNull<TestInterface>&) MOZ_DELETE;
|
||||
void PassSelf(const NonNull<TestInterface>&) MOZ_DELETE;
|
||||
void PassSelf(const OwningNonNull<TestInterface>&) MOZ_DELETE;
|
||||
void PassOther(NonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
|
||||
void PassOther(const NonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
|
||||
void PassOther(OwningNonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
|
||||
void PassOther(const OwningNonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
|
||||
void PassCallbackInterface(OwningNonNull<TestCallbackInterface>&) MOZ_DELETE;
|
||||
void PassCallbackInterface(const OwningNonNull<TestCallbackInterface>&) MOZ_DELETE;
|
||||
void PassCallbackInterface(NonNull<TestCallbackInterface>&) MOZ_DELETE;
|
||||
void PassCallbackInterface(const NonNull<TestCallbackInterface>&) MOZ_DELETE;
|
||||
void PassCallback(OwningNonNull<TestCallback>&) MOZ_DELETE;
|
||||
void PassCallback(const OwningNonNull<TestCallback>&) MOZ_DELETE;
|
||||
void PassCallback(NonNull<TestCallback>&) MOZ_DELETE;
|
||||
void PassCallback(const NonNull<TestCallback>&) MOZ_DELETE;
|
||||
void PassString(const NonNull<nsAString>&) MOZ_DELETE;
|
||||
void PassString(NonNull<nsAString>&) MOZ_DELETE;
|
||||
void PassString(const OwningNonNull<nsAString>&) MOZ_DELETE;
|
||||
void PassString(OwningNonNull<nsAString>&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
class TestIndexedGetterInterface : public nsISupports,
|
||||
|
@ -223,10 +223,7 @@ interface TestInterface {
|
||||
TestInterface? receiveNullableSelf();
|
||||
TestInterface receiveWeakSelf();
|
||||
TestInterface? receiveWeakNullableSelf();
|
||||
// A verstion to test for casting to TestInterface&
|
||||
void passSelf(TestInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passSelf2(TestInterface arg);
|
||||
void passNullableSelf(TestInterface? arg);
|
||||
attribute TestInterface nonNullSelf;
|
||||
attribute TestInterface? nullableSelf;
|
||||
@ -254,10 +251,7 @@ interface TestInterface {
|
||||
IndirectlyImplementedInterface? receiveNullableOther();
|
||||
IndirectlyImplementedInterface receiveWeakOther();
|
||||
IndirectlyImplementedInterface? receiveWeakNullableOther();
|
||||
// A verstion to test for casting to IndirectlyImplementedInterface&
|
||||
void passOther(IndirectlyImplementedInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passOther2(IndirectlyImplementedInterface arg);
|
||||
void passNullableOther(IndirectlyImplementedInterface? arg);
|
||||
attribute IndirectlyImplementedInterface nonNullOther;
|
||||
attribute IndirectlyImplementedInterface? nullableOther;
|
||||
@ -271,10 +265,7 @@ interface TestInterface {
|
||||
TestExternalInterface? receiveNullableExternal();
|
||||
TestExternalInterface receiveWeakExternal();
|
||||
TestExternalInterface? receiveWeakNullableExternal();
|
||||
// A verstion to test for casting to TestExternalInterface&
|
||||
void passExternal(TestExternalInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passExternal2(TestExternalInterface arg);
|
||||
void passNullableExternal(TestExternalInterface? arg);
|
||||
attribute TestExternalInterface nonNullExternal;
|
||||
attribute TestExternalInterface? nullableExternal;
|
||||
@ -288,10 +279,7 @@ interface TestInterface {
|
||||
TestCallbackInterface? receiveNullableCallbackInterface();
|
||||
TestCallbackInterface receiveWeakCallbackInterface();
|
||||
TestCallbackInterface? receiveWeakNullableCallbackInterface();
|
||||
// A verstion to test for casting to TestCallbackInterface&
|
||||
void passCallbackInterface(TestCallbackInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passCallbackInterface2(TestCallbackInterface arg);
|
||||
void passNullableCallbackInterface(TestCallbackInterface? arg);
|
||||
attribute TestCallbackInterface nonNullCallbackInterface;
|
||||
attribute TestCallbackInterface? nullableCallbackInterface;
|
||||
|
@ -119,10 +119,7 @@ interface TestExampleInterface {
|
||||
TestInterface? receiveNullableSelf();
|
||||
TestInterface receiveWeakSelf();
|
||||
TestInterface? receiveWeakNullableSelf();
|
||||
// A verstion to test for casting to TestInterface&
|
||||
void passSelf(TestInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passSelf2(TestInterface arg);
|
||||
void passNullableSelf(TestInterface? arg);
|
||||
attribute TestInterface nonNullSelf;
|
||||
attribute TestInterface? nullableSelf;
|
||||
@ -150,10 +147,7 @@ interface TestExampleInterface {
|
||||
IndirectlyImplementedInterface? receiveNullableOther();
|
||||
IndirectlyImplementedInterface receiveWeakOther();
|
||||
IndirectlyImplementedInterface? receiveWeakNullableOther();
|
||||
// A verstion to test for casting to IndirectlyImplementedInterface&
|
||||
void passOther(IndirectlyImplementedInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passOther2(IndirectlyImplementedInterface arg);
|
||||
void passNullableOther(IndirectlyImplementedInterface? arg);
|
||||
attribute IndirectlyImplementedInterface nonNullOther;
|
||||
attribute IndirectlyImplementedInterface? nullableOther;
|
||||
@ -167,10 +161,7 @@ interface TestExampleInterface {
|
||||
TestExternalInterface? receiveNullableExternal();
|
||||
TestExternalInterface receiveWeakExternal();
|
||||
TestExternalInterface? receiveWeakNullableExternal();
|
||||
// A verstion to test for casting to TestExternalInterface&
|
||||
void passExternal(TestExternalInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passExternal2(TestExternalInterface arg);
|
||||
void passNullableExternal(TestExternalInterface? arg);
|
||||
attribute TestExternalInterface nonNullExternal;
|
||||
attribute TestExternalInterface? nullableExternal;
|
||||
@ -184,10 +175,7 @@ interface TestExampleInterface {
|
||||
TestCallbackInterface? receiveNullableCallbackInterface();
|
||||
TestCallbackInterface receiveWeakCallbackInterface();
|
||||
TestCallbackInterface? receiveWeakNullableCallbackInterface();
|
||||
// A verstion to test for casting to TestCallbackInterface&
|
||||
void passCallbackInterface(TestCallbackInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passCallbackInterface2(TestCallbackInterface arg);
|
||||
void passNullableCallbackInterface(TestCallbackInterface? arg);
|
||||
attribute TestCallbackInterface nonNullCallbackInterface;
|
||||
attribute TestCallbackInterface? nullableCallbackInterface;
|
||||
|
@ -136,8 +136,6 @@ interface TestJSImplInterface {
|
||||
|
||||
// A version to test for casting to TestJSImplInterface&
|
||||
void passSelf(TestJSImplInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passSelf2(TestJSImplInterface arg);
|
||||
void passNullableSelf(TestJSImplInterface? arg);
|
||||
attribute TestJSImplInterface nonNullSelf;
|
||||
attribute TestJSImplInterface? nullableSelf;
|
||||
@ -168,10 +166,7 @@ interface TestJSImplInterface {
|
||||
//IndirectlyImplementedInterface receiveWeakOther();
|
||||
//IndirectlyImplementedInterface? receiveWeakNullableOther();
|
||||
|
||||
// A verstion to test for casting to IndirectlyImplementedInterface&
|
||||
void passOther(IndirectlyImplementedInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passOther2(IndirectlyImplementedInterface arg);
|
||||
void passNullableOther(IndirectlyImplementedInterface? arg);
|
||||
attribute IndirectlyImplementedInterface nonNullOther;
|
||||
attribute IndirectlyImplementedInterface? nullableOther;
|
||||
@ -186,10 +181,7 @@ interface TestJSImplInterface {
|
||||
// Callback interface ignores 'resultNotAddRefed'. See bug 843272.
|
||||
//TestExternalInterface receiveWeakExternal();
|
||||
//TestExternalInterface? receiveWeakNullableExternal();
|
||||
// A verstion to test for casting to TestExternalInterface&
|
||||
void passExternal(TestExternalInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passExternal2(TestExternalInterface arg);
|
||||
void passNullableExternal(TestExternalInterface? arg);
|
||||
attribute TestExternalInterface nonNullExternal;
|
||||
attribute TestExternalInterface? nullableExternal;
|
||||
@ -204,10 +196,7 @@ interface TestJSImplInterface {
|
||||
// Callback interface ignores 'resultNotAddRefed'. See bug 843272.
|
||||
//TestCallbackInterface receiveWeakCallbackInterface();
|
||||
//TestCallbackInterface? receiveWeakNullableCallbackInterface();
|
||||
// A verstion to test for casting to TestCallbackInterface&
|
||||
void passCallbackInterface(TestCallbackInterface arg);
|
||||
// A version we can use to test for the exact type passed in
|
||||
void passCallbackInterface2(TestCallbackInterface arg);
|
||||
void passNullableCallbackInterface(TestCallbackInterface? arg);
|
||||
attribute TestCallbackInterface nonNullCallbackInterface;
|
||||
attribute TestCallbackInterface? nullableCallbackInterface;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
|
||||
static already_AddRefed<IDBVersionChangeEvent>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const NonNull<nsAString>& aType,
|
||||
const nsAString& aType,
|
||||
const IDBVersionChangeEventInit& aOptions,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
@ -647,7 +647,7 @@ IDBFactory::Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal,
|
||||
const NonNull<nsAString>& aName,
|
||||
const nsAString& aName,
|
||||
const Optional<uint64_t>& aVersion,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
@ -661,7 +661,7 @@ IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal,
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
IDBFactory::DeleteForPrincipal(nsIPrincipal* aPrincipal,
|
||||
const NonNull<nsAString>& aName,
|
||||
const nsAString& aName,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// Just to be on the extra-safe side
|
||||
|
@ -141,14 +141,14 @@ public:
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
Open(const NonNull<nsAString>& aName, const Optional<uint64_t>& aVersion,
|
||||
Open(const nsAString& aName, const Optional<uint64_t>& aVersion,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
return Open(nullptr, aName, aVersion, false, aRv);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
DeleteDatabase(const NonNull<nsAString>& aName, ErrorResult& aRv)
|
||||
DeleteDatabase(const nsAString& aName, ErrorResult& aRv)
|
||||
{
|
||||
return Open(nullptr, aName, Optional<uint64_t>(), true, aRv);
|
||||
}
|
||||
@ -158,11 +158,11 @@ public:
|
||||
JS::Handle<JS::Value> aSecond, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
OpenForPrincipal(nsIPrincipal* aPrincipal, const NonNull<nsAString>& aName,
|
||||
OpenForPrincipal(nsIPrincipal* aPrincipal, const nsAString& aName,
|
||||
const Optional<uint64_t>& aVersion, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<nsIIDBOpenDBRequest>
|
||||
DeleteForPrincipal(nsIPrincipal* aPrincipal, const NonNull<nsAString>& aName,
|
||||
DeleteForPrincipal(nsIPrincipal* aPrincipal, const nsAString& aName,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user