Zn2O / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

Exception in onInfoWindowclose when using an HTML widget for Maximized window content. #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
r539

Detailed description:

from mathias.baumann:

I'm using r539 of the galgwt lib and gwt rc2. If I attach I Widget as
maximized content for an InfoWindow (e.g. content.setMaxContent(new
HTML("text"));)
I get the following exception when I close the InfoWindow but only if
i didn't expand the InfoWindow.

After maximizing, it closes without exception.

Workaround:
Use setMaxContent(String windowMaximizedContent)

[ERROR] (TypeError): Object doesn't support this property or method
 number: -2146827850
 description: Object doesn't support this property or method
com.google.gwt.core.client.JavaScriptException: (TypeError): Object
doesn't support this property or method
 number: -2146827850
 description: Object doesn't support this property or method
       at com.google.gwt.dom.client.Node$.removeChild$(Native Method)
       at com.google.gwt.user.client.DOM.removeChild(DOM.java:1050)
       at
com.google.gwt.user.client.ui.ComplexPanel.remove(ComplexPanel.java:
61)
       at com.google.gwt.maps.client.InfoWindow
$6.onInfoWindowClose(InfoWindow.java:518)
       at com.google.gwt.maps.client.MapWidget$3.callback(MapWidget.java:
278)
       at com.google.gwt.maps.client.impl.EventImpl
$VoidCallback.execute(EventImpl.java:231)
       at
com.google.gwt.maps.client.impl.EventImpl.invokeAndReportUncaughtExceptions(Even
tImpl.java:
260)
       at
com.google.gwt.maps.client.impl.EventImpl.invokeAndMaybeReportUncaughtExceptions
(EventImpl.java:
246)
       at com.google.gwt.maps.client.impl.EventImpl.access$0(EventImpl.java:
241)
       at com.google.gwt.maps.client.impl.EventImpl
$VoidCallback.callbackWrapper(EventImpl.java:227)

Original issue reported on code.google.com by galgwt.reviews@gmail.com on 12 Aug 2008 at 9:45

GoogleCodeExporter commented 9 years ago
When testing on a mac using the HelloMaps sample, I can see an exception in 
Hosted
mode, but web mode seems to work O.K for Safari and FF3.

Original comment by galgwt.reviews@gmail.com on 12 Aug 2008 at 9:56

GoogleCodeExporter commented 9 years ago
Tested on linux w/ current trunk and did not see the exception.
Tested on windows w/ current trunk and did not see the exception.

I went back to my mac laptop and couldn't reproduce the problem, even going to 
the
1.5 Release branch.  

Can you send me a reproducible test case?

Original comment by galgwt.reviews@gmail.com on 12 Aug 2008 at 3:09

GoogleCodeExporter commented 9 years ago
Here is the issue:

When the info window pops down, it tries to remove the maximized content from a 
panel
widget kept privately inside of the InfoWindow instance.  If the window is never
popped up, the maixmized content is never properly attached at the DOM level and
things are just all screwed up.  

Acc'd to Joel, the right thing to do here is to keep track of when the 
maximizedTitle
maximziedContent and regular content widgets are all swapped out with each 
other.  We
can do this by tapping into the Maximize and Restore events on the map.

In the mean time, this is just an ugly problem in hosted mode. It likely causes 
a
memory leak each time an info window with widgets defined is opened/closed.

Original comment by galgwt.reviews@gmail.com on 12 Aug 2008 at 4:56

GoogleCodeExporter commented 9 years ago
Hi,

I have the same kind of problem when using an InfoWindow that have two widgets 
: one
standard, and one for the maximized state. 

When you click on a marker, everything is fine, when you click on another marker
without closing the window, this exception occurs.

