mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 455500 - Enormous memory usage with fieldset, legend, audio and DOMAttrModified event listener - s+sr=roc
This commit is contained in:
parent
a5967322cf
commit
a8a6640537
@ -136,6 +136,21 @@ protected:
|
||||
nsMediaNetworkState mNetworkState;
|
||||
nsMediaReadyState mReadyState;
|
||||
|
||||
// Value of the volume before it was muted
|
||||
float mMutedVolume;
|
||||
|
||||
// The defaultPlaybackRate attribute gives the desired speed at
|
||||
// which the media resource is to play, as a multiple of its
|
||||
// intrinsic speed.
|
||||
float mDefaultPlaybackRate;
|
||||
|
||||
// The playbackRate attribute gives the speed at which the media
|
||||
// resource plays, as a multiple of its intrinsic speed. If it is
|
||||
// not equal to the defaultPlaybackRate, then the implication is
|
||||
// that the user is using a feature such as fast forward or slow
|
||||
// motion playback.
|
||||
float mPlaybackRate;
|
||||
|
||||
// If true then we have begun downloading the media content.
|
||||
// Set to false when completed, or not yet started.
|
||||
PRPackedBool mBegun;
|
||||
@ -168,9 +183,6 @@ protected:
|
||||
// True if the sound is muted
|
||||
PRPackedBool mMuted;
|
||||
|
||||
// Value of the volume before it was muted
|
||||
float mMutedVolume;
|
||||
|
||||
// Flag to indicate if the child elements (eg. <source/>) have been
|
||||
// parsed.
|
||||
PRPackedBool mIsDoneAddingChildren;
|
||||
|
@ -96,8 +96,6 @@ public:
|
||||
NS_IMPL_URI_ATTR(nsHTMLMediaElement, Src, src)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Controls, controls)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLMediaElement, Autoplay, autoplay)
|
||||
NS_IMPL_FLOAT_ATTR_DEFAULT_VALUE(nsHTMLMediaElement, PlaybackRate, playbackrate, 1.0)
|
||||
NS_IMPL_FLOAT_ATTR_DEFAULT_VALUE(nsHTMLMediaElement, DefaultPlaybackRate, defaultplaybackrate, 1.0)
|
||||
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, Start, start)
|
||||
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, End, end)
|
||||
NS_IMPL_FLOAT_ATTR(nsHTMLMediaElement, LoopStart, loopstart)
|
||||
@ -138,6 +136,48 @@ NS_IMETHODIMP nsHTMLMediaElement::GetCurrentSrc(nsAString & aCurrentSrc)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute float defaultPlaybackRate; */
|
||||
NS_IMETHODIMP nsHTMLMediaElement::GetDefaultPlaybackRate(float *aDefaultPlaybackRate)
|
||||
{
|
||||
*aDefaultPlaybackRate = mDefaultPlaybackRate;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLMediaElement::SetDefaultPlaybackRate(float aDefaultPlaybackRate)
|
||||
{
|
||||
if (aDefaultPlaybackRate == 0.0) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
mDefaultPlaybackRate = aDefaultPlaybackRate;
|
||||
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("ratechange"));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute float playbackRate; */
|
||||
NS_IMETHODIMP nsHTMLMediaElement::GetPlaybackRate(float *aPlaybackRate)
|
||||
{
|
||||
*aPlaybackRate = mPlaybackRate;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLMediaElement::SetPlaybackRate(float aPlaybackRate)
|
||||
{
|
||||
if (aPlaybackRate == 0.0) {
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
||||
mPlaybackRate = aPlaybackRate;
|
||||
|
||||
if (mDecoder) {
|
||||
mDecoder->PlaybackRateChanged();
|
||||
}
|
||||
|
||||
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("ratechange"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute unsigned short networkState; */
|
||||
NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(PRUint16 *aNetworkState)
|
||||
{
|
||||
@ -394,6 +434,9 @@ nsHTMLMediaElement::nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParse
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mNetworkState(nsIDOMHTMLMediaElement::EMPTY),
|
||||
mReadyState(nsIDOMHTMLMediaElement::DATA_UNAVAILABLE),
|
||||
mMutedVolume(0.0),
|
||||
mDefaultPlaybackRate(1.0),
|
||||
mPlaybackRate(1.0),
|
||||
mBegun(PR_FALSE),
|
||||
mEnded(PR_FALSE),
|
||||
mLoadedFirstFrame(PR_FALSE),
|
||||
@ -401,7 +444,6 @@ nsHTMLMediaElement::nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParse
|
||||
mPaused(PR_TRUE),
|
||||
mSeeking(PR_FALSE),
|
||||
mMuted(PR_FALSE),
|
||||
mMutedVolume(0.0),
|
||||
mIsDoneAddingChildren(!aFromParser)
|
||||
{
|
||||
}
|
||||
@ -456,9 +498,7 @@ nsHTMLMediaElement::ParseAttribute(PRInt32 aNamespaceID,
|
||||
aResult.SetTo(nsContentUtils::TrimCharsInSet(kWhitespace, aValue));
|
||||
return PR_TRUE;
|
||||
}
|
||||
else if (aAttribute == nsGkAtoms::playbackrate
|
||||
|| aAttribute == nsGkAtoms::defaultplaybackrate
|
||||
|| aAttribute == nsGkAtoms::loopstart
|
||||
else if (aAttribute == nsGkAtoms::loopstart
|
||||
|| aAttribute == nsGkAtoms::loopend
|
||||
|| aAttribute == nsGkAtoms::start
|
||||
|| aAttribute == nsGkAtoms::end) {
|
||||
@ -485,11 +525,6 @@ nsHTMLMediaElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
if (aName == nsGkAtoms::src) {
|
||||
Load();
|
||||
}
|
||||
else if (aName == nsGkAtoms::playbackrate || aName == nsGkAtoms::defaultplaybackrate) {
|
||||
if (mDecoder)
|
||||
mDecoder->PlaybackRateChanged();
|
||||
DispatchAsyncSimpleEvent(NS_LITERAL_STRING("ratechange"));
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -27,7 +27,7 @@ try {
|
||||
a1.defaultPlaybackRate = 0
|
||||
passed = false;
|
||||
} catch(e) { }
|
||||
todo(passed, "Should not be able to set defaultPlaybackRate to 0");
|
||||
ok(passed, "Should not be able to set defaultPlaybackRate to 0");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -27,7 +27,7 @@ try {
|
||||
a1.playbackRate = 0
|
||||
passed = false;
|
||||
} catch(e) { }
|
||||
todo(passed, "Should not be able to set playbackRate to 0");
|
||||
ok(passed, "Should not be able to set playbackRate to 0");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
Loading…
Reference in New Issue
Block a user