Skip to content

Commit

Permalink
net: Fixing IE scope leak
Browse files Browse the repository at this point in the history
Creating manual test
  • Loading branch information
jakearchibald committed Sep 23, 2009
1 parent 30c7a3a commit fc811ac
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@

/.project
Empty file added manualtests/net/file.txt
Empty file.
53 changes: 53 additions & 0 deletions manualtests/net/index.html
@@ -0,0 +1,53 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>glow.net.get</title>
<script type="text/javascript" src="../includes/manualtests.js"></script>
<!-- loading gloader, to change the location of gloader, edit manualtests.js -->
<script type="text/javascript">// <![CDATA[
document.write(
'<script type="text/javascript" src="' + manualTests.config.gloaderPath + '"> \
gloader.use("glow", { \
$map: manualTests.config.mapPath, \
$base: manualTests.config.basePath \
}); \
<' + '/script>'
);
// ]]></script>

<script type="text/javascript">gloader.load(['glow', '@VERSION@', 'glow.data', 'glow.net'])</script>
</head>

<body>
<h1>glow.net.get</h1>

<h2>Memory Leak Test</h2>

<ol>
<li><a href="#" id="startTest">Start test</a></li>
<li>
A file will be fetched every 500ms. Memory usage should not creep up.
Logging has been commented out to avoid memory creep caused by adding elements
to the logger.
</li>
</ol>

<script type="text/javascript" class="showSrc">
document.getElementById('startTest').onclick = function() {
setInterval(function() {
glow.net.get('file.txt', {
onLoad: function() {
//manualTests.log('got file');
}
});
}, 500);
return false;
};
</script>


<script type="text/javascript">manualTests.showSrc();</script>
<script type="text/javascript">manualTests.log('Logging enabled');</script>
</body>
</html>
3 changes: 2 additions & 1 deletion src/net/net.js
Expand Up @@ -146,6 +146,7 @@
} else {
events.fire(request, "error", response);
}
req.onreadystatechange = new Function();
}
};
req.send(data);
Expand Down Expand Up @@ -370,7 +371,7 @@
//different if request came from loadScript
if (nativeReq) {
//clear listeners
nativeReq.onreadystatechange = emptyFunc;
nativeReq.onreadystatechange = new Function();
nativeReq.abort();
} else if (callbackIndex) {
//clear callback
Expand Down

0 comments on commit fc811ac

Please sign in to comment.