mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 795703 - Do not assert when calling do_GetWeakReference() on a nsISupport not capable of that. r=smaug,dougt
This commit is contained in:
parent
1e37b06c3c
commit
12ac8bdc34
@ -9331,6 +9331,7 @@ nsDocument::RequestFullScreen(Element* aElement,
|
||||
|
||||
// Remember this is the requesting full-screen document.
|
||||
sFullScreenDoc = do_GetWeakReference(static_cast<nsIDocument*>(this));
|
||||
NS_ASSERTION(sFullScreenDoc, "nsDocument should support weak ref!");
|
||||
|
||||
#ifdef DEBUG
|
||||
// Note assertions must run before SetWindowFullScreen() as that does
|
||||
@ -9677,6 +9678,10 @@ nsDocument::RequestPointerLock(Element* aElement)
|
||||
nsEventStateManager::sPointerLockedElement = do_GetWeakReference(aElement);
|
||||
nsEventStateManager::sPointerLockedDoc =
|
||||
do_GetWeakReference(static_cast<nsIDocument*>(this));
|
||||
NS_ASSERTION(nsEventStateManager::sPointerLockedElement &&
|
||||
nsEventStateManager::sPointerLockedDoc,
|
||||
"aElement and this should support weak references!");
|
||||
|
||||
DispatchPointerLockChange(this);
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,10 @@ nsSystemTimeChangeObserver::AddWindowListenerImpl(nsIDOMWindow* aWindow)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
if (mWindowListeners.IndexOf(NS_GetWeakReference(aWindow)) !=
|
||||
nsCOMPtr<nsIWeakReference> windowWeakRef = do_GetWeakReference(aWindow);
|
||||
NS_ASSERTION(windowWeakRef, "nsIDOMWindow implementations shuld support weak ref");
|
||||
|
||||
if (mWindowListeners.IndexOf(windowWeakRef) !=
|
||||
nsTArray<nsIDOMWindow*>::NoIndex) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -80,7 +83,7 @@ nsSystemTimeChangeObserver::AddWindowListenerImpl(nsIDOMWindow* aWindow)
|
||||
RegisterSystemTimeChangeObserver(sObserver);
|
||||
}
|
||||
|
||||
mWindowListeners.AppendElement(NS_GetWeakReference(aWindow));
|
||||
mWindowListeners.AppendElement(windowWeakRef);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -106,9 +106,7 @@ nsArray::AppendElement(nsISupports* aElement, bool aWeak)
|
||||
{
|
||||
bool result;
|
||||
if (aWeak) {
|
||||
nsCOMPtr<nsISupports> elementRef =
|
||||
getter_AddRefs(static_cast<nsISupports*>
|
||||
(NS_GetWeakReference(aElement)));
|
||||
nsCOMPtr<nsIWeakReference> elementRef = do_GetWeakReference(aElement);
|
||||
NS_ASSERTION(elementRef, "AppendElement: Trying to use weak references on an object that doesn't support it");
|
||||
if (!elementRef)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -134,9 +132,7 @@ nsArray::InsertElementAt(nsISupports* aElement, uint32_t aIndex, bool aWeak)
|
||||
{
|
||||
nsCOMPtr<nsISupports> elementRef;
|
||||
if (aWeak) {
|
||||
elementRef =
|
||||
getter_AddRefs(static_cast<nsISupports*>
|
||||
(NS_GetWeakReference(aElement)));
|
||||
elementRef = do_GetWeakReference(aElement);
|
||||
NS_ASSERTION(elementRef, "InsertElementAt: Trying to use weak references on an object that doesn't support it");
|
||||
if (!elementRef)
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -152,9 +148,7 @@ nsArray::ReplaceElementAt(nsISupports* aElement, uint32_t aIndex, bool aWeak)
|
||||
{
|
||||
nsCOMPtr<nsISupports> elementRef;
|
||||
if (aWeak) {
|
||||
elementRef =
|
||||
getter_AddRefs(static_cast<nsISupports*>
|
||||
(NS_GetWeakReference(aElement)));
|
||||
elementRef = do_GetWeakReference(aElement);
|
||||
NS_ASSERTION(elementRef, "ReplaceElementAt: Trying to use weak references on an object that doesn't support it");
|
||||
if (!elementRef)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -74,7 +74,6 @@ NS_GetWeakReference( nsISupports* aInstancePtr, nsresult* aErrorPtr )
|
||||
if ( aInstancePtr )
|
||||
{
|
||||
nsCOMPtr<nsISupportsWeakReference> factoryPtr = do_QueryInterface(aInstancePtr, &status);
|
||||
NS_ASSERTION(factoryPtr, "Oops! You're asking for a weak reference to an object that doesn't support that.");
|
||||
if ( factoryPtr )
|
||||
{
|
||||
status = factoryPtr->GetWeakReference(&result);
|
||||
|
Loading…
Reference in New Issue
Block a user