diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js
index ece73e60805..c73ad249c15 100644
--- a/mozilla/browser/base/content/browser.js
+++ b/mozilla/browser/base/content/browser.js
@@ -2412,7 +2412,7 @@ function toDownloadManager()
function toJavaScriptConsole()
{
- toOpenWindowByType("global:console", "chrome://global/content/console.xul");
+ toOpenWindowByType("global:console", "chrome://browser/content/console/console.xul");
}
function javaItemEnabling()
@@ -2480,10 +2480,8 @@ function OpenTaskURL( inURL )
window.open( inURL );
}
-function goAboutDialog()
+function openAboutDialog()
{
- // XXXBlake -- the about dialog should be modal, but then clicking the link in it just opens
- // a blank browser window (the page isn't loaded).
window.openDialog("chrome://browser/content/aboutDialog.xul", "About", "modal,centerscreen,chrome,resizable=no");
}
diff --git a/mozilla/browser/base/content/browser.xul b/mozilla/browser/base/content/browser.xul
index 2b9d989cddc..d0c21c7e2e8 100644
--- a/mozilla/browser/base/content/browser.xul
+++ b/mozilla/browser/base/content/browser.xul
@@ -671,12 +671,9 @@ Contributor(s):
label="&releaseCmd.label;"
oncommand="openTopWin('&releaseURL;');"/>
-
+ oncommand="openAboutDialog();"/>
diff --git a/mozilla/browser/base/locale/browser.dtd b/mozilla/browser/base/locale/browser.dtd
index f9c728d7a3f..dcb7ebb06d1 100644
--- a/mozilla/browser/base/locale/browser.dtd
+++ b/mozilla/browser/base/locale/browser.dtd
@@ -155,11 +155,9 @@
-
+
-
-
diff --git a/mozilla/browser/components/Makefile.in b/mozilla/browser/components/Makefile.in
index 42192584505..b5304bfb10e 100644
--- a/mozilla/browser/components/Makefile.in
+++ b/mozilla/browser/components/Makefile.in
@@ -42,6 +42,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
-DIRS = prefwindow history bookmarks
+DIRS = prefwindow history bookmarks console
include $(topsrcdir)/config/rules.mk
diff --git a/mozilla/browser/components/console/MANIFEST b/mozilla/browser/components/console/MANIFEST
new file mode 100644
index 00000000000..f112fd12aed
--- /dev/null
+++ b/mozilla/browser/components/console/MANIFEST
@@ -0,0 +1 @@
+jsconsole-clhandler.js
diff --git a/mozilla/browser/components/console/Makefile.in b/mozilla/browser/components/console/Makefile.in
new file mode 100644
index 00000000000..7bbdfd93316
--- /dev/null
+++ b/mozilla/browser/components/console/Makefile.in
@@ -0,0 +1,33 @@
+#
+# The contents of this file are subject to the Netscape 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/NPL/
+#
+# 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 mozilla.org code.
+#
+# The Initial Developer of the Original Code is Netscape
+# Communications Corporation. Portions created by Netscape are
+# Copyright (C) 1998 Netscape Communications Corporation. All
+# Rights Reserved.
+#
+# Contributor(s):
+#
+
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+EXTRA_COMPONENTS = jsconsole-clhandler.js
+
+include $(topsrcdir)/config/rules.mk
+
diff --git a/mozilla/browser/components/console/content/console.css b/mozilla/browser/components/console/content/console.css
new file mode 100644
index 00000000000..472153bee37
--- /dev/null
+++ b/mozilla/browser/components/console/content/console.css
@@ -0,0 +1,57 @@
+
+.console-box {
+ -moz-binding: url("chrome://global/content/consoleBindings.xml#console-box");
+ overflow: auto;
+}
+
+.console-rows {
+ -moz-user-focus: normal;
+}
+
+.console-row[type="error"],
+.console-row[type="warning"] {
+ -moz-binding: url("chrome://global/content/consoleBindings.xml#error");
+}
+
+.console-row[type="message"] {
+ -moz-binding: url("chrome://global/content/consoleBindings.xml#message");
+}
+
+.console-error-msg {
+ white-space: normal;
+}
+
+.console-msg-text {
+ white-space: pre;
+}
+
+.console-error-source {
+ -moz-binding: url("chrome://global/content/consoleBindings.xml#console-error-source");
+}
+
+/* :::::::::: hiding and showing of rows for each mode :::::::::: */
+
+.console-box[mode="Warnings"] > .console-box-internal > .console-rows
+ > .console-row[type="error"],
+.console-box[mode="Messages"] > .console-box-internal > .console-rows
+ > .console-row[type="error"]
+{
+ display: none;
+}
+
+.console-box[mode="Errors"] > .console-box-internal > .console-rows
+ > .console-row[type="warning"],
+.console-box[mode="Messages"] > .console-box-internal > .console-rows
+ > .console-row[type="warning"]
+{
+ display: none;
+}
+
+.console-box[mode="Errors"] > .console-box-internal > .console-rows
+ > .console-row[type="message"],
+.console-box[mode="Warnings"] > .console-box-internal > .console-rows
+ > .console-row[type="message"]
+{
+ display: none;
+}
+
diff --git a/mozilla/browser/components/console/content/console.js b/mozilla/browser/components/console/content/console.js
new file mode 100644
index 00000000000..204968d5358
--- /dev/null
+++ b/mozilla/browser/components/console/content/console.js
@@ -0,0 +1,227 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape 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/NPL/
+ *
+ * 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 mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Joe Hewitt
+ *
+ * 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 NPL, 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 NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var gConsole, gConsoleBundle;
+
+/* :::::::: Console Initialization ::::::::::::::: */
+
+window.onload = function()
+{
+ gConsole = document.getElementById("ConsoleBox");
+ gConsoleBundle = document.getElementById("ConsoleBundle");
+
+ top.controllers.insertControllerAt(0, ConsoleController);
+
+ updateSortCommand(gConsole.sortOrder);
+ updateModeCommand(gConsole.mode);
+
+ var iframe = document.getElementById("Evaluator");
+ iframe.addEventListener("load", displayResult, true);
+}
+
+/* :::::::: Console UI Functions ::::::::::::::: */
+
+function changeMode(aMode)
+{
+ switch (aMode) {
+ case "Errors":
+ case "Warnings":
+ case "Messages":
+ gConsole.mode = aMode;
+ break;
+ case "All":
+ gConsole.mode = null;
+ }
+
+ document.persist("ConsoleBox", "mode");
+}
+
+function clearConsole()
+{
+ gConsole.clear();
+}
+
+function changeSortOrder(aOrder)
+{
+ updateSortCommand(gConsole.sortOrder = aOrder);
+}
+
+function updateSortCommand(aOrder)
+{
+ var orderString = aOrder == 'reverse' ? "Descend" : "Ascend";
+ var bc = document.getElementById("Console:sort"+orderString);
+ bc.setAttribute("checked", true);
+
+ orderString = aOrder == 'reverse' ? "Ascend" : "Descend";
+ bc = document.getElementById("Console:sort"+orderString);
+ bc.setAttribute("checked", false);
+}
+
+function updateModeCommand(aMode)
+{
+ var bc = document.getElementById("Console:mode" + aMode);
+ bc.setAttribute("checked", true);
+}
+
+function toggleToolbar(aEl)
+{
+ var bc = document.getElementById(aEl.getAttribute("observes"));
+ var truth = bc.getAttribute("checked");
+ bc.setAttribute("checked", truth != "true");
+ var toolbar = document.getElementById(bc.getAttribute("_toolbar"));
+ toolbar.setAttribute("hidden", truth);
+
+ document.persist(toolbar.id, "hidden");
+ document.persist(bc.id, "checked");
+}
+
+function copyItemToClipboard()
+{
+ gConsole.copySelectedItem();
+}
+
+function isItemSelected()
+{
+ return gConsole.selectedItem != null;
+}
+
+function UpdateCopyMenu()
+{
+ goUpdateCommand("cmd_copy");
+}
+
+function onEvalKeyPress(aEvent)
+{
+ if (aEvent.keyCode == 13)
+ evaluateTypein();
+}
+
+function evaluateTypein()
+{
+ var code = document.getElementById("TextboxEval").value;
+ var iframe = document.getElementById("Evaluator");
+ iframe.setAttribute("src", "javascript: " + code);
+}
+
+function displayResult()
+{
+ var result = Evaluator.document.documentElement.lastChild.firstChild;
+ if (result && result.data)
+ gConsole.mCService.logStringMessage(result.data);
+ // or could use appendMessage which doesn't persist
+}
+
+/* :::::::: Command Controller for the Window ::::::::::::::: */
+
+var ConsoleController =
+{
+ isCommandEnabled: function (aCommand)
+ {
+ switch (aCommand) {
+ case "cmd_copy":
+ return isItemSelected();
+ default:
+ return false;
+ }
+ },
+
+ supportsCommand: function (aCommand)
+ {
+ switch (aCommand) {
+ case "cmd_copy":
+ return true;
+ default:
+ return false;
+ }
+ },
+
+ doCommand: function (aCommand)
+ {
+ switch (aCommand) {
+ case "cmd_copy":
+ copyItemToClipboard();
+ break;
+ default:
+ break;
+ }
+ },
+
+ onEvent: function (aEvent)
+ {
+ }
+};
+
+// XXX DEBUG
+
+function debug(aText)
+{
+ var csClass = Components.classes['@mozilla.org/consoleservice;1'];
+ var cs = csClass.getService(Components.interfaces.nsIConsoleService);
+ cs.logStringMessage(aText);
+}
+
+function getStackTrace()
+{
+ var frame = Components.stack.caller;
+ var str = "";
+ while (frame) {
+ if (frame.filename)
+ str += frame.filename + ", Line " + frame.lineNumber;
+ else
+ str += "[" + gConsoleBundle.getString("noFile") + "]";
+
+ str += " --> ";
+
+ if (frame.functionName)
+ str += frame.functionName;
+ else
+ str += "[" + gConsoleBundle.getString("noFunction") + "]";
+
+ str += "\n";
+
+ frame = frame.caller;
+ }
+
+ return str;
+}
+
+function openAboutDialog()
+{
+ window.openDialog("chrome://browser/content/aboutDialog.xul", "About", "modal,centerscreen,chrome,resizable=no");
+}
+
diff --git a/mozilla/browser/components/console/content/console.xul b/mozilla/browser/components/console/content/console.xul
new file mode 100644
index 00000000000..ab2c0ca0540
--- /dev/null
+++ b/mozilla/browser/components/console/content/console.xul
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+
+
+
+ %console;
+ %util;
+ %globalRegionDTD;
+ %brandDTD;
+]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/browser/components/console/content/consoleBindings.xml b/mozilla/browser/components/console/content/consoleBindings.xml
new file mode 100644
index 00000000000..8209b8a5d23
--- /dev/null
+++ b/mozilla/browser/components/console/content/consoleBindings.xml
@@ -0,0 +1,419 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 250
+
+ -1
+
+
+
+
+
+
+ return this.mCount
+
+
+
+ return this.mMode;
+
+
+
+
+ return this.getAttribute("sortOrder");
+ this.setAttribute("sortOrder", val); return val;
+
+ null
+
+ return this.mSelectedItem
+
+
+
+
+
+
+
+
+
+
+
+
+ = limit; --i)
+ if (!messages[i].message)
+ break;
+
+ // Populate with messages after latest "clear"
+ while (++i < messages.length)
+ this.appendItem(messages[i]);
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this.limit) this.deleteFirst();
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+ 0)
+ return kids2[0];
+ }
+ return null;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ this.init();
+ this.destroy();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/browser/components/console/jar.mn b/mozilla/browser/components/console/jar.mn
new file mode 100644
index 00000000000..661a7f3fb02
--- /dev/null
+++ b/mozilla/browser/components/console/jar.mn
@@ -0,0 +1,9 @@
+browser.jar:
+ content/browser/console/console.js (content/console.js)
+ content/browser/console/console.xul (content/console.xul)
+ content/browser/console/console.css (content/console.css)
+ content/browser/console/consoleBindings.xml (content/consoleBindings.xml)
+
+en-US.jar:
+ locale/en-US/browser/console/console.dtd (locale/console.dtd)
+ locale/en-US/browser/console/console.properties (locale/console.properties)
diff --git a/mozilla/browser/components/console/jsconsole-clhandler.js b/mozilla/browser/components/console/jsconsole-clhandler.js
new file mode 100644
index 00000000000..a366def11cd
--- /dev/null
+++ b/mozilla/browser/components/console/jsconsole-clhandler.js
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * 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 mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s): Martijn Pieters
+ */
+
+/*
+ * -jsconsole commandline handler; starts up the JavaScript console.
+ */
+
+/*
+ * Constants
+ */
+
+const JSCONSOLEHANDLER_CONTRACTID =
+ "@mozilla.org/commandlinehandler/general-startup;1?type=jsconsole";
+
+const JSCONSOLEHANDLER_CID =
+ Components.ID('{1698ef18-c128-41a1-b4d0-7f9acd2ae86c}');
+
+/*
+ * Classes
+ */
+
+/* jsConsoleHandler class constructor */
+function jsConsoleHandler() {}
+
+/* jsConsoleHandler class def */
+jsConsoleHandler.prototype = {
+ commandLineArgument: '-jsconsole',
+ prefNameForStartup: 'general.startup.jsconsole',
+ chromeUrlForTask: 'chrome://global/content/console.xul',
+ helpText: 'Start with Javascript Console',
+ handlesArgs: false,
+ defaultArgs: null,
+ openWindowWithArgs: false
+};
+
+/*
+ * Objects
+ */
+
+/* jsConsoleHandler Module (for XPCOM registration) */
+var jsConsoleHandlerModule = {
+ registerSelf: function(compMgr, fileSpec, location, type) {
+ compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+
+ compMgr.registerFactoryLocation(JSCONSOLEHANDLER_CID,
+ 'JS Console Commandline Handler component',
+ JSCONSOLEHANDLER_CONTRACTID,
+ fileSpec,
+ location,
+ type);
+ var catman = Components.classes["@mozilla.org/categorymanager;1"]
+ .getService(Components.interfaces.nsICategoryManager);
+ catman.addCategoryEntry("command-line-argument-handlers", "jsconsole command line handler",
+ JSCONSOLEHANDLER_CONTRACTID,
+ true, true);
+ },
+
+ unregisterSelf: function(compMgr, fileSpec, location) {
+ compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+ compMgr.unregisterFactoryLocation(JSCONSOLEHANDLER_CID, fileSpec);
+ var catman = Components.classes["@mozilla.org/categorymanager;1"]
+ .getService(Components.interfaces.nsICategoryManager);
+ catman.deleteCategoryEntry("command-line-argument-handlers",
+ JSCONSOLEHANDLER_CONTRACTID, true);
+ },
+
+ getClassObject: function(compMgr, cid, iid) {
+ if (!cid.equals(JSCONSOLEHANDLER_CID))
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+
+ if (!iid.equals(Components.interfaces.nsIFactory))
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+
+ return jsConsoleHandlerFactory;
+ },
+
+ canUnload: function(compMgr) { return true; }
+};
+
+/* jsConsoleHandler Class Factory */
+var jsConsoleHandlerFactory = {
+ createInstance: function(outer, iid) {
+ if (outer != null)
+ throw Components.results.NS_ERROR_NO_AGGREGATION;
+
+ if (!iid.equals(Components.interfaces.nsICmdLineHandler) &&
+ !iid.equals(Components.interfaces.nsISupports))
+ throw Components.results.NS_ERROR_INVALID_ARG;
+
+ return new jsConsoleHandler();
+ }
+}
+
+/*
+ * Functions
+ */
+
+/* module initialisation */
+function NSGetModule(comMgr, fileSpec) { return jsConsoleHandlerModule; }
+
+// vim:sw=4:sr:sta:et:sts:
diff --git a/mozilla/browser/components/console/locale/console.dtd b/mozilla/browser/components/console/locale/console.dtd
new file mode 100644
index 00000000000..1d829faff95
--- /dev/null
+++ b/mozilla/browser/components/console/locale/console.dtd
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Last Sort Order">
+
+ First Sort Order">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mozilla/browser/components/console/locale/console.properties b/mozilla/browser/components/console/locale/console.properties
new file mode 100644
index 00000000000..b8f93e303ce
--- /dev/null
+++ b/mozilla/browser/components/console/locale/console.properties
@@ -0,0 +1,8 @@
+typeError=Error:
+typeWarning=Warning:
+typeException=Exception:
+errFile=Source File: %S
+errLine=Line: %S
+errLineCol=Line: %S, Column: %S
+errCode=Source Code:
+