diff options
author | Moonchild <moonchild@palemoon.org> | 2020-10-01 11:37:38 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-10-01 11:37:38 +0000 |
commit | 63a0006985036b062eed7e9e83324581d8ab247c (patch) | |
tree | f8a7796c662ac4fce03e94e7aff0d3d9ad768684 | |
parent | af6a8637f56dc2774690a3d92f9df772257ca82d (diff) | |
parent | e50094ab02604892ad619abb0e3d1c7c674e43cf (diff) | |
download | uxp-63a0006985036b062eed7e9e83324581d8ab247c.tar.gz |
Merge branch 'redwood' into releaseRELBASE_20201001
-rw-r--r-- | dom/base/ResizeObserverController.cpp | 12 | ||||
-rw-r--r-- | layout/inspector/inDOMUtils.cpp | 2 | ||||
-rw-r--r-- | layout/style/nsCSSParser.cpp | 12 |
3 files changed, 17 insertions, 9 deletions
diff --git a/dom/base/ResizeObserverController.cpp b/dom/base/ResizeObserverController.cpp index 349cb66baf..d4166155e7 100644 --- a/dom/base/ResizeObserverController.cpp +++ b/dom/base/ResizeObserverController.cpp @@ -119,6 +119,10 @@ ResizeObserverController::Notify() return; } + // Hold a strong reference to the document, because otherwise calling + // all active observers on it might yank it out from under us. + RefPtr<nsIDocument> document(mDocument); + uint32_t shallowestTargetDepth = 0; GatherAllActiveObservations(shallowestTargetDepth); @@ -153,7 +157,7 @@ ResizeObserverController::Notify() nsEventStatus status = nsEventStatus_eIgnore; nsCOMPtr<nsPIDOMWindowInner> window = - mDocument->GetWindow()->GetCurrentInnerWindow(); + document->GetWindow()->GetCurrentInnerWindow(); if (window) { nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window); @@ -185,7 +189,11 @@ ResizeObserverController::BroadcastAllActiveObservations() { uint32_t shallowestTargetDepth = UINT32_MAX; - for (auto observer : mResizeObservers) { + // Use a copy of the observers as this invokes the callbacks of the observers + // which could register/unregister observers at will. + nsTArray<RefPtr<ResizeObserver>> tempObservers(mResizeObservers); + + for (auto observer : tempObservers) { uint32_t targetDepth = observer->BroadcastActiveObservations(); diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index 2095fb7751..b53cb66e3f 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -846,7 +846,7 @@ PropertySupportsVariant(nsCSSPropertyID aPropertyID, uint32_t aVariant) case eCSSProperty_grid_row_end: case eCSSProperty_font_weight: case eCSSProperty_initial_letter: - supported = VARIANT_NUMBER | VARIANT_OPACITY; + supported = VARIANT_NUMBER; break; default: diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 1525c5f9ab..a8ed488949 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1300,7 +1300,7 @@ protected: } bool ParseNonNegativeNumber(nsCSSValue& aValue) { - return ParseSingleTokenNonNegativeVariant(aValue, VARIANT_NUMBER | VARIANT_OPACITY, nullptr); + return ParseSingleTokenNonNegativeVariant(aValue, VARIANT_NUMBER, nullptr); } // Helpers for some common ParseSingleTokenOneOrLargerVariant calls. @@ -1310,7 +1310,7 @@ protected: } bool ParseOneOrLargerNumber(nsCSSValue& aValue) { - return ParseSingleTokenOneOrLargerVariant(aValue, VARIANT_NUMBER | VARIANT_OPACITY, nullptr); + return ParseSingleTokenOneOrLargerVariant(aValue, VARIANT_NUMBER, nullptr); } // http://dev.w3.org/csswg/css-values/#custom-idents @@ -8484,7 +8484,7 @@ CSSParserImpl::ParseImageRect(nsCSSValue& aImage) break; } - static const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT | VARIANT_OPACITY; + static const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT; if (!ParseSingleTokenNonNegativeVariant(top, VARIANT_SIDE, nullptr) || !ExpectSymbol(',', true) || !ParseSingleTokenNonNegativeVariant(right, VARIANT_SIDE, nullptr) || @@ -10893,7 +10893,7 @@ CSSParserImpl::ParseWebkitGradientColorStop(nsCSSValueGradient* aGradient) if (mToken.mIdent.LowerCaseEqualsLiteral("color-stop")) { // Parse stop location, followed by comma. if (!ParseSingleTokenVariant(stop->mLocation, - VARIANT_NUMBER | VARIANT_PERCENT | VARIANT_OPACITY, + VARIANT_NUMBER | VARIANT_PERCENT, nullptr) || !ExpectSymbol(',', true)) { SkipUntil(')'); // Skip to end of color-stop(...) expression. @@ -16056,7 +16056,7 @@ static bool GetFunctionParseInformation(nsCSSKeyword aToken, {VARIANT_LBCALC, VARIANT_LBCALC, VARIANT_LBCALC}, {VARIANT_ANGLE_OR_ZERO}, {VARIANT_ANGLE_OR_ZERO, VARIANT_ANGLE_OR_ZERO}, - {VARIANT_NUMBER|VARIANT_OPACITY}, + {VARIANT_NUMBER}, {VARIANT_LENGTH|VARIANT_NONNEGATIVE_DIMENSION}, {VARIANT_LB|VARIANT_NONNEGATIVE_DIMENSION}, {VARIANT_NUMBER, VARIANT_NUMBER}, @@ -17638,7 +17638,7 @@ CSSParserImpl::ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSPropertyID aPropID nsCSSKeywords::LookupKeyword(mToken.mIdent) == eCSSKeyword_repeat) { nsCSSValue lengthValue; if (ParseNonNegativeVariant(lengthValue, - VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_OPACITY | VARIANT_CALC, + VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_CALC, nullptr) != CSSParseResult::Ok) { REPORT_UNEXPECTED(PEExpectedNonnegativeNP); SkipUntil(')'); |