Bug 637401 - [regression] Console message nodes do not have unique IDs anymore a=approval2.0 r=mossop
authorDavid Dahl <ddahl@mozilla.com>
Mon, 28 Feb 2011 14:42:28 -0600
changeset 63173 e70c07f8d9db512c194836c55c6781bc71251ec4
parent 63172 e2a82bfadc6778b96da4762c94a99dd06fb77c59
child 63174 96b0a0ff62661af3b61f3c23454f40e5a585ccbb
push id19058
push userddahl@mozilla.com
push dateMon, 28 Feb 2011 20:45:01 +0000
treeherdermozilla-central@e70c07f8d9db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersapproval2, mossop
bugs637401
milestone2.0b13pre
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 637401 - [regression] Console message nodes do not have unique IDs anymore a=approval2.0 r=mossop
toolkit/components/console/hudservice/HUDService.jsm
toolkit/components/console/hudservice/tests/browser/Makefile.in
toolkit/components/console/hudservice/tests/browser/browser_webconsole_message_node_id.js
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -5042,16 +5042,18 @@ ConsoleUtils = {
     node.appendChild(timestampNode);  // childNode[0]
     node.appendChild(iconContainer);  // childNode[1]
     node.appendChild(bodyNode);       // childNode[2]
     node.appendChild(repeatNode);     // childNode[3]
     if (locationNode) {
       node.appendChild(locationNode); // childNode[4]
     }
 
+    node.setAttribute("id", "console-msg-" + HUDService.sequenceId());
+
     return node;
   },
 
   /**
    * Adjusts the category and severity of the given message, clearing the old
    * category and severity if present.
    *
    * @param nsIDOMNode aMessageNode
--- a/toolkit/components/console/hudservice/tests/browser/Makefile.in
+++ b/toolkit/components/console/hudservice/tests/browser/Makefile.in
@@ -42,16 +42,17 @@ srcdir		= @srcdir@
 VPATH			= @srcdir@
 relativesrcdir  = toolkit/components/console/hudservice/tests/browser
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _BROWSER_TEST_FILES = \
 	browser_webconsole_notifications.js \
+	browser_webconsole_message_node_id.js \
 	browser_webconsole_bug_580030_errors_after_page_reload.js \
 	browser_webconsole_basic_net_logging.js \
 	browser_webconsole_bug_579412_input_focus.js \
 	browser_webconsole_bug_580001_closing_after_completion.js \
 	browser_webconsole_bug_580400_groups.js \
 	browser_webconsole_bug_588730_text_node_insertion.js \
 	browser_webconsole_bug_601667_filter_buttons.js \
 	browser_webconsole_bug_597136_external_script_errors.js \
new file mode 100644
--- /dev/null
+++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_message_node_id.js
@@ -0,0 +1,61 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is DevTools test code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *  David Dahl <ddahl@mozilla.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const TEST_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-console.html";
+
+function test() {
+  addTab(TEST_URI);
+  browser.addEventListener("DOMContentLoaded", onLoad, false);
+}
+
+function onLoad() {
+  browser.removeEventListener("DOMContentLoaded", onLoad, false);
+  openConsole();
+
+  let hudId = HUDService.displaysIndex()[0];
+  let console = browser.contentWindow.wrappedJSObject.console;
+  let hudBox = HUDService.getHeadsUpDisplay(hudId);
+  let outputNode = hudBox.querySelector(".hud-output-node");
+
+  console.log("a log message");
+
+  let node = outputNode.querySelectorAll(".hud-msg-node");
+
+  ok(node[0].getAttribute("id") && node[0].getAttribute != "", "we have a node id");
+  closeConsole();
+  finishTest();
+}