diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-03-29 23:01:59 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-03-29 23:01:59 +0800 |
commit | 078b4129c866a866b699aae0f947c43493c69cdc (patch) | |
tree | f14af9b35869d2564a753d36b327eba3d5081fd0 | |
parent | 243568a52f7147ee36570aa32a292200ad51fc0a (diff) | |
download | gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.tar gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.tar.gz gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.tar.bz2 gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.tar.lz gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.tar.xz gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.tar.zst gsoc2013-epiphany-078b4129c866a866b699aae0f947c43493c69cdc.zip |
Don't assume every anchor has a href attribute. Fixes bug #138200.
2004-03-29 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EventContext.cpp:
Don't assume every anchor has a href attribute. Fixes bug #138200.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | embed/mozilla/EventContext.cpp | 19 |
2 files changed, 11 insertions, 14 deletions
@@ -1,5 +1,11 @@ 2004-03-29 Christian Persch <chpe@cvs.gnome.org> + * embed/mozilla/EventContext.cpp: + + Don't assume every anchor has a href attribute. Fixes bug #138200. + +2004-03-29 Christian Persch <chpe@cvs.gnome.org> + * src/bookmarks/ephy-bookmarks-editor.c: (cmd_open_bookmarks_in_tabs): diff --git a/embed/mozilla/EventContext.cpp b/embed/mozilla/EventContext.cpp index 59b3897fb..610f124e5 100644 --- a/embed/mozilla/EventContext.cpp +++ b/embed/mozilla/EventContext.cpp @@ -382,6 +382,7 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, if (tag.EqualsIgnoreCase("a")) { nsAutoString tmp; + nsAutoString substr; rv = GatherTextUnder (node, tmp); if (NS_SUCCEEDED(rv)) @@ -389,25 +390,15 @@ nsresult EventContext::GetEventContext (nsIDOMEventTarget *EventTarget, nsCOMPtr <nsIDOMHTMLAnchorElement> anchor = do_QueryInterface(node); - rv = anchor->GetHref (tmp); - if (NS_FAILED(rv)) - return NS_ERROR_FAILURE; - nsCOMPtr<nsIURI> uri; - NS_NewURI (getter_AddRefs (uri), tmp); - if (!uri) return NS_ERROR_FAILURE; - - nsresult rv; - nsCAutoString scheme; - rv = uri->GetScheme (scheme); - if (NS_FAILED (rv)) return NS_ERROR_FAILURE; - - if (scheme.EqualsIgnoreCase("mailto")) + anchor->GetHref (tmp); + substr.Assign (Substring (tmp, 0, 7)); + if (substr.EqualsIgnoreCase("mailto:")) { info->context |= EMBED_CONTEXT_EMAIL_LINK; const nsAString &address = Substring(tmp, 7, tmp.Length()-7); SetStringProperty ("email", address); - } + } if (anchor && !tmp.IsEmpty()) { |