Opened 16 years ago

Closed 14 years ago

#64 closed defect (wontfix)

Fix map viewer red reset button in IE

Reported by: rjwalker Owned by: mcoudert
Priority: minor Milestone: v2.6.0 RC0
Component: Web Map Viewer Version: v2.2.0 Final
Keywords: Cc:

Description

  1. Start up GN in IE7.
  2. Click on "Open Map Viewer".
  3. Click on the red and white reset (on/off) button at the top right of the big map.
  4. Scroll to the bottom of the page and observe the error message: "Exception 'Object doesn't support this property or method'".

It seems this was broken by the cleanup of Intermap in revision 955.

The Intermap.rebuild() function is not an event handler, so one shouldn't use bindAsEventListener() on it. This time it is just "good luck" that the code works in Firefox.

I attach a patch.

[The reason the existing code works on Firefox and not in IE is because of the implementation of bindAsEventListener() in prototype.js.

The second time rebuild() is called (after pressing the red reset button), it is being called by bindAsEventListener(), and bindAsEventListener() is passing the value of window.event as the parameter to rebuild(). IE has window.event; Firefox doesn't, so the value of "window.event" is undefined.

It is possible to see this difference "in action".

In IE, use Script Debugger to set a breakpoint inside the body of rebuild(). After pressing the red reset button, the breakpoint is reached the first time with the parameter "callback" set to a function. The second time the breakpoint is reached, the parameter "callback" is set to an event. Thus the subsequent call to callback() generates an exception.

Now do the same think in Firefox using Firebug. The second time the breakpoint is reached, the parameter "callback" is undefined, and thus not invoked as a function.

And yes, although the fix is trivial, this took me a very long time to figure out - but at least I learnt quite a lot along the way.]

Index: web/intermap/scripts/im_integration.js
===================================================================
--- web/intermap/scripts/im_integration.js      (revision 1335)
+++ web/intermap/scripts/im_integration.js      (working copy)
@@ -267,7 +267,7 @@
        im_bm.setBBox_dom(req.responseXML);
        im_mm.setBBox_dom(req.responseXML);

-       im_bm.rebuild(im_mm.rebuild.bindAsEventListener(im_mm));
+       im_bm.rebuild(im_mm.rebuild.bind(im_mm));

        // TODO: reset AoI also?
 }

Change History (8)

comment:1 by sgiaccio, 16 years ago

Owner: changed from geonetwork-devel@… to sgiaccio

comment:2 by ticheler, 15 years ago

Owner: changed from sgiaccio to ticheler

comment:3 by ticheler, 15 years ago

Milestone: v2.4.0 RC2
Owner: changed from ticheler to mcoudert
Priority: minorblocker

comment:4 by mcoudert, 15 years ago

Resolution: worksforme
Status: newclosed

After severals tests on IE7 and FF we did not manage to reproduce the problem. We also fixed some other bugs concerning intermap so it may be part of the fix (#113).

comment:5 by rjwalker, 15 years ago

Resolution: worksforme
Status: closedreopened

After severals tests on IE7 and FF we did not manage to reproduce the problem. We also fixed some other bugs concerning intermap so it may be part of the fix (#113).

Well, but the patch in ticket #113 has not yet been committed to SVN. Until that patch has been committed, instructions to reproduce this ticket must now be:

  1. Start up GN in IE7.
  2. Notice that (currently) the minimap is broken (because of ticket #113). So click on the "Advanced" button, then click on "Hide advanced options". The "Open Map Viewer" button will now work.
  3. Click on "Open Map Viewer".
  4. Click on the red and white reset (on/off) button at the top right of the big map.
  5. Scroll to the bottom of the page and observe the error message: "Exception 'Object doesn't support this property or method'".
  6. (You'll also see the extra message "Exception 'Invalid argument.'" above it because of ticket #113.)

I have a fresh checkout of both trunk and the 2.4 branch. In both, this defect is not fixed and is reproducible 100% of the time. The diagnosis I have given still stands, exactly as I wrote it.

Did you follow the last step of the instructions, namely, "Scroll to the bottom of the page"? You must scroll in order to see the message.

comment:6 by mcoudert, 15 years ago

Milestone: v2.4.0 RC2v2.5.0

comment:7 by ticheler, 14 years ago

Milestone: v2.5.0v2.5.1
Priority: blockerminor

comment:8 by mcoudert, 14 years ago

Milestone: v2.5.1v2.6.0 RC0
Resolution: wontfix
Status: reopenedclosed

Since Intermap was removed from trunk.

Note: See TracTickets for help on using tickets.