Newlines in links should be stripped when selecting "Copy Link Location"
bug 77522 r=harishd sr=jst a=asa patch=tmutreja@netscape.com
This commit is contained in:
@@ -4246,6 +4246,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
NS_ENSURE_ARG_POINTER(aNode);
|
||||
nsresult rv;
|
||||
nsAutoString anchorText;
|
||||
static char strippedChars[] = {'\t','\r','\n'};
|
||||
|
||||
// are we an anchor?
|
||||
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(aNode));
|
||||
@@ -4309,6 +4310,9 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//Remove all the '\t', '\r' and '\n' from 'anchorText'
|
||||
anchorText.StripChars(strippedChars);
|
||||
|
||||
// copy the href onto the clipboard
|
||||
return clipboard->CopyString(anchorText);
|
||||
}
|
||||
|
||||
@@ -4246,6 +4246,7 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
NS_ENSURE_ARG_POINTER(aNode);
|
||||
nsresult rv;
|
||||
nsAutoString anchorText;
|
||||
static char strippedChars[] = {'\t','\r','\n'};
|
||||
|
||||
// are we an anchor?
|
||||
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor(do_QueryInterface(aNode));
|
||||
@@ -4309,6 +4310,9 @@ NS_IMETHODIMP PresShell::DoCopyLinkLocation(nsIDOMNode* aNode)
|
||||
clipboard(do_GetService("@mozilla.org/widget/clipboardhelper;1", &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
//Remove all the '\t', '\r' and '\n' from 'anchorText'
|
||||
anchorText.StripChars(strippedChars);
|
||||
|
||||
// copy the href onto the clipboard
|
||||
return clipboard->CopyString(anchorText);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user