Bug 919265 - Part 2: Add ClearOnShutdown() call on the static WebVTTParserWrapper. r=bz

This commit is contained in:
Rick Eyre 2013-09-24 15:17:15 -04:00
parent 0ccec53362
commit f851af8541
3 changed files with 40 additions and 5 deletions

View File

@ -8,6 +8,7 @@
#include "nsIFrame.h"
#include "nsVideoFrame.h"
#include "nsComponentManagerUtils.h"
#include "mozilla/ClearOnShutdown.h"
// Alternate value for the 'auto' keyword.
#define WEBVTT_AUTO -1
@ -162,6 +163,7 @@ TextTrackCue::GetCueAsHTML()
return mDocument->CreateDocumentFragment();
}
sParserWrapper = parserWrapper;
ClearOnShutdown(&sParserWrapper);
}
nsPIDOMWindow* window = mDocument->GetWindow();

View File

@ -64,10 +64,16 @@ MOCHITEST_FILES = \
test_audio1.html \
test_audio2.html \
test_autoplay.html \
test_bug448534.html \
test_bug463162.xhtml \
test_bug495145.html \
test_bug495300.html \
test_bug654550.html \
test_bug686942.html \
test_bug883173.html \
test_bug895305.html \
test_bug895091.html \
test_bug919265.html \
test_can_play_type.html \
test_can_play_type_mpeg.html \
test_closing_connections.html \
@ -118,8 +124,6 @@ MOCHITEST_FILES = \
test_mozHasAudio.html \
test_source_media.html \
test_autoplay_contentEditable.html \
test_bug448534.html \
test_bug463162.xhtml \
test_decoder_disable.html \
test_mediarecorder_record_no_timeslice.html \
test_mediarecorder_reload_crash.html \
@ -146,9 +150,6 @@ MOCHITEST_FILES = \
test_VideoPlaybackQuality.html \
test_VideoPlaybackQuality_disabled.html \
test_webvtt_disabled.html \
test_bug895305.html \
test_bug895091.html \
test_bug883173.html \
$(NULL)
# Don't run in suite

View File

@ -0,0 +1,32 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=919265
-->
<head>
<meta charset='utf-8'>
<title>Regression test for bug 919265 - Leak on VTTCue::GetCueAsHTML()</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [["media.webvtt.enabled", true]]},
function() {
// We shouldn't leak upon shutdown.
(new VTTCue(0, 0, "")).getCueAsHTML();
// We need to assert something for Mochitest to be happy.
ok(true);
SimpleTest.finish();
}
);
</script>
</pre>
</body>
</html>