#500: M1458270 M1452576 M1459162 M1450688 M1456975 M1459693 M1464784

This commit is contained in:
Cameron Kaiser 2018-06-14 20:09:00 -07:00
parent e2a5d0b4cb
commit 14a6deb011
10 changed files with 76 additions and 29 deletions

View File

@ -968,9 +968,9 @@ StructuredCloneHolder::CustomReadHandler(JSContext* aCx,
return ReadFormData(aCx, aReader, aIndex, this);
}
if (aTag == SCTAG_DOM_IMAGEBITMAP) {
MOZ_ASSERT(mSupportedContext == SameProcessSameThread ||
mSupportedContext == SameProcessDifferentThread);
if (aTag == SCTAG_DOM_IMAGEBITMAP &&
(mSupportedContext == SameProcessSameThread ||
mSupportedContext == SameProcessDifferentThread)) {
// Get the current global object.
// This can be null.
@ -1067,9 +1067,9 @@ StructuredCloneHolder::CustomReadTransferHandler(JSContext* aCx,
return true;
}
if (aTag == SCTAG_DOM_CANVAS) {
MOZ_ASSERT(mSupportedContext == SameProcessSameThread ||
mSupportedContext == SameProcessDifferentThread);
if (aTag == SCTAG_DOM_CANVAS &&
(mSupportedContext == SameProcessSameThread ||
mSupportedContext == SameProcessDifferentThread)) {
MOZ_ASSERT(aContent);
OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent);
@ -1155,9 +1155,9 @@ StructuredCloneHolder::CustomFreeTransferHandler(uint32_t aTag,
return;
}
if (aTag == SCTAG_DOM_CANVAS) {
MOZ_ASSERT(mSupportedContext == SameProcessSameThread ||
mSupportedContext == SameProcessDifferentThread);
if (aTag == SCTAG_DOM_CANVAS &&
(mSupportedContext == SameProcessSameThread ||
mSupportedContext == SameProcessDifferentThread)) {
MOZ_ASSERT(aContent);
OffscreenCanvasCloneData* data =
static_cast<OffscreenCanvasCloneData*>(aContent);

View File

@ -1756,8 +1756,8 @@ nsINode::Before(const Sequence<OwningNodeOrString>& aNodes,
nsCOMPtr<nsINode> viablePreviousSibling =
FindViablePreviousSibling(*this, aNodes);
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1779,8 +1779,8 @@ nsINode::After(const Sequence<OwningNodeOrString>& aNodes,
nsCOMPtr<nsINode> viableNextSibling = FindViableNextSibling(*this, aNodes);
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1799,8 +1799,8 @@ nsINode::ReplaceWith(const Sequence<OwningNodeOrString>& aNodes,
nsCOMPtr<nsINode> viableNextSibling = FindViableNextSibling(*this, aNodes);
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1859,8 +1859,8 @@ void
nsINode::Prepend(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv)
{
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}
@ -1873,8 +1873,8 @@ void
nsINode::Append(const Sequence<OwningNodeOrString>& aNodes,
ErrorResult& aRv)
{
nsCOMPtr<nsINode> node =
ConvertNodesOrStringsIntoNode(aNodes, OwnerDoc(), aRv);
nsCOMPtr<nsIDocument> doc = OwnerDoc();
nsCOMPtr<nsINode> node = ConvertNodesOrStringsIntoNode(aNodes, doc, aRv);
if (aRv.Failed()) {
return;
}

View File

@ -1515,8 +1515,6 @@ CanvasRenderingContext2D::GetHeight() const
NS_IMETHODIMP
CanvasRenderingContext2D::SetDimensions(int32_t width, int32_t height)
{
ClearTarget();
// Zero sized surfaces can cause problems.
mZero = false;
if (height == 0) {
@ -1527,14 +1525,14 @@ CanvasRenderingContext2D::SetDimensions(int32_t width, int32_t height)
width = 1;
mZero = true;
}
mWidth = width;
mHeight = height;
ClearTarget(width, height);
return NS_OK;
}
void
CanvasRenderingContext2D::ClearTarget()
CanvasRenderingContext2D::ClearTarget(int32_t aWidth, int32_t aHeight)
{
Reset();
@ -1553,6 +1551,12 @@ CanvasRenderingContext2D::ClearTarget()
state->colorStyles[Style::STROKE] = NS_RGB(0,0,0);
state->shadowColor = NS_RGBA(0,0,0,0);
// Update dimensions only if new (strictly positive) values were passed.
if (aWidth > 0 && aHeight > 0) {
mWidth = aWidth;
mHeight = aHeight;
}
// For vertical writing-mode, unless text-orientation is sideways,
// we'll modify the initial value of textBaseline to 'middle'.
RefPtr<nsStyleContext> canvasStyle;

View File

@ -649,8 +649,11 @@ protected:
/**
* Disposes an old target and prepares to lazily create a new target.
*
* Parameters are the new dimensions to be used, or if either is negative,
* existing dimensions will be left unchanged.
*/
void ClearTarget();
void ClearTarget(int32_t aWidth = -1, int32_t aHeight = -1);
/*
* Returns the target to the buffer provider. i.e. this will queue a frame for

View File

@ -2918,7 +2918,8 @@ HTMLInputElement::Focus(ErrorResult& aError)
nsNumberControlFrame* numberControlFrame =
do_QueryFrame(GetPrimaryFrame());
if (numberControlFrame) {
HTMLInputElement* textControl = numberControlFrame->GetAnonTextControl();
RefPtr<HTMLInputElement> textControl =
numberControlFrame->GetAnonTextControl();
if (textControl) {
textControl->Focus(aError);
return;

View File

@ -977,7 +977,17 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
NS_ENSURE_TRUE(xblScope, NS_ERROR_UNEXPECTED);
JS::Rooted<JSObject*> parent_proto(cx);
if (!JS_GetPrototype(cx, obj, &parent_proto)) {
{
JS::RootedObject wrapped(cx, obj);
JSAutoCompartment ac(cx, xblScope);
if (!JS_WrapObject(cx, &wrapped)) {
return NS_ERROR_FAILURE;
}
if (!JS_GetPrototype(cx, wrapped, &parent_proto)) {
return NS_ERROR_FAILURE;
}
}
if (!JS_WrapObject(cx, &parent_proto)) {
return NS_ERROR_FAILURE;
}

View File

@ -643,7 +643,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

@ -45,6 +45,7 @@ using mozilla::MutexAutoLock;
nsTArray<GfxDriverInfo>* GfxInfoBase::mDriverInfo;
bool GfxInfoBase::mDriverInfoObserverInitialized;
bool GfxInfoBase::mShutdownOccurred;
// Observes for shutdown so that the child GfxDriverInfo list is freed.
class ShutdownObserver : public nsIObserver
@ -64,11 +65,17 @@ public:
delete GfxInfoBase::mDriverInfo;
GfxInfoBase::mDriverInfo = nullptr;
for (uint32_t i = 0; i < DeviceFamilyMax; i++)
for (uint32_t i = 0; i < DeviceFamilyMax; i++) {
delete GfxDriverInfo::mDeviceFamilies[i];
GfxDriverInfo::mDeviceFamilies[i] = nullptr;
}
for (uint32_t i = 0; i < DeviceVendorMax; i++)
for (uint32_t i = 0; i < DeviceVendorMax; i++) {
delete GfxDriverInfo::mDeviceVendors[i];
GfxDriverInfo::mDeviceVendors[i] = nullptr;
}
GfxInfoBase::mShutdownOccurred = true;
return NS_OK;
}
@ -911,6 +918,13 @@ GfxInfoBase::GetFeatureStatusImpl(int32_t aFeature,
return NS_OK;
}
if (mShutdownOccurred) {
// This is futile; we've already commenced shutdown and our blocklists have
// been deleted. We may want to look into resurrecting the blocklist instead
// but for now, just don't even go there.
return NS_OK;
}
// Shortcut this logic for TenFourFox: we don't support *anything*
// right now.
*aStatus = nsIGfxInfo::FEATURE_BLOCKED_OS_VERSION;

View File

@ -72,6 +72,7 @@ public:
static nsTArray<GfxDriverInfo>* mDriverInfo;
static bool mDriverInfoObserverInitialized;
static bool mShutdownOccurred;
virtual nsString Model() { return EmptyString(); }
virtual nsString Hardware() { return EmptyString(); }

View File

@ -336,6 +336,10 @@ GfxInfo::GetFeatureStatusImpl(int32_t aFeature,
if (aOS)
*aOS = os;
if (mShutdownOccurred) {
return NS_OK;
}
// Don't evaluate special cases when we're evaluating the downloaded blocklist.
if (!aDriverInfo.Length()) {
if (aFeature == nsIGfxInfo::FEATURE_WEBGL_MSAA) {