Bug 1470253 - Don't show console.timeStamp() messages. r=nchevobbe
authorsaumya <saumya15172@iiitd.ac.in>
Wed, 27 Feb 2019 13:42:11 +0000
changeset 519323 91686a9fe2bc21861ce2c4d72ab0cd9954a37e39
parent 519322 9527be2c6bcf17765a6b526c114b91ea338e20c7
child 519324 39bf0bf1a7443de823764af029b0e7755602e0c7
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
bugs1470253
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 1470253 - Don't show console.timeStamp() messages. r=nchevobbe Made changes to messages.js and added a test file. Differential Revision: https://phabricator.services.mozilla.com/D21330
devtools/client/webconsole/test/mochitest/browser.ini
devtools/client/webconsole/test/mochitest/browser_webconsole_console_timeStamp.js
devtools/client/webconsole/utils/messages.js
--- a/devtools/client/webconsole/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/test/mochitest/browser.ini
@@ -287,16 +287,17 @@ skip-if = true # Bug 1405250
 [browser_webconsole_console_api_iframe.js]
 [browser_webconsole_console_dir.js]
 [browser_webconsole_console_dir_uninspectable.js]
 [browser_webconsole_console_error_expand_object.js]
 [browser_webconsole_console_group.js]
 [browser_webconsole_console_logging_workers_api.js]
 skip-if = e10s # SharedWorkers console events are not received on the current process because they could run on any process.
 [browser_webconsole_console_table.js]
+[browser_webconsole_console_timeStamp.js]
 [browser_webconsole_console_trace_distinct.js]
 [browser_webconsole_console_trace_duplicates.js]
 [browser_webconsole_context_menu_export_console_output_clipboard.js]
 subsuite = clipboard
 [browser_webconsole_context_menu_copy_entire_message.js]
 subsuite = clipboard
 skip-if = (os == 'linux' && bits == 32 && debug) # bug 1328915, disable linux32 debug devtools for timeouts
 [browser_webconsole_context_menu_copy_link_location.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_console_timeStamp.js
@@ -0,0 +1,22 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests that a console.timeStamp() does not print anything in the console
+
+"use strict";
+
+const TEST_URI = "data:text/html,<meta charset=utf8>";
+
+add_task(async function() {
+  // We open the console and an empty tab, as we only want to evaluate something.
+  const hud = await openNewTabAndConsole(TEST_URI);
+  // We execute `console.timeStamp('test')` from the console input.
+  await hud.jsterm.execute("console.timeStamp('test')");
+  info(`Checking size`);
+  await waitFor(() => findMessages(hud, "").length == 2);
+  const [first, second] = findMessages(hud, "").map(message=>message.textContent.trim());
+  info(`Checking first message`);
+  is(first, "console.timeStamp('test')", "First message has expected text");
+  info(`Checking second message`);
+  is(second, "undefined", "Second message has expected text");
+});
--- a/devtools/client/webconsole/utils/messages.js
+++ b/devtools/client/webconsole/utils/messages.js
@@ -96,16 +96,19 @@ function transformConsoleAPICallPacket(p
         level = MESSAGE_LEVEL.WARN;
         parameters = null;
       } else {
         const label = counter.label ? counter.label : l10n.getStr("noCounterLabel");
         messageText = `${label}: ${counter.count}`;
         parameters = null;
       }
       break;
+    case "timeStamp":
+      type = MESSAGE_TYPE.NULL_MESSAGE;
+      break;
     case "time":
       parameters = null;
       if (timer && timer.error) {
         messageText = l10n.getFormatStr(timer.error, [timer.name]);
         level = MESSAGE_LEVEL.WARN;
       } else {
         // We don't show anything for console.time calls to match Chrome's behaviour.
         type = MESSAGE_TYPE.NULL_MESSAGE;