diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 54509dae62f2..22f409fd8c77 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -514,6 +514,8 @@ Parser::Parser(ExclusiveContext *cx, LifoAlloc *alloc, sawDeprecatedDestructuringForIn(false), sawDeprecatedLegacyGenerator(false), sawDeprecatedExpressionClosure(false), + sawDeprecatedLetBlock(false), + sawDeprecatedLetExpression(false), handler(cx, *alloc, tokenStream, foldConstants, syntaxParser, lazyOuterFunction) { { @@ -3657,11 +3659,13 @@ Parser::letBlock(LetContext letContext) if (!expr) return null(); MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_AFTER_LET); + sawDeprecatedLetBlock = true; } else { MOZ_ASSERT(letContext == LetExpression); expr = assignExpr(); if (!expr) return null(); + sawDeprecatedLetExpression = true; } handler.setLexicalScopeBody(block, expr); PopStatementPC(tokenStream, pc); @@ -8334,6 +8338,8 @@ Parser::accumulateTelemetry() DeprecatedDestructuringForIn = 1, // JS 1.7 only DeprecatedLegacyGenerator = 2, // JS 1.7+ DeprecatedExpressionClosure = 3, // Added in JS 1.8, but not version-gated + DeprecatedLetBlock = 4, // Added in JS 1.7, but not version-gated + DeprecatedLetExpression = 5, // Added in JS 1.7, but not version-gated }; // Hazard analysis can't tell that the telemetry callbacks don't GC. @@ -8348,6 +8354,10 @@ Parser::accumulateTelemetry() (*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLegacyGenerator); if (sawDeprecatedExpressionClosure) (*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedExpressionClosure); + if (sawDeprecatedLetBlock) + (*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLetBlock); + if (sawDeprecatedLetExpression) + (*cb)(JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, DeprecatedLetExpression); } template class Parser; diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index 519916dae54b..18acc4b910b9 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -377,6 +377,8 @@ class Parser : private JS::AutoGCRooter, public StrictModeGetter bool sawDeprecatedDestructuringForIn:1; bool sawDeprecatedLegacyGenerator:1; bool sawDeprecatedExpressionClosure:1; + bool sawDeprecatedLetBlock:1; + bool sawDeprecatedLetExpression:1; typedef typename ParseHandler::Node Node; typedef typename ParseHandler::DefinitionNode DefinitionNode; diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 9554aa2ee05b..e85a181e1be2 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -3012,7 +3012,7 @@ AccumulateTelemetryCallback(int id, uint32_t sample) Telemetry::Accumulate(Telemetry::GC_SCC_SWEEP_MAX_PAUSE_MS, sample); break; case JS_TELEMETRY_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT: - MOZ_ASSERT(sample <= 3); + MOZ_ASSERT(sample <= 5); Telemetry::Accumulate(Telemetry::JS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT, sample); break; default: diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 9f049e28a175..af51df0e199a 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -322,7 +322,7 @@ "expires_in_version": "never", "kind": "enumerated", "n_values": 10, - "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach, DestructuringForIn, LegacyGenerator, ExpressionClosure" + "description": "Use of SpiderMonkey's deprecated language extensions in web content: ForEach=0, DestructuringForIn=1, LegacyGenerator=2, ExpressionClosure=3, LetBlock=4, LetExpression=5" }, "TELEMETRY_PING": { "expires_in_version": "default",