diff --git a/dom/media/VideoFrameContainer.cpp b/dom/media/VideoFrameContainer.cpp index 9b4237512f..e482c50bb3 100644 --- a/dom/media/VideoFrameContainer.cpp +++ b/dom/media/VideoFrameContainer.cpp @@ -225,19 +225,13 @@ void VideoFrameContainer::SetCurrentFramesLocked(const gfx::IntSize& aIntrinsicS nsTArray oldImages; mImageContainer->GetCurrentImages(&oldImages); - ImageContainer::FrameID lastFrameIDForOldPrincipalHandle = - mFrameIDForPendingPrincipalHandle - 1; if (mPendingPrincipalHandle != PRINCIPAL_HANDLE_NONE && - ((!oldImages.IsEmpty() && - oldImages.LastElement().mFrameID >= lastFrameIDForOldPrincipalHandle) || - (!aImages.IsEmpty() && - aImages[0].mFrameID > lastFrameIDForOldPrincipalHandle))) { - // We are releasing the last FrameID prior to `lastFrameIDForOldPrincipalHandle` - // OR - // there are no FrameIDs prior to `lastFrameIDForOldPrincipalHandle` in the new - // set of images. - // This means that the old principal handle has been flushed out and we can - // notify our video element about this change. + (aImages.IsEmpty() || + aImages[0].mFrameID >= mFrameIDForPendingPrincipalHandle)) { + // There are no FrameIDs prior to `mFrameIDForPendingPrincipalHandle` + // in the new set of images. + // This means that the old principal handle has been flushed out and we + // can notify our video element about this change. RefPtr self = this; PrincipalHandle principalHandle = mPendingPrincipalHandle; mLastPrincipalHandle = mPendingPrincipalHandle; diff --git a/gfx/thebes/gfxUserFontSet.h b/gfx/thebes/gfxUserFontSet.h index 3a13573ac2..2570bd7119 100644 --- a/gfx/thebes/gfxUserFontSet.h +++ b/gfx/thebes/gfxUserFontSet.h @@ -191,14 +191,23 @@ public: FLAG_FORMAT_WOFF = 1 << 6, FLAG_FORMAT_WOFF2 = 1 << 7, + FLAG_FORMAT_OPENTYPE_VARIATIONS = 1 << 8, + FLAG_FORMAT_TRUETYPE_VARIATIONS = 1 << 9, + FLAG_FORMAT_WOFF_VARIATIONS = 1 << 10, + FLAG_FORMAT_WOFF2_VARIATIONS = 1 << 11, + // the common formats that we support everywhere FLAG_FORMATS_COMMON = FLAG_FORMAT_OPENTYPE | FLAG_FORMAT_TRUETYPE | FLAG_FORMAT_WOFF | - FLAG_FORMAT_WOFF2, + FLAG_FORMAT_WOFF2 | + FLAG_FORMAT_OPENTYPE_VARIATIONS | + FLAG_FORMAT_TRUETYPE_VARIATIONS | + FLAG_FORMAT_WOFF_VARIATIONS | + FLAG_FORMAT_WOFF2_VARIATIONS, // mask of all unused bits, update when adding new formats - FLAG_FORMAT_NOT_USED = ~((1 << 8)-1) + FLAG_FORMAT_NOT_USED = ~((1 << 12)-1) }; diff --git a/layout/inspector/nsFontFace.cpp b/layout/inspector/nsFontFace.cpp index abf9f6439c..03ac0d583f 100644 --- a/layout/inspector/nsFontFace.cpp +++ b/layout/inspector/nsFontFace.cpp @@ -178,6 +178,18 @@ nsFontFace::GetFormat(nsAString & aFormat) if (formatFlags & gfxUserFontSet::FLAG_FORMAT_WOFF2) { AppendToFormat(aFormat, "woff2"); } + if (formatFlags & gfxUserFontSet::FLAG_FORMAT_OPENTYPE_VARIATIONS) { + AppendToFormat(aFormat, "opentype-variations"); + } + if (formatFlags & gfxUserFontSet::FLAG_FORMAT_TRUETYPE_VARIATIONS) { + AppendToFormat(aFormat, "truetype-variations"); + } + if (formatFlags & gfxUserFontSet::FLAG_FORMAT_WOFF_VARIATIONS) { + AppendToFormat(aFormat, "woff-variations"); + } + if (formatFlags & gfxUserFontSet::FLAG_FORMAT_WOFF2_VARIATIONS) { + AppendToFormat(aFormat, "woff2-variations"); + } } return NS_OK; } diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 81e6250ec7..54dc570a91 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -1132,6 +1132,15 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName, face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_EOT; } else if (valueString.LowerCaseEqualsASCII("svg")) { face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_SVG; + } else if (valueString.LowerCaseEqualsASCII("woff-variations")) { + face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF_VARIATIONS; + } else if (Preferences::GetBool(GFX_PREF_WOFF2_ENABLED) && + valueString.LowerCaseEqualsASCII("woff2-variations")) { + face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF2_VARIATIONS; + } else if (valueString.LowerCaseEqualsASCII("opentype-variations")) { + face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_OPENTYPE_VARIATIONS; + } else if (valueString.LowerCaseEqualsASCII("truetype-variations")) { + face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_TRUETYPE_VARIATIONS; } else { // unknown format specified, mark to distinguish from the // case where no format hints are specified diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.cpp b/netwerk/streamconv/converters/nsMultiMixedConv.cpp index 44a0dfd705..797f19029a 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp +++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp @@ -644,6 +644,7 @@ nsMultiMixedConv::OnDataAvailable(nsIRequest *request, nsISupports *context, mContentType.Truncate(); mContentLength = UINT64_MAX; mContentDisposition.Truncate(); + mContentSecurityPolicy.Truncate(); mIsByteRangeRequest = false; mByteRangeStart = 0; mByteRangeEnd = 0; @@ -715,6 +716,18 @@ nsMultiMixedConv::OnStartRequest(nsIRequest *request, nsISupports *ctxt) { if (NS_FAILED(rv)) { return rv; } + nsCString csp; + rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-security-policy"), + csp); + if (NS_SUCCEEDED(rv)) { + mRootContentSecurityPolicy = csp; + } + nsCString contentDisposition; + rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("content-disposition"), + contentDisposition); + if (NS_SUCCEEDED(rv)) { + mRootContentDisposition = contentDisposition; + } } else { // try asking the channel directly rv = channel->GetContentType(delimiter); @@ -875,7 +888,12 @@ nsMultiMixedConv::SendStart(nsIChannel *aChannel) { rv = mPartChannel->SetContentLength(mContentLength); if (NS_FAILED(rv)) return rv; - mPartChannel->SetContentDisposition(mContentDisposition); + // Adopt content-disposition from the root doc, if present. + if (!mRootContentDisposition.IsEmpty()) { + mPartChannel->SetContentDisposition(mRootContentDisposition); + } else { + mPartChannel->SetContentDisposition(mContentDisposition); + } nsLoadFlags loadFlags = 0; mPartChannel->GetLoadFlags(&loadFlags); @@ -1062,6 +1080,28 @@ nsMultiMixedConv::ParseHeaders(nsIChannel *aChannel, char *&aPtr, mIsByteRangeRequest = true; if (mContentLength == UINT64_MAX) mContentLength = uint64_t(mByteRangeEnd - mByteRangeStart + 1); + } else if (headerStr.LowerCaseEqualsLiteral("content-security-policy")) { + mContentSecurityPolicy = headerVal; + nsCOMPtr httpChannel = do_QueryInterface(aChannel); + if (httpChannel) { + nsCString resultCSP = mRootContentSecurityPolicy; + if (!mContentSecurityPolicy.IsEmpty()) { + // We are updating the root channel CSP header respectively for + // each part as: CSP-root + CSP-partN, where N is the part number. + // Here we append current part's CSP to root CSP and reset CSP + // header for each part. + if (!resultCSP.IsEmpty()) { + resultCSP.Append(";"); + } + resultCSP.Append(mContentSecurityPolicy); + } + nsresult rv = httpChannel->SetResponseHeader( + NS_LITERAL_CSTRING("Content-Security-Policy"), + resultCSP, false); + if (NS_FAILED(rv)) { + return NS_ERROR_CORRUPTED_CONTENT; + } + } } } *newLine = tmpChar; diff --git a/netwerk/streamconv/converters/nsMultiMixedConv.h b/netwerk/streamconv/converters/nsMultiMixedConv.h index fa058b0720..6944f957ad 100644 --- a/netwerk/streamconv/converters/nsMultiMixedConv.h +++ b/netwerk/streamconv/converters/nsMultiMixedConv.h @@ -96,7 +96,7 @@ protected: // main stream and sending them off the destination stream listener, than doing any real // stream parsing/converting. // -// WARNING: This converter requires that it's destination stream listener be able to handle +// WARNING: This converter requires that its destination stream listener be able to handle // multiple OnStartRequest(), OnDataAvailable(), and OnStopRequest() call combinations. // Each series represents the beginning, data production, and ending phase of each sub- // part of the original stream. @@ -156,6 +156,9 @@ protected: nsCOMPtr mContext; nsCString mContentType; nsCString mContentDisposition; + nsCString mContentSecurityPolicy; + nsCString mRootContentSecurityPolicy; + nsCString mRootContentDisposition; uint64_t mContentLength; char *mBuffer;