After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 119047 - ephy_embed_get_location() gives wrong answer
ephy_embed_get_location() gives wrong answer
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: [obsolete] Backend:Mozilla
unspecified
Other Linux
: Normal normal
: 1.6
Assigned To: Marco Pesenti Gritti
Marco Pesenti Gritti
Depends on:
Blocks: 126167 147840
 
 
Reported: 2003-08-04 00:24 UTC by Christian Persch
Modified: 2005-08-01 21:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Christian Persch 2003-08-04 00:24:37 UTC
After the "ge_location" signal of the embed has delivered a new address for
the embed, the ephy_embed_get_location() function still returns the old
address.
Comment 1 Christian Persch 2003-10-27 21:40:35 UTC
This still occurs even with the recent EphyBrowser changes. I've
investigated this some more:

In mozilla-embed.cpp:mozilla_embed_location_changed_cb() we the
location from gtk_moz_embed_get_location() when emitting the signal.
We get in _location_changed_cb when the gtkmozembed emits "location"
signal. This happens from (gtkmozembed's)
EmbedProgress::OnLocationChange. It stores the new uri and emits the
signal.

On the other hand, ephy_embed_get_location ultimately uses
EphyBrowser::GetDocumentUrl, which uses the nsIDOMDocument's
nsIDocument's GetDocumentUrl. Apparently this still gives the location
from before the EmbedProgress::OnLocationChange.

Should we use gtk_moz_embed_get_location in
mozilla-embed.cpp:impl_get_location[ at least for toplevel == TRUE case] ?
Comment 2 Marco Pesenti Gritti 2003-10-27 22:07:00 UTC
If I'm not wrong the difference between the two is that the gtk embed
one is exactly what we passed to load_url, the EphyBrowse one is the
actual url loaded in the browser.
Comment 3 Marco Pesenti Gritti 2003-10-27 22:15:33 UTC
So I think it happens because on location signal the new dom document
has not been yet loaded. Gtkmozembed set his uri internally from the
call it gets in ProgressListener.

   mOwner->SetURI(newURI.get());
  gtk_signal_emit(GTK_OBJECT(mOwner->mOwningWidget),
                  moz_embed_signals[LOCATION]);

I think the only solution here is to change the embed signal to pass
the location in the callback itself, and to use the mozembed api in
that case only to get the url.
If you have better ideas...
Comment 4 Marco Pesenti Gritti 2004-06-12 07:58:30 UTC
I think we should really change the api here. The document uri and the loading
uri are really different things. Maybe add flags instead of the boolean ?

EPHY_EMBED_TOPLEVEL_DOCUMENT
EPHY_EMBED_FOCUSED_DOCUMENT
EPHY_EMBED_LOADING_DOCUMENT

While at it we should also rename to get_address.
Chritian, what do you think ?

Comment 5 Christian Persch 2004-06-12 11:28:39 UTC
Yes, the proposed API makes much more sense than what we have now.
Comment 6 Adam Hooper 2004-06-12 16:17:10 UTC
> EPHY_EMBED_TOPLEVEL_DOCUMENT
> EPHY_EMBED_FOCUSED_DOCUMENT
> EPHY_EMBED_LOADING_DOCUMENT

From a plugin developer's point of view, this seems annoying: every time I want
the location, I'll have to try EPHY_EMBED_LOADING_DOCUMENT and then
EPHY_EMBED_TOPLEVEL_DOCUMENT in sequence. Either that or we could use some
renaming. Here's my proposition:

EPHY_EMBED_DISPLAYED_TOPLEVEL_LOCATION
EPHY_EMBED_DISPLAYED_FOCUSED_LOCATION
EPHY_EMBED_LOCATION

Yeah, the names are longer... but IMO they carry more appropriate meaning.
Comment 7 Marco Pesenti Gritti 2004-06-30 18:20:08 UTC
WONTFIX again. It seem easier to just have an address argument in signals.
Comment 8 Christian Persch 2004-11-11 12:00:51 UTC
Reopening again :)

We need to solve this once and for all times, to fix bug 126167 and bug 147840.
Comment 9 Christian Persch 2005-07-26 14:43:43 UTC
I think this is fixed, can someone confirm?
Comment 10 Christian Persch 2005-08-01 21:21:00 UTC
Confirmed fixed.