[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): Cet objet ne gère 
pas
cette propriété ou cette méthode
 number: -2146827850
 description: Cet objet ne gère pas cette propriété ou cette méthode
    at com.google.gwt.dom.client.Node$.removeChild$(Native Method)
    at com.google.gwt.user.client.DOM.removeChild(DOM.java:1050)
    at com.google.gwt.user.client.ui.ComplexPanel.remove(ComplexPanel.java:61)
    at com.google.gwt.user.client.ui.Widget.removeFromParent(Widget.java:65)
    at com.google.gwt.maps.client.InfoWindow$VirtualPanel.beginAttach(InfoWindow.java:62)
    at com.google.gwt.maps.client.InfoWindow.beginAttach(InfoWindow.java:504)
    at com.google.gwt.maps.client.InfoWindow.open(InfoWindow.java:303)
...
        at my code
...
com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(Re
questCallbackAdapter.java:215)
    at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:254)
    at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:226)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:217)

Original comment by mehdi.ra...@gmail.com on 23 Aug 2008 at 3:32

GoogleCodeExporter commented 9 years ago
mehdi:  This is the same bug.  It should be completely invisible in web mode, 
and the
only problem is a memory leak each time an info window is popped down.  It will 
be
addressed in an upcoming release.

Original comment by galgwt.reviews@gmail.com on 23 Aug 2008 at 10:54

GoogleCodeExporter commented 9 years ago
I wanted to let you that I tested the trunk version today (r751) and I still 
have the
same problem. 

Since I think you know it, I'd prefer to ask if there's I way I can help to fix 
this
? (I really need to fix this before I can release the first version of my 
webapp.)

Original comment by mehdi.ra...@gmail.com on 29 Aug 2008 at 11:15

GoogleCodeExporter commented 9 years ago
We will be working on this issue soon.  However, I am unaware of any user 
visible
issues related to this problem.

Original comment by galgwt.reviews@gmail.com on 30 Aug 2008 at 11:30

GoogleCodeExporter commented 9 years ago
Well, when you click for a second time on a marker (the same marker, or another 
one),
you expect an infowindow to open, but instead nothing happen. (or the already 
opened
infowindow is cleared)

And this is in hosted mode and ie. in firefox, sometime you can't open any more
infowindow.

Original comment by mehdi.ra...@gmail.com on 30 Aug 2008 at 12:21

GoogleCodeExporter commented 9 years ago
you can test the bug I'm talking about in the last comment with this code 
snippet : 

            final MapWidget map = new MapWidget(new LatLng(0, 0), 3);
            map.setSize("100%", "100%");

            for (int i = 0; i < 2; i++) {

                final LatLng coord = new LatLng(Random.nextDouble() * 50,
                        Random.nextDouble() * 50);
                Marker marker = new Marker(coord);
                marker.addMarkerClickHandler(new MarkerClickHandler() {
                    public void onClick(MarkerClickEvent event) {
                        InfoWindowContent content = new InfoWindowContent(
                                new HTML("minimized content"));
                        content.setMaxContent(new Frame("http://google.fr"));
                        map.getInfoWindow().open(coord, content);
                    }
                });
                map.addOverlay(marker);
            }

            RootPanel.get().add(map);

Click on a marker then on the other one.

Original comment by mehdi.ra...@gmail.com on 30 Aug 2008 at 10:03

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 2 Sep 2008 at 2:00

GoogleCodeExporter commented 9 years ago
Fix commited as r783.

Original comment by galgwt.reviews@gmail.com on 11 Sep 2008 at 7:28

GoogleCodeExporter commented 9 years ago
hi,

little question: does this fix was included in the 1.0 release? (I ask because 
I 
still have the bug)

Original comment by mehdi.ra...@gmail.com on 26 Sep 2008 at 7:43

GoogleCodeExporter commented 9 years ago
I thought this was.  Does the stack trace look the same?

Original comment by ericzun...@gmail.com on 26 Sep 2008 at 8:59

GoogleCodeExporter commented 9 years ago
yes, here it is :

