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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user