Bug 1463347 - Add distinction between timeLog and timeEnd messages r=nchevobbe
authorbomisore <solaocodes@gmail.com>
Mon, 04 Mar 2019 17:12:47 +0000
changeset 520216 0c4c0810b93fa8fb8c8f1439b78ced96ba91450f
parent 520215 a76b23d70349b38dfa885987c6888c730ede4173
child 520224 78601cacfe69dc8659c3fe7cd3eb94366aa3d680
child 520225 1976157b0c74acb333de44111e1a050f64615b5c
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1463347
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1463347 - Add distinction between timeLog and timeEnd messages r=nchevobbe Differential Revision: https://phabricator.services.mozilla.com/D21306
devtools/client/locales/en-US/webconsole.properties
devtools/client/webconsole/test/fixtures/stubs/consoleApi.js
devtools/client/webconsole/test/mochitest/browser_webconsole_time_methods.js
devtools/client/webconsole/utils/messages.js
--- a/devtools/client/locales/en-US/webconsole.properties
+++ b/devtools/client/locales/en-US/webconsole.properties
@@ -35,20 +35,20 @@ stacktrace.anonymousFunction=<anonymous>
 # %S is the "Async Cause" of the frame.
 stacktrace.asyncStack=(Async: %S)
 
 # LOCALIZATION NOTE (timeLog): this string is used to display the result of
 # the console.timeLog() call. Parameters: %1$S is the name of the timer, %2$S
 # is the number of milliseconds.
 timeLog=%1$S: %2$Sms
 
-# LOCALIZATION NOTE (timeEnd): this string is used to display the result of
+# LOCALIZATION NOTE (console.timeEnd): this string is used to display the result of
 # the console.timeEnd() call. Parameters: %1$S is the name of the timer, %2$S
 # is the number of milliseconds.
-timeEnd=%1$S: %2$Sms
+console.timeEnd=%1$S: %2$Sms - timer ended
 
 # LOCALIZATION NOTE (consoleCleared): this string is displayed when receiving a
 # call to console.clear() to let the user know the previous messages of the
 # console have been removed programmatically.
 consoleCleared=Console was cleared.
 
 # LOCALIZATION NOTE (noCounterLabel): this string is used to display
 # count-messages with no label provided.
--- a/devtools/client/webconsole/test/fixtures/stubs/consoleApi.js
+++ b/devtools/client/webconsole/test/fixtures/stubs/consoleApi.js
@@ -1108,19 +1108,19 @@ stubPreparedMessages.set(`console.timeLo
 stubPreparedMessages.set(`console.timeEnd('bar')`, new ConsoleMessage({
   "id": "1",
   "allowRepeating": true,
   "source": "console-api",
   "timeStamp": 1502884924759,
   "type": "timeEnd",
   "helperType": null,
   "level": "log",
-  "messageText": "bar: 1.21ms",
+  "messageText": "bar: 1.21ms - timer ended",
   "parameters": null,
-  "repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html\",\"sourceId\":\"server1.conn0.child1/source59\",\"line\":6,\"column\":9},\"groupId\":null,\"indent\":0,\"level\":\"log\",\"messageText\":\"bar: 1.21ms\",\"parameters\":null,\"source\":\"console-api\",\"type\":\"timeEnd\",\"userProvidedStyles\":[],\"private\":false,\"stacktrace\":null}",
+  "repeatId": "{\"frame\":{\"source\":\"http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html\",\"sourceId\":\"server1.conn0.child1/source59\",\"line\":6,\"column\":9},\"groupId\":null,\"indent\":0,\"level\":\"log\",\"messageText\":\"bar: 1.21ms - timer ended\",\"parameters\":null,\"source\":\"console-api\",\"type\":\"timeEnd\",\"userProvidedStyles\":[],\"private\":false,\"stacktrace\":null}",
   "stacktrace": null,
   "frame": {
     "source": "http://example.com/browser/devtools/client/webconsole/test/fixtures/stub-generators/test-console-api.html",
     "sourceId": "server1.conn0.child1/source59",
     "line": 6,
     "column": 9
   },
   "groupId": null,
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_time_methods.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_time_methods.js
@@ -21,18 +21,18 @@ const TEST_URI4 = "data:text/html;charse
 
 add_task(async function() {
   // Calling console.time('aTimer') followed by console.timeEnd('aTimer')
   // should result in the aTimer being ended, and a message like aTimer: 123ms
   // printed to the console
   const hud1 = await openNewTabAndConsole(TEST_URI);
 
   const aTimerCompleted = await waitFor(() => findMessage(hud1, "aTimer: "));
-  ok(aTimerCompleted, "Calling console.time('a') and console.timeEnd('a')"
-    + "ends the 'a' timer");
+  ok(aTimerCompleted.textContent.includes("- timer ended"), "Calling "
+    + "console.time('a') and console.timeEnd('a')ends the 'a' timer");
 
   // Calling console.time('bTimer') in the current tab, opening a new tab
   // and calling console.timeEnd('bTimer') in the new tab should not result in
   // the bTimer in the initial tab being ended, but rather a warning message
   // output to the console: Timer "bTimer" doesn't exist
   const hud2 = await openNewTabAndConsole(TEST_URI2);
 
   const error1 =
--- a/devtools/client/webconsole/utils/messages.js
+++ b/devtools/client/webconsole/utils/messages.js
@@ -120,17 +120,17 @@ function transformConsoleAPICallPacket(p
         parameters = null;
         messageText = l10n.getFormatStr(timer.error, [timer.name]);
         level = MESSAGE_LEVEL.WARN;
       } else if (timer) {
         // We show the duration to users when calls console.timeLog/timeEnd is called,
         // if corresponding console.time() was called before.
         const duration = Math.round(timer.duration * 100) / 100;
         if (type === "timeEnd") {
-          messageText = l10n.getFormatStr("timeEnd", [timer.name, duration]);
+          messageText = l10n.getFormatStr("console.timeEnd", [timer.name, duration]);
           parameters = null;
         } else if (type === "timeLog") {
           const [, ...rest] = parameters;
           parameters = [
             l10n.getFormatStr("timeLog", [timer.name, duration]),
             ...rest,
           ];
         }