[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): Cet objet ne gère 
pas cette propriété ou cette méthode
 number: -2146827850
 description: Cet objet ne gère pas cette propriété ou cette méthode
    at com.google.gwt.dom.client.Node$.removeChild$(Native Method)
    at com.google.gwt.user.client.DOM.removeChild(DOM.java:984)
    at com.google.gwt.user.client.ui.ComplexPanel.remove(ComplexPanel.java:61)
    at com.google.gwt.user.client.ui.Widget.removeFromParent(Widget.java:65)
    at com.google.gwt.maps.client.InfoWindow$VirtualPanel.attach(InfoWindow.java:64)
    at com.google.gwt.maps.client.InfoWindow$8.onMaximizeEnd(InfoWindow.java:599)
    at com.google.gwt.maps.client.InfoWindow$3.callback(InfoWindow.java:177)
    at com.google.gwt.maps.client.impl.EventImpl$VoidCallback.execute(EventImpl.java:231)
    at com.google.gwt.maps.client.impl.EventImpl.invokeAndReportUncaughtExceptions(EventImpl.java:260)
    at com.google.gwt.maps.client.impl.EventImpl.invokeAndMaybeReportUncaughtExceptions(EventImpl.java:246)
    at com.google.gwt.maps.client.impl.EventImpl.access$0(EventImpl.java:241)
    at com.google.gwt.maps.client.impl.EventImpl$VoidCallback.callbackWrapper(EventImpl.java:227)
    at com.google.gwt.maps.client.impl.__InfoWindowImplImpl.maximize(Native Method)
    at com.google.gwt.maps.client.InfoWindow.maximize(InfoWindow.java:284)
    ..my code..
    at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:254)
    at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:226)
    at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:217)

Original comment by mehdi.ra...@gmail.com on 26 Sep 2008 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 27 Sep 2008 at 1:17

GoogleCodeExporter commented 9 years ago
I too am still experiencing this error using 1.0. 

Here is the stack-trace:

[ERROR] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): Object doesn't 
support
this property or method
 number: -2146827850
 description: Object doesn't support this property or method
    at com.google.gwt.dom.client.Node$.removeChild$(Native Method)
    at com.google.gwt.user.client.DOM.removeChild(DOM.java:984)
    at com.google.gwt.user.client.ui.ComplexPanel.remove(ComplexPanel.java:61)
    at com.google.gwt.maps.client.InfoWindow.removeContentWidgets(InfoWindow.java:679)
    at com.google.gwt.maps.client.InfoWindow.access$2(InfoWindow.java:677)
    at com.google.gwt.maps.client.InfoWindow$7.onInfoWindowClose(InfoWindow.java:559)
    at com.google.gwt.maps.client.MapWidget$3.callback(MapWidget.java:329)
    at com.google.gwt.maps.client.impl.EventImpl$VoidCallback.execute(EventImpl.java:231)
    at
com.google.gwt.maps.client.impl.EventImpl.invokeAndReportUncaughtExceptions(Even
tImpl.java:260)
    at
com.google.gwt.maps.client.impl.EventImpl.invokeAndMaybeReportUncaughtExceptions
(EventImpl.java:246)
    at com.google.gwt.maps.client.impl.EventImpl.access$0(EventImpl.java:241)
    at
com.google.gwt.maps.client.impl.EventImpl$VoidCallback.callbackWrapper(EventImpl
.java:227)

Here is an excerpt of my code:

marker.addMarkerClickHandler(new MarkerClickHandler(){
public void onClick(MarkerClickEvent event) {

      // Define content
      HTML addressInfo = new HTML("<html>123 A Street</html>");
      InfoWindowContent infoWindowContent = new InfoWindowContent(addressInfo);

      // Open info window
      InfoWindow infoWindow = map.getInfoWindow();
      //infoWindow.open(billingLatLng, infoWindowContent);
      infoWindow.open(event.getSender(), infoWindowContent);
}
});

map.addOverlay(marker);

A few observations:

1) The uncaught exception is thrown when the info window closes (initially I 
thought
it was being thrown when clicking on the marker, and/or by extension, when the 
info
window was trying to open). 

2) Although the info window pops up empty, it is appropriately sized for what 
the
content should be.

3) The uncaught exception only happens after explicitly closing the info 
window. If I
close the info window implicitly (e.g. by clicking outside it on the map), no
exception is thrown but the same behavior is triggered i.e. the empty info 
window.

