1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 05:57:58 +01:00

add liberator.dump() to prefix dump() messages with our extension name

This commit is contained in:
Doug Kearns
2008-09-08 04:41:23 +00:00
parent b9f71d1bd9
commit f12f956e41
6 changed files with 25 additions and 19 deletions

View File

@@ -509,7 +509,7 @@ liberator.History = function () //{{{
for (var i = 0; i < rootNode.childCount; i++)
{
var node = rootNode.getChild(i);
// dump("History child " + node.itemId + ": " + node.title + " - " + node.type + "\n");
//liberator.dump("History child " + node.itemId + ": " + node.title + " - " + node.type + "\n");
if (node.type == node.RESULT_TYPE_URI) // just make sure it's a bookmark
history.push([node.uri, node.title || "[No title]"]);
}

View File

@@ -427,7 +427,7 @@ liberator.Commands = function () //{{{
}
var sub = str.substr(i);
// dump(i + ": " + sub + " - " + onlyArgumentsRemaining + "\n");
//liberator.dump(i + ": " + sub + " - " + onlyArgumentsRemaining + "\n");
if ((!onlyArgumentsRemaining) && /^--(\s|$)/.test(sub))
{
onlyArgumentsRemaining = true;

View File

@@ -488,7 +488,7 @@ liberator.Events = function () //{{{
// return true when load successful, or false otherwise
function waitForPageLoaded()
{
dump("start waiting in loaded state: " + liberator.buffer.loaded + "\n");
liberator.dump("start waiting in loaded state: " + liberator.buffer.loaded + "\n");
var mainThread = Components.classes["@mozilla.org/thread-manager;1"]
.getService(Components.interfaces.nsIThreadManager).mainThread;
while (mainThread.hasPendingEvents()) // clear queue
@@ -503,7 +503,7 @@ liberator.Events = function () //{{{
{
mainThread.processNextEvent(true);
if ((now - then) % 1000 < 10)
dump("waited: " + (now - then) + " ms\n");
liberator.dump("waited: " + (now - then) + " ms\n");
if (liberator.buffer.loaded > 0)
{
@@ -519,7 +519,7 @@ liberator.Events = function () //{{{
var ret = (liberator.buffer.loaded == 1);
if (!ret)
liberator.echoerr("Page did not load completely in " + ms + " milliseconds. Macro stopped.");
dump("done waiting: " + ret + "\n");
liberator.dump("done waiting: " + ret + "\n");
// sometimes the input widget had focus when replaying a macro
// maybe this call should be moved somewhere else?
@@ -661,7 +661,7 @@ liberator.Events = function () //{{{
destroy: function ()
{
// removeEventListeners() to avoid mem leaks
window.dump("TODO: remove all eventlisteners\n");
liberator.dump("TODO: remove all eventlisteners\n");
if (typeof(getBrowser) != "undefined")
getBrowser().removeProgressListener(this.progressListener);
@@ -958,8 +958,8 @@ liberator.Events = function () //{{{
return;
//liberator.log("onFocusChange: " + elem);
// dump("=+++++++++=\n" + liberator.util.objectToString(event.target) + "\n")
// dump (elem + ": " + win + "\n");//" - target: " + event.target + " - origtarget: " + event.originalTarget + " - expltarget: " + event.explicitOriginalTarget + "\n");
//liberator.dump("=+++++++++=\n" + liberator.util.objectToString(event.target) + "\n")
//liberator.dump (elem + ": " + win + "\n");//" - target: " + event.target + " - origtarget: " + event.originalTarget + " - expltarget: " + event.explicitOriginalTarget + "\n");
if (elem && (
(elem instanceof HTMLInputElement && (elem.type.toLowerCase() == "text" || elem.type.toLowerCase() == "password")) ||
@@ -993,7 +993,7 @@ liberator.Events = function () //{{{
{
if (liberator.config.isComposeWindow)
{
dump("Compose editor got focus\n");
liberator.dump("Compose editor got focus\n");
liberator.modes.set(liberator.modes.INSERT, liberator.modes.TEXTAREA);
}
else if (liberator.mode != liberator.modes.MESSAGE)
@@ -1011,7 +1011,7 @@ liberator.Events = function () //{{{
// this.wantsModeReset = true;
// setTimeout(function ()
// {
// dump("cur: " + liberator.mode + "\n");
// liberator.dump("cur: " + liberator.mode + "\n");
// if (liberator.events.wantsModeReset)
// {
// liberator.events.wantsModeReset = false;
@@ -1116,7 +1116,7 @@ liberator.Events = function () //{{{
return true;
//liberator.log(key + " in mode: " + liberator.mode);
// dump(key + " in mode: " + liberator.mode + "\n");
//liberator.dump(key + " in mode: " + liberator.mode + "\n");
if (liberator.modes.isRecording)
{

View File

@@ -564,7 +564,7 @@ const liberator = (function () //{{{
triggerCallback: function (type, mode, data)
{
//dump("type: " + type + " mode: " + mode + "data: " + data + "\n");
//liberator.dump("type: " + type + " mode: " + mode + "data: " + data + "\n");
for (let i = 0; i < callbacks.length; i++)
{
var [thistype, thismode, thisfunc] = callbacks[i];
@@ -602,6 +602,12 @@ const liberator = (function () //{{{
return false; // so you can do: if (...) return liberator.beep();
},
// NOTE: "browser.dom.window.dump.enabled" preference needs to be set
dump: function (message)
{
dump(liberator.config.name.toLowerCase() + ": " + message);
},
// with (liberator) means, liberator is the default namespace "inside" eval
eval: function (str)
{
@@ -782,7 +788,7 @@ const liberator = (function () //{{{
if (elem)
window.content.scrollTo(0, elem.getBoundingClientRect().top - 10); // 10px context
else
dump('no element: ' + '@class="tag" and text()="' + tag + '"\n' );
liberator.dump('no element: ' + '@class="tag" and text()="' + tag + '"\n' );
}, 500);
}
@@ -1069,7 +1075,7 @@ const liberator = (function () //{{{
if (liberator.has("quickmarks"))
liberator.quickmarks.destroy();
window.dump("All liberator modules destroyed\n");
liberator.dump("All liberator modules destroyed\n");
liberator.autocommands.trigger("Quit", "");
},

View File

@@ -1007,7 +1007,7 @@ liberator.Mail = function () //{{{
}
catch (e)
{
dump("ERROR: " + folder.prettyName + " failed to getMessages\n");
liberator.dump("ERROR: " + folder.prettyName + " failed to getMessages\n");
continue;
}

View File

@@ -99,7 +99,7 @@ liberator.modes = (function () //{{{
{
// TODO: fix v.log() to work with verbosity level
//liberator.log("switching from mode " + oldMode + " to mode " + newMode, 7);
// dump("switching from mode " + oldMode + " to mode " + newMode + "\n");
//liberator.dump("switching from mode " + oldMode + " to mode " + newMode + "\n");
switch (oldMode)
{