MFH: r473780

www/waterfox: update to 56.2.1.55

- Apply some FF61 fixes

Changes:	7f6ff796ee...6395bf177f
Approved by:	ports-secteam blanket
This commit is contained in:
Jan Beich 2018-07-03 00:23:42 +00:00
parent 851f88fc8f
commit 6d7428930d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q3/; revision=473784
8 changed files with 219 additions and 477 deletions

View File

@ -1,9 +1,8 @@
# $FreeBSD$
PORTNAME= waterfox
DISTVERSION= 56.2.1-48
DISTVERSIONSUFFIX= -g7f6ff796eeda4
PORTREVISION= 1
DISTVERSION= 56.2.1-55
DISTVERSIONSUFFIX= -g6395bf177f76a
CATEGORIES= www ipv6
MAINTAINER= jbeich@FreeBSD.org

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1530292793
SHA256 (MrAlex94-Waterfox-56.2.1-48-g7f6ff796eeda4_GH0.tar.gz) = 07b65c4e20917968ce5086ddef09dcfe37bd90135f4f37fa2d4cd6029ac38df8
SIZE (MrAlex94-Waterfox-56.2.1-48-g7f6ff796eeda4_GH0.tar.gz) = 395133776
TIMESTAMP = 1530543888
SHA256 (MrAlex94-Waterfox-56.2.1-55-g6395bf177f76a_GH0.tar.gz) = 768ff4628b2f4dcf1868dfae711a10b69d2166c544a1252dd4463c2b596676ec
SIZE (MrAlex94-Waterfox-56.2.1-55-g6395bf177f76a_GH0.tar.gz) = 395130631

View File

