NS_IMETHODIMP nsHTTPIndex::Unassert(nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget) { nsresult rv = NS_ERROR_UNEXPECTED; if (mInner) { rv = mInner->Unassert(aSource, aProperty, aTarget); } return(rv); }
/* void onCloseWindow (in nsIXULWindow window); */ NS_IMETHODIMP nsWindowDataSource::OnCloseWindow(nsIXULWindow *window) { nsVoidKey key(window); nsCOMPtr<nsIRDFResource> resource; nsresult rv; if (!mWindowResources.Remove(&key, getter_AddRefs(resource))) return NS_ERROR_UNEXPECTED; // make sure we're not shutting down if (!mContainer) return NS_OK; nsCOMPtr<nsIRDFNode> oldKeyNode; nsCOMPtr<nsIRDFInt> oldKeyInt; // get the old keyIndex, if any rv = GetTarget(resource, kNC_KeyIndex, PR_TRUE, getter_AddRefs(oldKeyNode)); if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) oldKeyInt = do_QueryInterface(oldKeyNode); // update RDF and keyindex - from this point forward we'll ignore // errors, because they just indicate some kind of RDF inconsistency PRInt32 winIndex = -1; rv = mContainer->IndexOf(resource, &winIndex); if (NS_FAILED(rv)) return NS_OK; // unassert the old window, ignore any error mContainer->RemoveElement(resource, PR_TRUE); nsCOMPtr<nsISimpleEnumerator> children; rv = mContainer->GetElements(getter_AddRefs(children)); if (NS_FAILED(rv)) return NS_OK; PRBool more = PR_FALSE; while (NS_SUCCEEDED(rv = children->HasMoreElements(&more)) && more) { nsCOMPtr<nsISupports> sup; rv = children->GetNext(getter_AddRefs(sup)); if (NS_FAILED(rv)) break; nsCOMPtr<nsIRDFResource> windowResource = do_QueryInterface(sup, &rv); if (NS_FAILED(rv)) continue; PRInt32 currentIndex = -1; mContainer->IndexOf(windowResource, ¤tIndex); // can skip updating windows with lower indexes // than the window that was removed if (currentIndex < winIndex) continue; nsCOMPtr<nsIRDFNode> newKeyNode; nsCOMPtr<nsIRDFInt> newKeyInt; rv = GetTarget(windowResource, kNC_KeyIndex, PR_TRUE, getter_AddRefs(newKeyNode)); if (NS_SUCCEEDED(rv) && (rv != NS_RDF_NO_VALUE)) newKeyInt = do_QueryInterface(newKeyNode); // changing from one key index to another if (oldKeyInt && newKeyInt) Change(windowResource, kNC_KeyIndex, oldKeyInt, newKeyInt); // creating a new keyindex - probably window going // from (none) to "9" else if (newKeyInt) Assert(windowResource, kNC_KeyIndex, newKeyInt, PR_TRUE); // somehow inserting a window above this one, // "9" to (none) else if (oldKeyInt) Unassert(windowResource, kNC_KeyIndex, oldKeyInt); } return NS_OK; }