remove checkOpenWindowForURLMatch (now in JS, editorApplicationOverlay.js) bug 104908, r=cmanske, sr=hewitt, a=asa, adt=jaime

git-svn-id: svn://10.0.0.236/trunk@118319 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brade%netscape.com
2002-04-06 00:47:21 +00:00
parent 18a0ac0e9a
commit ad9370a32e
2 changed files with 0 additions and 70 deletions

View File

@@ -1603,73 +1603,6 @@ nsEditorShell::TransferDocumentStateListeners()
return NS_OK;
}
// this method should move into JS
NS_IMETHODIMP
nsEditorShell::CheckOpenWindowForURLMatch(const PRUnichar* inFileURL, nsIDOMWindowInternal* inCheckWindow, PRBool *aDidFind)
{
NS_ENSURE_ARG_POINTER((inCheckWindow && aDidFind));
*aDidFind = PR_FALSE;
nsresult rv;
nsAutoString fileurlstring(inFileURL);
nsCOMPtr<nsIURI> newFileLocation;
rv = NS_NewURI(getter_AddRefs(newFileLocation), fileurlstring);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIDOMWindow> contentWindow;
inCheckWindow->GetContent(getter_AddRefs(contentWindow));
if (!contentWindow) return NS_ERROR_NULL_POINTER;
// get the content doc
nsCOMPtr<nsIDOMDocument> contentDoc;
contentWindow->GetDocument(getter_AddRefs(contentDoc));
// use the contentDoc to get the document's URI
nsCOMPtr<nsIURI> docURI;
rv = GetDocumentURI(contentDoc, getter_AddRefs(docURI));
if (rv == NS_ERROR_NOT_INITIALIZED) return NS_OK; // editing about:blank so no uri yet
if (NS_FAILED(rv) || !docURI) return NS_ERROR_NULL_POINTER;
// this does a simple string compare but isn't really checking for aliases
// or ".." in path which might actually cause this method to fail to match
// even though the same file is being edited
PRBool isSameFile;
if (NS_SUCCEEDED(docURI->Equals(newFileLocation, &isSameFile)) && isSameFile)
{
*aDidFind = PR_TRUE;
}
else
{
// do the schemes match? if not, these are not matches
// check file: protocol first
PRBool doContinueChecking = PR_TRUE;
nsCOMPtr<nsIFileURL> currentProtocolFile(do_QueryInterface(docURI));
if (currentProtocolFile)
{
nsCOMPtr<nsIFileURL> newProtocolFile(do_QueryInterface(newFileLocation));
if (!newProtocolFile)
{
*aDidFind = PR_FALSE;
doContinueChecking = PR_FALSE;
}
else if (NS_SUCCEEDED(currentProtocolFile->Equals(newProtocolFile, &isSameFile)) && isSameFile)
{
*aDidFind = PR_TRUE;
doContinueChecking = PR_FALSE;
}
}
// check http urls... then ftp, then maybe even https... any others?
if (doContinueChecking)
{
// this is covered by bug #104908
}
}
return NS_OK;
}
nsresult
nsEditorShell::GetDocumentURI(nsIDOMDocument *aDoc, nsIURI **aDocumentURI)
{

View File

@@ -133,9 +133,6 @@ interface nsIEditorShell : nsISupports
*/
void Shutdown();
/* check a particular window's URL to see if it matches the given URL */
boolean checkOpenWindowForURLMatch( in wstring inFileURL, in nsIDOMWindowInternal inCheckWindow);
/* Commands */
void Print();