aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--embed/mozilla/EventContext.cpp19
2 files changed, 11 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ece392e8..ab6ab04d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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())
{