@ -1,218 +0,0 @@
commit e5c1015f6968
Author: Alex Gaynor <agaynor@mozilla.com>
Date: Fri May 18 18:59:00 2018 -0400
Bug 1456189 - Simplify BufferList::Extract to make the lifetimes clearer. r=froydnj, a=RyanVM
--HG--
extra : source : 9d8c922db947eadeca8278bb33d4f5fe271cef05
---
mfbt/BufferList.h | 129 ++++++++++++++++++++++++++++--------------
mfbt/tests/TestBufferList.cpp | 33 ++++++++++-
2 files changed, 115 insertions(+), 47 deletions(-)
diff --git mfbt/BufferList.h mfbt/BufferList.h
index 62ab540df0fbb..a2e7aac32a9f3 100644
--- mfbt/BufferList.h
+++ mfbt/BufferList.h
@@ -9,6 +9,7 @@
#include <algorithm>
#include "mozilla/AllocPolicy.h"
+#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Move.h"
#include "mozilla/ScopeExit.h"
@@ -538,61 +539,101 @@ BufferList<AllocPolicy>::Extract(IterImpl& aIter, size_t aSize, bool* aSuccess)
MOZ_ASSERT(aSize % kSegmentAlignment == 0);
MOZ_ASSERT(intptr_t(aIter.mData) % kSegmentAlignment == 0);
- IterImpl iter = aIter;
- size_t size = aSize;
- size_t toCopy = std::min(size, aIter.RemainingInSegment());
- MOZ_ASSERT(toCopy % kSegmentAlignment == 0);
+ auto failure = [this, aSuccess]() {
+ *aSuccess = false;
+ return BufferList(0, 0, mStandardCapacity);
+ };
- BufferList result(0, toCopy, mStandardCapacity);
- BufferList error(0, 0, mStandardCapacity);
+ // Number of segments we'll need to copy data from to satisfy the request.
+ size_t segmentsNeeded = 0;
+ // If this is None then the last segment is a full segment, otherwise we need
+ // to copy this many bytes.
+ Maybe<size_t> lastSegmentSize;
+ {
+ // Copy of the iterator to walk the BufferList and see how many segments we
+ // need to copy.
+ IterImpl iter = aIter;
+ size_t remaining = aSize;
+ while (!iter.Done() && remaining &&
+ remaining >= iter.RemainingInSegment()) {
+ remaining -= iter.RemainingInSegment();
+ iter.Advance(*this, iter.RemainingInSegment());
+ segmentsNeeded++;
+ }
- // Copy the head
- if (!result.WriteBytes(aIter.mData, toCopy)) {
- *aSuccess = false;
- return error;
+ if (remaining) {
+ if (iter.Done()) {
+ // We reached the end of the BufferList and there wasn't enough data to
+ // satisfy the request.
+ return failure();
+ }
+ lastSegmentSize.emplace(remaining);
+ // The last block also counts as a segment. This makes the conditionals
+ // on segmentsNeeded work in the rest of the function.
+ segmentsNeeded++;
+ }
}
- iter.Advance(*this, toCopy);
- size -= toCopy;
- // Move segments to result
- auto resultGuard = MakeScopeExit([&] {
- *aSuccess = false;
- result.mSegments.erase(result.mSegments.begin()+1, result.mSegments.end());
- });
-
- size_t movedSize = 0;
- uintptr_t toRemoveStart = iter.mSegment;
- uintptr_t toRemoveEnd = iter.mSegment;
- while (!iter.Done() &&
- !iter.HasRoomFor(size)) {
- if (!result.mSegments.append(Segment(mSegments[iter.mSegment].mData,
- mSegments[iter.mSegment].mSize,
- mSegments[iter.mSegment].mCapacity))) {
- return error;
- }
- movedSize += iter.RemainingInSegment();
- size -= iter.RemainingInSegment();
- toRemoveEnd++;
- iter.Advance(*this, iter.RemainingInSegment());
+ BufferList result(0, 0, mStandardCapacity);
+ if (!result.mSegments.reserve(segmentsNeeded + lastSegmentSize.isSome())) {
+ return failure();
}
- if (size) {
- if (!iter.HasRoomFor(size) ||
- !result.WriteBytes(iter.Data(), size)) {
- return error;
+ // Copy the first segment, it's special because we can't just steal the
+ // entire Segment struct from this->mSegments.
+ size_t firstSegmentSize = std::min(aSize, aIter.RemainingInSegment());
+ if (!result.WriteBytes(aIter.Data(), firstSegmentSize)) {
+ return failure();
+ }
+ aIter.Advance(*this, firstSegmentSize);
+ segmentsNeeded--;
+
+ // The entirety of the request wasn't in the first segment, now copy the
+ // rest.
+ if (segmentsNeeded) {
+ char* finalSegment = nullptr;
+ // Pre-allocate the final segment so that if this fails, we return before
+ // we delete the elements from |this->mSegments|.
+ if (lastSegmentSize.isSome()) {
+ MOZ_RELEASE_ASSERT(mStandardCapacity >= *lastSegmentSize);
+ finalSegment = this->template pod_malloc<char>(mStandardCapacity);
+ if (!finalSegment) {
+ return failure();
+ }
+ }
+
+ size_t copyStart = aIter.mSegment;
+ // Copy segments from this over to the result and remove them from our
+ // storage. Not needed if the only segment we need to copy is the last
+ // partial one.
+ size_t segmentsToCopy = segmentsNeeded - lastSegmentSize.isSome();
+ for (size_t i = 0; i < segmentsToCopy; ++i) {
+ result.mSegments.infallibleAppend(
+ Segment(mSegments[aIter.mSegment].mData,
+ mSegments[aIter.mSegment].mSize,
+ mSegments[aIter.mSegment].mCapacity));
+ aIter.Advance(*this, aIter.RemainingInSegment());
+ }
+ MOZ_RELEASE_ASSERT(aIter.mSegment == copyStart + segmentsToCopy);
+ mSegments.erase(mSegments.begin() + copyStart,
+ mSegments.begin() + copyStart + segmentsToCopy);
+
+ // Reset the iter's position for what we just deleted.
+ aIter.mSegment -= segmentsToCopy;
+
+ if (lastSegmentSize.isSome()) {
+ // We called reserve() on result.mSegments so infallibleAppend is safe.
+ result.mSegments.infallibleAppend(
+ Segment(finalSegment, 0, mStandardCapacity));
+ bool r = result.WriteBytes(aIter.Data(), *lastSegmentSize);
+ MOZ_RELEASE_ASSERT(r);
+ aIter.Advance(*this, *lastSegmentSize);
}
- iter.Advance(*this, size);
}
- mSegments.erase(mSegments.begin() + toRemoveStart, mSegments.begin() + toRemoveEnd);
- mSize -= movedSize;
- aIter.mSegment = iter.mSegment - (toRemoveEnd - toRemoveStart);
- aIter.mData = iter.mData;
- aIter.mDataEnd = iter.mDataEnd;
- MOZ_ASSERT(aIter.mDataEnd == mSegments[aIter.mSegment].End());
+ mSize -= aSize;
result.mSize = aSize;
- resultGuard.release();
*aSuccess = true;
return result;
}
diff --git mfbt/tests/TestBufferList.cpp mfbt/tests/TestBufferList.cpp
index cccaac021b4a7..207fa106f556f 100644
--- mfbt/tests/TestBufferList.cpp
+++ mfbt/tests/TestBufferList.cpp
@@ -245,12 +245,39 @@ int main(void)
BufferList bl3 = bl.Extract(iter, kExtractOverSize, &success);
MOZ_RELEASE_ASSERT(!success);
- MOZ_RELEASE_ASSERT(iter.AdvanceAcrossSegments(bl, kSmallWrite * 3 - kExtractSize - kExtractStart));
- MOZ_RELEASE_ASSERT(iter.Done());
-
iter = bl2.Iter();
MOZ_RELEASE_ASSERT(iter.AdvanceAcrossSegments(bl2, kExtractSize));
MOZ_RELEASE_ASSERT(iter.Done());
+ BufferList bl4(8, 8, 8);
+ bl4.WriteBytes("abcd1234", 8);
+ iter = bl4.Iter();
+ iter.Advance(bl4, 8);
+
+ BufferList bl5 = bl4.Extract(iter, kExtractSize, &success);
+ MOZ_RELEASE_ASSERT(!success);
+
+ BufferList bl6(0, 0, 16);
+ bl6.WriteBytes("abcdefgh12345678", 16);
+ bl6.WriteBytes("ijklmnop87654321", 16);
+ iter = bl6.Iter();
+ iter.Advance(bl6, 8);
+ BufferList bl7 = bl6.Extract(iter, 16, &success);
+ MOZ_RELEASE_ASSERT(success);
+ char data[16];
+ MOZ_RELEASE_ASSERT(bl6.ReadBytes(iter, data, 8));
+ MOZ_RELEASE_ASSERT(memcmp(data, "87654321", 8) == 0);
+ iter = bl7.Iter();
+ MOZ_RELEASE_ASSERT(bl7.ReadBytes(iter, data, 16));
+ MOZ_RELEASE_ASSERT(memcmp(data, "12345678ijklmnop", 16) == 0);
+
+ BufferList bl8(0, 0, 16);
+ bl8.WriteBytes("abcdefgh12345678", 16);
+ iter = bl8.Iter();
+ BufferList bl9 = bl8.Extract(iter, 8, &success);
+ MOZ_RELEASE_ASSERT(success);
+ MOZ_RELEASE_ASSERT(bl9.Size() == 8);
+ MOZ_RELEASE_ASSERT(!iter.Done());
+
return 0;
}

View File

@ -1,31 +0,0 @@
commit 0735c3877cb0
Author: Valentin Gosu <valentin.gosu@gmail.com>
Date: Wed May 2 14:53:13 2018 +0200
Bug 1456975 - Check fields in nsMozIconURI deserialization. r=agaynor
---
image/decoders/icon/nsIconURI.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git image/decoders/icon/nsIconURI.cpp image/decoders/icon/nsIconURI.cpp
index 3c9e07f67f09a..7b4cbd31ecad7 100644
--- image/decoders/icon/nsIconURI.cpp
+++ image/decoders/icon/nsIconURI.cpp
@@ -715,7 +715,17 @@ nsMozIconURI::Deserialize(const URIParams& aParams)
mContentType = params.contentType();
mFileName = params.fileName();
mStockIcon = params.stockIcon();
+
+ if (params.iconSize() < -1 ||
+ params.iconSize() >= (int32_t) ArrayLength(kSizeStrings)) {
+ return false;
+ }
mIconSize = params.iconSize();
+
+ if (params.iconState() < -1 ||
+ params.iconState() >= (int32_t) ArrayLength(kStateStrings)) {
+ return false;
+ }
mIconState = params.iconState();
return true;

View File

@ -1,87 +0,0 @@
commit 0a234825c39a
Author: Nicolas Silva <nsilva@mozilla.com>
Date: Fri Jun 15 14:01:07 2018 -0700
Bug 1464039 - Reject some invalid transforms in qcms. r=mwoodrow, a=RyanVM
--HG--
extra : source : dfcc5301e87235818394a46f80dc1c164c2ca4b3
---
gfx/qcms/chain.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git gfx/qcms/chain.c gfx/qcms/chain.c
index e382fbe001422..2b0e707c443c4 100644
--- gfx/qcms/chain.c
+++ gfx/qcms/chain.c
@@ -972,6 +972,10 @@ static float* qcms_modular_transform_data(struct qcms_modular_transform *transfo
assert(0 && "Unsupported transform module");
return NULL;
}
+ if (transform->grid_size <= 0) {
+ assert(0 && "Invalid transform");
+ return NULL;
+ }
transform->transform_module_fn(transform,src,dest,len);
dest = src;
src = new_src;
commit 223a7e0a67fd
Author: Nicolas Silva <nsilva@mozilla.com>
Date: Tue Jun 19 15:32:29 2018 +0200
Bug 1464039 - Only reject qcms transform with invalid grid size if the transform function uses the grid size. r=Bas, a=jcristau
--HG--
extra : source : 8dde5c1d895e4c063d5bda39029c9a01a178ebba
extra : intermediate-source : a64fb8de655dc28efd0b7de94b6f0008b08ae0ae
---
gfx/qcms/chain.c | 4 +++-
gfx/thebes/gfxPlatform.cpp | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git gfx/qcms/chain.c gfx/qcms/chain.c
index 2b0e707c443c4..dbae183789e79 100644
--- gfx/qcms/chain.c
+++ gfx/qcms/chain.c
@@ -972,7 +972,9 @@ static float* qcms_modular_transform_data(struct qcms_modular_transform *transfo
assert(0 && "Unsupported transform module");
return NULL;
}
- if (transform->grid_size <= 0) {
+ if (transform->grid_size <= 0 &&
+ (transform_fn == qcms_transform_module_clut ||
+ transform_fn == qcms_transform_module_clut_only)) {
assert(0 && "Invalid transform");
return NULL;
}
diff --git gfx/thebes/gfxPlatform.cpp gfx/thebes/gfxPlatform.cpp
index d7c966ea1bcc2..278a609817d9e 100644
--- gfx/thebes/gfxPlatform.cpp
+++ gfx/thebes/gfxPlatform.cpp
@@ -160,6 +160,7 @@ static Mutex* gGfxPlatformPrefsLock = nullptr;
static qcms_profile *gCMSOutputProfile = nullptr;
static qcms_profile *gCMSsRGBProfile = nullptr;
+static bool gCMSRGBTransformFailed = false;
static qcms_transform *gCMSRGBTransform = nullptr;
static qcms_transform *gCMSInverseRGBTransform = nullptr;
static qcms_transform *gCMSRGBATransform = nullptr;
@@ -2068,7 +2069,7 @@ gfxPlatform::GetCMSsRGBProfile()
qcms_transform *
gfxPlatform::GetCMSRGBTransform()
{
- if (!gCMSRGBTransform) {
+ if (!gCMSRGBTransform && !gCMSRGBTransformFailed) {
qcms_profile *inProfile, *outProfile;
outProfile = GetCMSOutputProfile();
inProfile = GetCMSsRGBProfile();
@@ -2079,6 +2080,9 @@ gfxPlatform::GetCMSRGBTransform()
gCMSRGBTransform = qcms_transform_create(inProfile, QCMS_DATA_RGB_8,
outProfile, QCMS_DATA_RGB_8,
QCMS_INTENT_PERCEPTUAL);
+ if (!gCMSRGBTransform) {
+ gCMSRGBTransformFailed = true;
+ }
}
return gCMSRGBTransform;

View File

@ -1,135 +0,0 @@
commit ce24f85311af
Author: Nils Ohlmeier [:drno] <drno@ohlmeier.org>
Date: Wed Jun 13 14:29:20 2018 -0700
Bug 1464063 - Remove sdp_getchoosetok. r=bwc, a=RyanVM
--HG--
extra : source : 87163f9d6bc7670d074512cf96062ea01193ffb2
---
media/webrtc/signaling/src/sdp/sipcc/sdp_private.h | 2 -
media/webrtc/signaling/src/sdp/sipcc/sdp_token.c | 16 ++----
media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c | 63 ----------------------
3 files changed, 5 insertions(+), 76 deletions(-)
diff --git media/webrtc/signaling/src/sdp/sipcc/sdp_private.h media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
index a98f4b119f693..3459b0c0eb48e 100644
--- media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
+++ media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
@@ -347,8 +347,6 @@ extern uint32_t sdp_getnextnumtok(const char *str, const char **str_end,
extern uint32_t sdp_getnextnumtok_or_null(const char *str, const char **str_end,
const char *delim, tinybool *null_ind,
sdp_result_e *result);
-extern tinybool sdp_getchoosetok(const char *str, const char **str_end,
- const char *delim, sdp_result_e *result);
extern
tinybool verify_sdescriptions_mki(char *buf, char *mkiVal, uint16_t *mkiLen);
diff --git media/webrtc/signaling/src/sdp/sipcc/sdp_token.c media/webrtc/signaling/src/sdp/sipcc/sdp_token.c
index b4ad1beee3f70..54c38f08cdac0 100644
--- media/webrtc/signaling/src/sdp/sipcc/sdp_token.c
+++ media/webrtc/signaling/src/sdp/sipcc/sdp_token.c
@@ -1162,15 +1162,11 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, uint16_t level, const char *ptr)
}
port_ptr = port;
for (i=0; i < SDP_MAX_PORT_PARAMS; i++) {
- if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result) == TRUE) {
- num[i] = SDP_CHOOSE_PARAM;
- } else {
- num[i] = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
- "/ \t", &result);
- if (result != SDP_SUCCESS) {
- break;
- }
- }
+ num[i] = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
+ "/ \t", &result);
+ if (result != SDP_SUCCESS) {
+ break;
+ }
num_port_params++;
}
@@ -1401,8 +1397,6 @@ sdp_result_e sdp_parse_media (sdp_t *sdp_p, uint16_t level, const char *ptr)
return (SDP_INVALID_PARAMETER);
}
mca_p->sctp_fmt = SDP_SCTP_MEDIA_FMT_WEBRTC_DATACHANNEL;
- } else if (sdp_getchoosetok(port_ptr, &port_ptr, "/ \t", &result)) {
- sctp_port = SDP_CHOOSE_PARAM;
} else {
sctp_port = sdp_getnextnumtok(port_ptr, (const char **)&port_ptr,
"/ \t", &result);
diff --git media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
index e4f1b2eaf0c75..4d46115574dc9 100644
--- media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
+++ media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c
@@ -432,69 +432,6 @@ uint32_t sdp_getnextnumtok (const char *str, const char **str_end,
}
-/* See if the next token in a string is the choose character. The delim
- * characters are passed in as a param. The check also will not go past
- * a new line char or the end of the string. Skip any delimiters before
- * the token.
- */
-tinybool sdp_getchoosetok (const char *str, const char **str_end,
- const char *delim, sdp_result_e *result)
-{
- const char *b;
- int flag2moveon;
-
- if ((str == NULL) || (str_end == NULL)) {
- *result = SDP_FAILURE;
- return(FALSE);
- }
-
- /* Locate front of token, skipping any delimiters */
- for ( ; ((*str != '\0') && (*str != '\n') && (*str != '\r')); str++) {
- flag2moveon = 1; /* Default to move on unless we find a delimiter */
- for (b=delim; *b; b++) {
- if (*str == *b) {
- flag2moveon = 0;
- break;
- }
- }
- if( flag2moveon ) {
- break; /* We're at the beginning of the token */
- }
- }
-
- /* Make sure there's really a token present. */
- if ((*str == '\0') || (*str == '\n') || (*str == '\r')) {
- *result = SDP_FAILURE;
- *str_end = (char *)str;
- return(FALSE);
- }
-
- /* See if the token is '$' followed by a delimiter char or end of str. */
- if (*str == '$') {
- str++;
- if ((*str == '\0') || (*str == '\n') || (*str == '\r')) {
- *result = SDP_SUCCESS;
- /* skip the choose char in the string. */
- *str_end = (char *)(str+1);
- return(TRUE);
- }
- for (b=delim; *b; b++) {
- if (*str == *b) {
- *result = SDP_SUCCESS;
- /* skip the choose char in the string. */
- *str_end = (char *)(str+1);
- return(TRUE);
- }
- }
- }
-
- /* If the token was not '$' followed by a delim, token is not choose */
- *result = SDP_SUCCESS;
- *str_end = (char *)str;
- return(FALSE);
-
-}
-
/*
* SDP Crypto Utility Functions.
*

View File

@ -0,0 +1,50 @@
commit 6717d9afef42
Author: Jean-Yves Avenard <jyavenard@mozilla.com>
Date: Wed Jun 20 19:24:34 2018 +0000
Bug 1469257 - [H264] Only check for SPS changes on keyframe. r=bryce, a=RyanVM
Some invalid streams contain SPS changes and those appear to only occur on non-keyframe, this cause all frames to be dropped until the next keyframe is found. This result in apparent freezes.
While it is theoretically possible to have SPS changes inband on non-keyframe those should be very rare (I've never seen one). The content would have been invalid anyway in an non-fragmented mp4.
So we now only check for a SPS change on keyframe. This would cause no affect on either windows, android or ffmpeg as those decoders handle format change fine. The mac decoder could however show garbled frames temporarily.
Differential Revision: https://phabricator.services.mozilla.com/D1733
--HG--
extra : source : ddde6ad6d9e6c4069632e195613bcd53a39883e4
---
dom/media/platforms/wrappers/H264Converter.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git dom/media/platforms/wrappers/H264Converter.cpp dom/media/platforms/wrappers/H264Converter.cpp
index 32b1abf179937..5c04c075664c3 100644
--- dom/media/platforms/wrappers/H264Converter.cpp
+++ dom/media/platforms/wrappers/H264Converter.cpp
@@ -392,7 +392,7 @@ MediaResult
H264Converter::CheckForSPSChange(MediaRawData* aSample)
{
RefPtr<MediaByteBuffer> extra_data =
- mp4_demuxer::H264::ExtractExtraData(aSample);
+ aSample->mKeyframe ? mp4_demuxer::H264::ExtractExtraData(aSample) : nullptr;
if (!mp4_demuxer::H264::HasSPS(extra_data)) {
MOZ_ASSERT(mCanRecycleDecoder.isSome());
if (!*mCanRecycleDecoder) {
@@ -406,14 +406,12 @@ H264Converter::CheckForSPSChange(MediaRawData* aSample)
// This scenario can only occur on Android with devices that can recycle a
// decoder.
if (!mp4_demuxer::H264::HasSPS(aSample->mExtraData) ||
- mp4_demuxer::H264::CompareExtraData(aSample->mExtraData,
- mOriginalExtraData)) {
+ mp4_demuxer::H264::CompareExtraData(aSample->mExtraData, mOriginalExtraData)) {
return NS_OK;
}
extra_data = mOriginalExtraData = aSample->mExtraData;
}
- if (mp4_demuxer::H264::CompareExtraData(extra_data,
- mCurrentConfig.mExtraData)) {
+ if (mp4_demuxer::H264::CompareExtraData(extra_data, mCurrentConfig.mExtraData)) {
return NS_OK;
}

View File

@ -0,0 +1,164 @@
commit bb90f9b13b2d
Author: Mats Palmgren <mats@mozilla.com>
Date: Sat Jun 30 01:08:54 2018 +0200
Bug 1470260 part 1 - Ensure that 'this' stays alive for the duration of the TickRefreshDriver call. r=emilio a=lizzard
--HG--
extra : source : 89db79608a7565ead4ceca4db9e2417b1373e41d
---
layout/base/nsRefreshDriver.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git layout/base/nsRefreshDriver.cpp layout/base/nsRefreshDriver.cpp
index 3e468c17ad300..446fcf3f243a8 100644
--- layout/base/nsRefreshDriver.cpp
+++ layout/base/nsRefreshDriver.cpp
@@ -537,6 +537,9 @@ private:
bool NotifyVsync(TimeStamp aVsyncTimestamp) override
{
+ // IMPORTANT: All paths through this method MUST hold a strong ref on
+ // |this| for the duration of the TickRefreshDriver callback.
+
if (!NS_IsMainThread()) {
MOZ_ASSERT(XRE_IsParentProcess());
// Compress vsync notifications such that only 1 may run at a time
@@ -571,6 +574,7 @@ private:
return true;
}
+ RefPtr<RefreshDriverVsyncObserver> kungFuDeathGrip(this);
TickRefreshDriver(aVsyncTimestamp);
}
commit 06c64e041c90
Author: Mats Palmgren <mats@mozilla.com>
Date: Mon Jul 2 19:19:29 2018 +0300
Bug 1470260 part 2 - Make RefreshDriverTimer ref-counted and hold a strong ref on it on the stack when nsRefreshDriver::Tick can be reached. r=emilio a=lizzard
--HG--
extra : rebase_source : 817d92ed5dc53ff45d6d2818ccf8b08538cf397b
---
layout/base/nsRefreshDriver.cpp | 42 ++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git layout/base/nsRefreshDriver.cpp layout/base/nsRefreshDriver.cpp
index 446fcf3f243a8..fd7b268d90d07 100644
--- layout/base/nsRefreshDriver.cpp
+++ layout/base/nsRefreshDriver.cpp
@@ -148,11 +148,7 @@ public:
{
}
- virtual ~RefreshDriverTimer()
- {
- MOZ_ASSERT(mContentRefreshDrivers.Length() == 0, "Should have removed all content refresh drivers from here by now!");
- MOZ_ASSERT(mRootRefreshDrivers.Length() == 0, "Should have removed all root refresh drivers from here by now!");
- }
+ NS_INLINE_DECL_REFCOUNTING(RefreshDriverTimer)
virtual void AddRefreshDriver(nsRefreshDriver* aDriver)
{
@@ -259,6 +255,12 @@ public:
}
protected:
+ virtual ~RefreshDriverTimer()
+ {
+ MOZ_ASSERT(mContentRefreshDrivers.Length() == 0, "Should have removed all content refresh drivers from here by now!");
+ MOZ_ASSERT(mRootRefreshDrivers.Length() == 0, "Should have removed all root refresh drivers from here by now!");
+ }
+
virtual void StartTimer() = 0;
virtual void StopTimer() = 0;
virtual void ScheduleNextTick(TimeStamp aNowTime) = 0;
@@ -336,10 +338,11 @@ protected:
nsTArray<RefPtr<nsRefreshDriver>> mRootRefreshDrivers;
// useful callback for nsITimer-based derived classes, here
- // bacause of c++ protected shenanigans
+ // because of c++ protected shenanigans
static void TimerTick(nsITimer* aTimer, void* aClosure)
{
- RefreshDriverTimer *timer = static_cast<RefreshDriverTimer*>(aClosure);
+ RefPtr<RefreshDriverTimer> timer =
+ static_cast<RefreshDriverTimer*>(aClosure);
timer->Tick();
}
};
@@ -471,9 +474,7 @@ public:
private:
// Since VsyncObservers are refCounted, but the RefreshDriverTimer are
// explicitly shutdown. We create an inner class that has the VsyncObserver
- // and is shutdown when the RefreshDriverTimer is deleted. The alternative is
- // to (a) make all RefreshDriverTimer RefCounted or (b) use different
- // VsyncObserver types.
+ // and is shutdown when the RefreshDriverTimer is deleted.
class RefreshDriverVsyncObserver final : public VsyncObserver
{
public:
@@ -674,7 +675,9 @@ private:
// the scheduled TickRefreshDriver() runs. Check mVsyncRefreshDriverTimer
// before use.
if (mVsyncRefreshDriverTimer) {
- mVsyncRefreshDriverTimer->RunRefreshDrivers(aVsyncTimestamp);
+ RefPtr<VsyncRefreshDriverTimer> timer = mVsyncRefreshDriverTimer;
+ timer->RunRefreshDrivers(aVsyncTimestamp);
+ // Note: mVsyncRefreshDriverTimer might be null now.
}
if (!XRE_IsParentProcess()) {
@@ -956,7 +959,8 @@ protected:
static void TimerTickOne(nsITimer* aTimer, void* aClosure)
{
- InactiveRefreshDriverTimer *timer = static_cast<InactiveRefreshDriverTimer*>(aClosure);
+ RefPtr<InactiveRefreshDriverTimer> timer =
+ static_cast<InactiveRefreshDriverTimer*>(aClosure);
timer->TickOne();
}
@@ -967,8 +971,8 @@ protected:
} // namespace mozilla
-static RefreshDriverTimer* sRegularRateTimer;
-static InactiveRefreshDriverTimer* sThrottledRateTimer;
+static StaticRefPtr<RefreshDriverTimer> sRegularRateTimer;
+static StaticRefPtr<InactiveRefreshDriverTimer> sThrottledRateTimer;
static void
CreateContentVsyncRefreshTimer(void*)
@@ -1042,9 +1046,6 @@ GetFirstFrameDelay(imgIRequest* req)
nsRefreshDriver::Shutdown()
{
// clean up our timers
- delete sRegularRateTimer;
- delete sThrottledRateTimer;
-
sRegularRateTimer = nullptr;
sThrottledRateTimer = nullptr;
}
@@ -2292,16 +2293,15 @@ nsRefreshDriver::PVsyncActorCreated(VsyncChild* aVsyncChild)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!XRE_IsParentProcess());
- auto* vsyncRefreshDriverTimer =
- new VsyncRefreshDriverTimer(aVsyncChild);
+ RefPtr<RefreshDriverTimer> vsyncRefreshDriverTimer =
+ new VsyncRefreshDriverTimer(aVsyncChild);
// If we are using software timer, swap current timer to
// VsyncRefreshDriverTimer.
if (sRegularRateTimer) {
sRegularRateTimer->SwapRefreshDrivers(vsyncRefreshDriverTimer);
- delete sRegularRateTimer;
}
- sRegularRateTimer = vsyncRefreshDriverTimer;
+ sRegularRateTimer = vsyncRefreshDriverTimer.forget();
}
void