4) IE7 JavaScript error triggered by explicitly closing info window: 
'parentElement'
is null or not an object

5) Error happens in hosted mode, IE7, and Firefox

Original comment by micky.jo...@gmail.com on 29 Sep 2008 at 3:22

GoogleCodeExporter commented 9 years ago
The previous fix involved catching the info window close and maximize events in 
order to remove elements from 
the DOM.  In the case of an info window opened from the marker, the events fire 
on the marker object, not the 
map, so I need to extend the logic there.

Original comment by galgwt.reviews@gmail.com on 30 Sep 2008 at 12:32

GoogleCodeExporter commented 9 years ago
The attached patch seems to solve the crash from comment 16.

Original comment by Beefjerk...@gmail.com on 30 Sep 2008 at 9:31

Attachments:

GoogleCodeExporter commented 9 years ago
In addition to the marker issue, it seems that events might not be firing in 
the order I expected them to.   
Updated patch that includes a bunch of debugging and some defensive programming 
to keep from attaching 
widgets twice or registering the same event handler twice.

Note: this is not the final patch - it contains a lot of debugging.

Original comment by galgwt.reviews@gmail.com on 1 Oct 2008 at 2:38

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the quick turnaround. I'm not familiar with applying patches to my
environment. Can you point me the right direction?

Original comment by micky.jo...@gmail.com on 1 Oct 2008 at 3:11

GoogleCodeExporter commented 9 years ago
This document describes working with source in Eclipse:

http://code.google.com/docreader/#p=gwt-google-apis&s=gwt-google-apis&t=GettingS
tartedSource

All you really need to do for the patch is to download the latest subversion 
source (as described) from
  https://gwt-google-apis.google.com/svn/releases/maps/1.0/

apply the patch with

cd <root of maps directory>
patch -p0 < file.patch

then build the project with 'ant'

Original comment by galgwt.reviews@gmail.com on 1 Oct 2008 at 4:16

GoogleCodeExporter commented 9 years ago
Works great, Eric! Thanks!
You may also close 
http://code.google.com/p/gwt-google-apis/issues/detail?id=181. You
were right, it was the same issue.

Original comment by alexey.f...@gmail.com on 1 Oct 2008 at 6:39

GoogleCodeExporter commented 9 years ago
I downloaded and compiled the subversion source (rev. 860) using the links you
posted...thanks.

Unfortunately it seems the issue is only partially fixed. 

I can still reproduce the problem using the following steps:

1) Create and open a Map with Markers A and B
2) Click on Marker A: InfoWindow is displayed with some content
3) Click on Marker B: InfoWindow for Marker A closes; InfoWindow for Marker B 
opens
4) Close InfoWindow using the close 'x' button : InfoWindow closes
5) Click on either Marker: InfoWindow opens but is empty

Original comment by micky.jo...@gmail.com on 2 Oct 2008 at 6:29

GoogleCodeExporter commented 9 years ago
Updated patch attached.  It still contains debugging code that logs to the
Development Shell window that I will remove before submitting it.

Original comment by galgwt.reviews@gmail.com on 6 Oct 2008 at 9:01

Attachments:

GoogleCodeExporter commented 9 years ago
Functionality looks good. Issue from comment 23 is fixed. Thanks.

Original comment by micky.jo...@gmail.com on 7 Oct 2008 at 1:29

GoogleCodeExporter commented 9 years ago
Got confirmation from Mehdi that this worked for him.  Removed debugging and 
sent
code review out to Joel.  

Original comment by galgwt.reviews@gmail.com on 13 Oct 2008 at 3:15

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 13 Oct 2008 at 3:15

GoogleCodeExporter commented 9 years ago
Review by jgw. Committed as r924.

Original comment by galgwt.reviews@gmail.com on 24 Nov 2008 at 4:45

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 24 Nov 2008 at 4:46

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 11 Dec 2008 at 3:08

GoogleCodeExporter commented 9 years ago

Original comment by zundel@google.com on 21 Dec 2009 at 1:57