Old 12th April 2008, 18:25   #1
Junior Member
Join Date: Apr 2002
Location: Naters, Switzerland
Posts: 3
Send a message via ICQ to PointedEars Send a message via AIM to PointedEars
Script error in Media Library/Track View


(sorry if this is a dupe, I have not found this quite annoying bug being reported elsewhere using "script error" as query keywords.)

Often, if not always, when I select a track in the Media Library, instead of Winamp displaying the news associated with the track a script error occurs.

Steps to reproduce:

1. Open the Media Library.
2. Under Local Media, select the Audio folder or a custom filter folder for audio files (here: "Music").
3. Select an artist.
4. Select an album.
5. Select a track.

As a Web application developer, I have the Microsoft Script Debugger installed, which pops up then, since Winamp uses the MSHTML browser component. In the source, the statement


in (generated) line 251, column 11 of http://client.winamp.com/np/details/songinfo.php is highlighted. If I execute this statement, I get something along the lines (I have the German version here):

An exception of type 'Compile error in Microsoft JScript: Unterminated string literal' was not handled.

Who does not have debugging enabled in IE and a debugger installed may not see the error, but who has display of script errors enabled probably will. In any case, this error should be handled.

The reason for this error is the value of the `responseText' argument of the anonymous function assigned to `ajaxRequest.callback' in the function waGNArtistLookup(filename, artistID) declared at (generated) line 238 which often reads

"result = {\"faultCode\":1010,\"faultString\":\"The AOL Link Webserver application has reached is daily lookup limit with Gracenote. You may try again tomorrow or may contact Gracenote support at support@gracenote.com.
[Gracenote Error: <ERR>]\"};"

For example, a window.alert(responseText); shows that there is indeed a newline after the ".com." which is a syntax error in JScript (and other ECMAScript implementations).

A quick fix (for what I consider a ridiculous blunder not to be expected in a rather mature product such as Winamp, sorry) is to escape any newlines that might be contained in the value of `responseText':

responseText = responseText.replace(/\r?\n|\r/g, "\\n");

However, it should be considered to use a JSON parser instead of relying on that which Gracenote returns can be evaluated with evil[tm] eval(). See http://json.org/

It would also be better to declare the local variable of `result' before calling eval() and before the identifier is used below that. Assignment to undeclared identifiers is known to cause a runtime error in MSHTML when there is an element with the name or ID of the identifier, as there is a host object in the scope chain that prevents modification of its property then. Declaring all identifiers is also considered good style since it prevents leaking of locally used properties into the outer execution contexts.

Thank you in advance for fixing this ASAP. And keep up the otherwise good work!


PointedEars is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Winamp > Winamp Bug Reports

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump