Last modified: 2010-05-07 15:28:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T25431, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23431 - Avoid 'for...in' loops should prevent crashs on systems with Prototype.js
Avoid 'for...in' loops should prevent crashs on systems with Prototype.js
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Maps (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Jeroen De Dauw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-07 12:52 UTC by Benjamin Langguth
Modified: 2010-05-07 15:28 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Changes "for ... in" in Maps Extension javascript. (5.84 KB, patch)
2010-05-07 14:59 UTC, Benjamin Langguth
Details
Same for Semantic Maps. (1.02 KB, patch)
2010-05-07 15:00 UTC, Benjamin Langguth
Details

Description Benjamin Langguth 2010-05-07 12:52:40 UTC
Hi Jeroen,

to find out the problem why (Semantic) Maps does not get along with SMWHalo (and any other extension using the Prototype.js framework) i figured out that you're using 'for ... in' loops in your javascript code to (mostly) add your markers to the map.

I replaced these loops with the "standard" version "for( ; ;)" according to [1] and got Maps and SemanticMaps working with prototype.js active.
I would appreciate if you could check this and possibly change these loops to work reliable on any environment.

[1] http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays

Kind regards,
Benjamin
Comment 1 Jeroen De Dauw 2010-05-07 14:30:24 UTC
Awesome! I had no idea it was that simple to fix. 

Do you have any patch? If not I'll make the changes myself soonish.
Comment 2 Benjamin Langguth 2010-05-07 14:57:15 UTC
Yes, i have been surprised, too. Thought it would be a "bigger deal".

I'll attach two patches for you - one for Maps and one for Semantic Maps.
Please apply them in the appropriate extension folder.

Please notice that
1. I might not have covered all occurrences of 'for ... in'. So no guarantee :)
2. I could not test it with yahoo because of a missing key.
3. I did not touch the "minified js files". *min.js
4. If you think you might handle long arrays you should think about caching the array length.

I hope that this fixes all the "prototype clashings".

Greetings,
Benjamin
Comment 3 Benjamin Langguth 2010-05-07 14:59:39 UTC
Created attachment 7353 [details]
Changes "for ... in" in Maps Extension javascript.

Apply to '<mw-dir/>extensions/Maps'.
Comment 4 Benjamin Langguth 2010-05-07 15:00:54 UTC
Created attachment 7354 [details]
Same for Semantic Maps.

Apply to '<mw-dir>/extensions/SemanticMaps'.
Comment 5 Jeroen De Dauw 2010-05-07 15:14:26 UTC
Applied patches in r66022 and r66023. Thanks again for the help here :)
Comment 6 Benjamin Langguth 2010-05-07 15:28:13 UTC
You're welcome :) And thanks a lot for your quick reply.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links