From b518af4d45314f3ec33810a26343329333b0cbf4 Mon Sep 17 00:00:00 2001 From: Martok Date: Mon, 8 Apr 2024 08:43:23 +0200 Subject: [PATCH 1/6] [DOM] Simplify WorkerRunnable sanity checks and make them more readable. --- dom/workers/WorkerRunnable.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index eb56650b51..9049878710 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -231,8 +231,13 @@ WorkerRunnable::Run() { bool targetIsWorkerThread = mBehavior == WorkerThreadModifyBusyCount || mBehavior == WorkerThreadUnchangedBusyCount; + bool alreadyCanceled = IsCanceled() && !mCallingCancelWithinRun; + bool shouldCancelWorker = targetIsWorkerThread && + mWorkerPrivate->AllPendingRunnablesShouldBeCanceled() && + !IsCanceled() && !mCallingCancelWithinRun; + bool runnableWillRun = !alreadyCanceled && !shouldCancelWorker; - if (targetIsWorkerThread) { + if (targetIsWorkerThread && runnableWillRun) { // On a worker thread, a WorkerRunnable should only run when there is an // underlying WorkerThreadPrimaryRunnable active, which means we should // find a CycleCollectedJSContext. @@ -256,14 +261,11 @@ WorkerRunnable::Run() } #endif - if (IsCanceled() && !mCallingCancelWithinRun) { + if (alreadyCanceled) { return NS_OK; } - if (targetIsWorkerThread && - mWorkerPrivate->AllPendingRunnablesShouldBeCanceled() && - !IsCanceled() && !mCallingCancelWithinRun) { - + if (shouldCancelWorker) { // Prevent recursion. mCallingCancelWithinRun = true; From 1e73f1f2d2e12269c97a98e95e14f520e441e9cb Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 29 Mar 2024 20:30:13 +0800 Subject: [PATCH 2/6] Issue #2477 - Part 1: Implement a separate function for parsing pair box properties This reuses existing logic from ParseGap. --- layout/style/nsCSSParser.cpp | 46 +++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 494d8f6aa6..f5966c0c14 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1188,6 +1188,7 @@ protected: // Reused utility parsing routines void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue); bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]); + bool ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd); bool ParseGroupedBoxProperty(int32_t aVariantMask, nsCSSValue& aValue, uint32_t aRestrictions); @@ -10107,25 +10108,8 @@ CSSParserImpl::ParseGridArea() bool CSSParserImpl::ParseGap() { - nsCSSValue first; - if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) { - AppendValue(eCSSProperty_row_gap, first); - AppendValue(eCSSProperty_column_gap, first); - return true; - } - if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) != - CSSParseResult::Ok) { - return false; - } - nsCSSValue second; - auto result = ParseNonNegativeVariant(second, VARIANT_LPCALC, nullptr); - if (result == CSSParseResult::Error) { - return false; - } - AppendValue(eCSSProperty_row_gap, first); - AppendValue(eCSSProperty_column_gap, - result == CSSParseResult::NotFound ? first : second); - return true; + return ParseBoxPairProperties(eCSSProperty_row_gap, + eCSSProperty_column_gap); } // normal | [ ?] @@ -11448,6 +11432,30 @@ CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[]) return true; } +bool +CSSParserImpl::ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd) +{ + nsCSSValue first; + if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) { + AppendValue(aStart, first); + AppendValue(aEnd, first); + return true; + } + if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) != + CSSParseResult::Ok) { + return false; + } + nsCSSValue second; + auto result = ParseNonNegativeVariant(second, VARIANT_LPCALC, nullptr); + if (result == CSSParseResult::Error) { + return false; + } + AppendValue(aStart, first); + AppendValue(aEnd, + result == CSSParseResult::NotFound ? first : second); + return true; +} + // Similar to ParseBoxProperties, except there is only one property // with the result as its value, not four. bool From bfe76f65db036bc0d04245915c96f445f5e84372 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 29 Mar 2024 20:34:58 +0800 Subject: [PATCH 3/6] Issue #2477 - Part 2: Implement shorthand properties for [margin/padding][block/inline] --- layout/style/Declaration.cpp | 4 ++ layout/style/nsCSSParser.cpp | 40 ++++++++++++++++ layout/style/nsCSSPropList.h | 26 +++++++++++ layout/style/nsCSSProps.cpp | 23 +++++++++ layout/style/test/property_database.js | 64 ++++++++++++++++++++++++++ 5 files changed, 157 insertions(+) diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index ab2def15fa..989e45765c 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -1474,6 +1474,10 @@ Declaration::GetPropertyValueInternal( } MOZ_FALLTHROUGH; } + case eCSSProperty_margin_block: + case eCSSProperty_margin_inline: + case eCSSProperty_padding_block: + case eCSSProperty_padding_inline: case eCSSProperty_gap: { const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index f5966c0c14..9b1274763b 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1084,12 +1084,16 @@ protected: bool ParseListStyle(); bool ParseListStyleType(nsCSSValue& aValue); bool ParseMargin(); + bool ParseMarginBlock(); + bool ParseMarginInline(); bool ParseClipPath(nsCSSValue& aValue); bool ParseTransform(bool aIsPrefixed, bool aDisallowRelativeValues = false); bool ParseObjectPosition(); bool ParseOutline(); bool ParseOverflow(); bool ParsePadding(); + bool ParsePaddingBlock(); + bool ParsePaddingInline(); bool ParseQuotes(); bool ParseTextAlign(nsCSSValue& aValue, const KTableEntry aTable[]); @@ -12053,6 +12057,10 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID) return ParseListStyle(); case eCSSProperty_margin: return ParseMargin(); + case eCSSProperty_margin_block: + return ParseMarginBlock(); + case eCSSProperty_margin_inline: + return ParseMarginInline(); case eCSSProperty_object_position: return ParseObjectPosition(); case eCSSProperty_outline: @@ -12061,6 +12069,10 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID) return ParseOverflow(); case eCSSProperty_padding: return ParsePadding(); + case eCSSProperty_padding_block: + return ParsePaddingBlock(); + case eCSSProperty_padding_inline: + return ParsePaddingInline(); case eCSSProperty_quotes: return ParseQuotes(); case eCSSProperty_text_decoration: @@ -15511,6 +15523,20 @@ CSSParserImpl::ParseMargin() return ParseBoxProperties(kMarginSideIDs); } +bool +CSSParserImpl::ParseMarginBlock() +{ + return ParseBoxPairProperties(eCSSProperty_margin_block_start, + eCSSProperty_margin_block_end); +} + +bool +CSSParserImpl::ParseMarginInline() +{ + return ParseBoxPairProperties(eCSSProperty_margin_inline_start, + eCSSProperty_margin_inline_end); +} + bool CSSParserImpl::ParseObjectPosition() { @@ -15597,6 +15623,20 @@ CSSParserImpl::ParsePadding() return ParseBoxProperties(kPaddingSideIDs); } +bool +CSSParserImpl::ParsePaddingBlock() +{ + return ParseBoxPairProperties(eCSSProperty_padding_block_start, + eCSSProperty_padding_block_end); +} + +bool +CSSParserImpl::ParsePaddingInline() +{ + return ParseBoxPairProperties(eCSSProperty_padding_inline_start, + eCSSProperty_padding_inline_end); +} + bool CSSParserImpl::ParseQuotes() { diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 0694817515..cb8c7b73a7 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2494,6 +2494,13 @@ CSS_PROP_SHORTHAND( CSS_PROPERTY_UNITLESS_LENGTH_QUIRK | CSS_PROPERTY_APPLIES_TO_PAGE_RULE, "") +CSS_PROP_SHORTHAND( + margin-block, + margin_block, + MarginBlock, + CSS_PROPERTY_PARSE_FUNCTION | + CSS_PROPERTY_APPLIES_TO_PAGE_RULE, + "") CSS_PROP_LOGICAL( margin-block-end, margin_block_end, @@ -2546,6 +2553,13 @@ CSS_PROP_MARGIN( nullptr, offsetof(nsStyleMargin, mMargin), eStyleAnimType_Sides_Bottom) +CSS_PROP_SHORTHAND( + margin-inline, + margin_inline, + MarginInline, + CSS_PROPERTY_PARSE_FUNCTION | + CSS_PROPERTY_APPLIES_TO_PAGE_RULE, + "") CSS_PROP_LOGICAL( margin-inline-end, margin_inline_end, @@ -3245,6 +3259,12 @@ CSS_PROP_SHORTHAND( CSS_PROPERTY_PARSE_FUNCTION | CSS_PROPERTY_UNITLESS_LENGTH_QUIRK, "") +CSS_PROP_SHORTHAND( + padding-block, + padding_block, + PaddingBlock, + CSS_PROPERTY_PARSE_FUNCTION, + "") CSS_PROP_LOGICAL( padding-block-end, padding_block_end, @@ -3303,6 +3323,12 @@ CSS_PROP_PADDING( nullptr, offsetof(nsStylePadding, mPadding), eStyleAnimType_Sides_Bottom) +CSS_PROP_SHORTHAND( + padding-inline, + padding_inline, + PaddingInline, + CSS_PROPERTY_PARSE_FUNCTION, + "") CSS_PROP_LOGICAL( padding-inline-end, padding_inline_end, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 0f3a1daeda..7f1fe2c18f 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2927,6 +2927,17 @@ static const nsCSSPropertyID gMarginSubpropTable[] = { eCSSProperty_UNKNOWN }; +static const nsCSSPropertyID gMarginBlockSubpropTable[] = { + eCSSProperty_margin_block_start, + eCSSProperty_margin_block_end, + eCSSProperty_UNKNOWN +}; + +static const nsCSSPropertyID gMarginInlineSubpropTable[] = { + eCSSProperty_margin_inline_start, + eCSSProperty_margin_inline_end, + eCSSProperty_UNKNOWN +}; static const nsCSSPropertyID gOutlineSubpropTable[] = { // nsCSSDeclaration.cpp outputs the subproperties in this order. @@ -3023,6 +3034,18 @@ static const nsCSSPropertyID gPaddingSubpropTable[] = { eCSSProperty_UNKNOWN }; +static const nsCSSPropertyID gPaddingBlockSubpropTable[] = { + eCSSProperty_padding_block_start, + eCSSProperty_padding_block_end, + eCSSProperty_UNKNOWN +}; + +static const nsCSSPropertyID gPaddingInlineSubpropTable[] = { + eCSSProperty_padding_inline_start, + eCSSProperty_padding_inline_end, + eCSSProperty_UNKNOWN +}; + static const nsCSSPropertyID gTextDecorationSubpropTable[] = { eCSSProperty_text_decoration_color, eCSSProperty_text_decoration_line, diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 46ef89ba0c..e8ce0190f1 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1810,6 +1810,22 @@ var gCSSProperties = { other_values: [ "rect(3px 20px 15px 4px)", "rect(17px, 21px, 33px, 2px)" ], invalid_values: [ "rect(17px, 21px, 33, 2px)" ] }, + "margin-inline": { + domProp: "marginInline", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "margin-inline-start", "margin-inline-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "margin-inline-end": { domProp: "marginInlineEnd", inherited: false, @@ -1959,6 +1975,22 @@ var gCSSProperties = { ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit", "2", "2px 2", "2 2px" ] }, + "padding-inline": { + domProp: "paddingInline", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "padding-inline-start", "padding-inline-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "padding-inline-end": { domProp: "paddingInlineEnd", inherited: false, @@ -5269,6 +5301,22 @@ var gCSSProperties = { ], invalid_values: [ "none" ], }, + "margin-block": { + domProp: "marginBlock", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "margin-block-start", "margin-block-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "margin-block-end": { domProp: "marginBlockEnd", inherited: false, @@ -5531,6 +5579,22 @@ var gCSSProperties = { alias_for: "inset-inline-end", subproperties: [ "inset-inline-end" ], }, + "padding-block": { + domProp: "paddingBlock", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "padding-block-start", "padding-block-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "padding-block-end": { domProp: "paddingBlockEnd", inherited: false, From f41ad3aae57bded92585d99055c3a7b298306785 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Tue, 9 Apr 2024 10:47:21 +0800 Subject: [PATCH 4/6] Issue #2477 - Part 3: Logical box properties should accept auto values --- layout/style/nsCSSParser.cpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 9b1274763b..2cb6e3ec13 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1192,7 +1192,10 @@ protected: // Reused utility parsing routines void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue); bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]); - bool ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd); + bool ParseBoxPairProperties(int32_t aSingleVariantMask, + int32_t aPairVariantMask, + nsCSSPropertyID aStart, + nsCSSPropertyID aEnd); bool ParseGroupedBoxProperty(int32_t aVariantMask, nsCSSValue& aValue, uint32_t aRestrictions); @@ -10112,7 +10115,9 @@ CSSParserImpl::ParseGridArea() bool CSSParserImpl::ParseGap() { - return ParseBoxPairProperties(eCSSProperty_row_gap, + return ParseBoxPairProperties(VARIANT_INHERIT, + VARIANT_LPCALC, + eCSSProperty_row_gap, eCSSProperty_column_gap); } @@ -11437,20 +11442,23 @@ CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[]) } bool -CSSParserImpl::ParseBoxPairProperties(nsCSSPropertyID aStart, nsCSSPropertyID aEnd) +CSSParserImpl::ParseBoxPairProperties(int32_t aSingleVariantMask, + int32_t aPairVariantMask, + nsCSSPropertyID aStart, + nsCSSPropertyID aEnd) { nsCSSValue first; - if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) { + if (ParseSingleTokenVariant(first, aSingleVariantMask, nullptr)) { AppendValue(aStart, first); AppendValue(aEnd, first); return true; } - if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) != + if (ParseNonNegativeVariant(first, aPairVariantMask, nullptr) != CSSParseResult::Ok) { return false; } nsCSSValue second; - auto result = ParseNonNegativeVariant(second, VARIANT_LPCALC, nullptr); + auto result = ParseNonNegativeVariant(second, aPairVariantMask, nullptr); if (result == CSSParseResult::Error) { return false; } @@ -15526,14 +15534,18 @@ CSSParserImpl::ParseMargin() bool CSSParserImpl::ParseMarginBlock() { - return ParseBoxPairProperties(eCSSProperty_margin_block_start, + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_margin_block_start, eCSSProperty_margin_block_end); } bool CSSParserImpl::ParseMarginInline() { - return ParseBoxPairProperties(eCSSProperty_margin_inline_start, + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_margin_inline_start, eCSSProperty_margin_inline_end); } @@ -15626,14 +15638,18 @@ CSSParserImpl::ParsePadding() bool CSSParserImpl::ParsePaddingBlock() { - return ParseBoxPairProperties(eCSSProperty_padding_block_start, + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_padding_block_start, eCSSProperty_padding_block_end); } bool CSSParserImpl::ParsePaddingInline() { - return ParseBoxPairProperties(eCSSProperty_padding_inline_start, + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_padding_inline_start, eCSSProperty_padding_inline_end); } From 67bded6465a00a6333873616803438e15d59fca6 Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Fri, 29 Mar 2024 20:35:16 +0800 Subject: [PATCH 5/6] Issue #2477 - Part 4: Regenerate developer tools' static CSS properties database --- .../shared/css/generated/properties-db.js | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/devtools/shared/css/generated/properties-db.js b/devtools/shared/css/generated/properties-db.js index d9b5ee65b7..fb95ffd1f1 100644 --- a/devtools/shared/css/generated/properties-db.js +++ b/devtools/shared/css/generated/properties-db.js @@ -7257,6 +7257,25 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "margin-block": { + "isInherited": false, + "subproperties": [ + "margin-block-start", + "margin-block-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "auto", + "calc", + "inherit", + "initial", + "unset" + ] + }, "margin-block-end": { "isInherited": false, "subproperties": [ @@ -7311,6 +7330,25 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "margin-inline": { + "isInherited": false, + "subproperties": [ + "margin-inline-start", + "margin-inline-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "auto", + "calc", + "inherit", + "initial", + "unset" + ] + }, "margin-inline-end": { "isInherited": false, "subproperties": [ @@ -8246,6 +8284,24 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "padding-block": { + "isInherited": false, + "subproperties": [ + "padding-block-start", + "padding-block-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "calc", + "inherit", + "initial", + "unset" + ] + }, "padding-block-end": { "isInherited": false, "subproperties": [ @@ -8297,6 +8353,24 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "padding-inline": { + "isInherited": false, + "subproperties": [ + "padding-inline-start", + "padding-inline-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "calc", + "inherit", + "initial", + "unset" + ] + }, "padding-inline-end": { "isInherited": false, "subproperties": [ From 0c02971a446c94fab7dfc264e2edd8d8e584fa57 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 10 Apr 2024 15:06:49 +0200 Subject: [PATCH 6/6] [devtools] fix issue with ctrl+c handling See https://repo.palemoon.org/MoonchildProductions/Pale-Moon/issues/1961 --- devtools/client/shared/widgets/VariablesView.jsm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devtools/client/shared/widgets/VariablesView.jsm b/devtools/client/shared/widgets/VariablesView.jsm index 2ba8d74916..fc9d084363 100644 --- a/devtools/client/shared/widgets/VariablesView.jsm +++ b/devtools/client/shared/widgets/VariablesView.jsm @@ -908,6 +908,10 @@ VariablesView.prototype = { // Copy current selection to clipboard. if (e.ctrlKey || e.metaKey) { let item = this.getFocusedItem(); + if (!item) { + // No item is selected; do nothing. + return; + } clipboardHelper.copyString( item._nameString + item.separatorStr + item._valueString );