World Leaks in Safari, any clues to track down?

D

dd

I have a page that works just fine on all OS'es/Browsers
except Safari. When I close the page I get a world leak
triggered by the JavaScript Interpreter. I know most people
don't have the "always check for world leaks" on, so it's
not like it's going to happen for Joe user, but I've got some
code that Safari's JS interpreter isn't happy with and I want
to track it down. Just like I do with anything that appears
in the Firefox console, even if it's only a warning.

Anyone have any useful tips for tracking down stuff in
Safari? I was planning to start adding a return statement in
my onunload handling code (because it only happens when
I close the browser) and move the return further and further
towards the end of the function, assuming that it'll keep
working and working and then eventually I'll move the return
to after the code that causes the world leak. It's annoying
and time-consuming though :(
 
D

dd

Forgot to mention I'm using Safari 10.3.2 (I can't get it
to upgrade further than that because I'm stuck on OSX
10.3.9 and newer versions of OSX come on DVD and
my crappy iBook only has CDROM)...
 
V

VK

dd said:
Forgot to mention I'm using Safari 10.3.2

That's hardly given that the most recent version is only 2.0.4 ;-)
That must be MacOS version 10.3.2, so Safari is no higher then than 1.3
- that makes it pretty useless for debugging. It's like debugging right
now on Mac IE 5.0 in hope to become ready for Win IE 6 and 7. Most of
workarounds made will not be necessary, and the necessary workarounds
will not be found. If you are targeted to cover Safari as well, then
sorry but you need 2.0.4 - this is the only usable and anyhow
acknowledged Safari version. Also you can get yourselve a nightly build
from <http://webkit.org/> But I cannot guarantee that it will go on
10.3.2

As not a definitive guide of any kind but as recommendations that might
be useful see also:
<http://developer.yahoo.com/yui/articles/gbs/gbs_browser-chart.html>
<http://developer.yahoo.com/yui/articles/gbs/gbs.html>
 
D

dd

Yeah I know I need Tiger. The annoying thing is, I have
the DVD for it, I just can't stick the darned thing in the
drive :(

Unfortunately my delivery matrix goes back to Safari
1.2 so I have to support it.

Luckily I just found the problem. Run-on cases in a
switch statement. Safari JS interpreter doesn't like
them. Here's what I had, reduced to example code:

switch(p.charAt(0))
{
case "I":break;
case "C":
case "U":break;
case "T":break;
default:break;
}

I'm switching on a character rather than a number,
but the crucial thing is the lack of a break on the
"C" case because I want it to run through into the
"U" case. Obviously I've taken the actual code out
of the example just to leave the underlying structure.

Once I put that break in, Safari is happy again. No
more world leaks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top