Bug 633308 - Add toString method to various Panorama objects; r=ian

This commit is contained in:
Michael Yoshitaka Erlewine 2011-02-26 09:28:00 -05:00
parent 0904caa533
commit a9e7a66ffa
11 changed files with 167 additions and 1 deletions

View File

@ -101,6 +101,13 @@ function Drag(item, event, isFauxDrag) {
};
Drag.prototype = {
// ----------
// Function: toString
// Prints [Drag (item)] for debug use
toString: function Drag_toString() {
return "[Drag (" + this.item + ")]";
},
// ----------
// Function: snapBounds
// Adjusts the given bounds according to the currently active trenches. Used by <Drag.snap>

View File

@ -281,6 +281,13 @@ function GroupItem(listOfEls, options) {
// ----------
GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// ----------
// Function: toString
// Prints [GroupItem id=id] for debug use
toString: function GroupItem_toString() {
return "[GroupItem id=" + this.id + "]";
},
// ----------
// Variable: defaultName
// The prompt text for the title field.
@ -1792,6 +1799,13 @@ let GroupItems = {
minGroupHeight: 110,
minGroupWidth: 125,
// ----------
// Function: toString
// Prints [GroupItems] for debug use
toString: function GroupItems_toString() {
return "[GroupItems count=" + this.groupItems.length + "]";
},
// ----------
// Function: init
init: function GroupItems_init() {

View File

@ -186,6 +186,23 @@ function iQClass(selector, context) {
iQClass.prototype = {
// ----------
// Function: toString
// Prints [iQ...] for debug use
toString: function iQClass_toString() {
if (this.length > 1) {
if (this.selector)
return "[iQ (" + this.selector + ")]";
else
return "[iQ multi-object]";
}
if (this.length == 1)
return "[iQ (" + this[0].toString() + ")]";
return "[iQ non-object]";
},
// Start with an empty selector
selector: "",

View File

@ -854,6 +854,13 @@ Item.prototype = {
// Class: Items
// Keeps track of all Items.
let Items = {
// ----------
// Function: toString
// Prints [Items] for debug use
toString: function Items_toString() {
return "[Items]";
},
// ----------
// Variable: defaultGutter
// How far apart Items should be from each other and from bounds

View File

@ -41,6 +41,13 @@ Cu.import("resource://gre/modules/Services.jsm");
let EXPORTED_SYMBOLS = ["AllTabs"];
let AllTabs = {
// ----------
// Function: toString
// Prints [AllTabs] for debug use
toString: function AllTabs_toString() {
return "[AllTabs]";
},
/**
* Get an array of all tabs from all tabbrowser windows.
*

View File

@ -74,6 +74,13 @@ function Point(a, y) {
};
Point.prototype = {
// ----------
// Function: toString
// Prints [Point (x,y)] for debug use
toString: function Point_toString() {
return "[Point (" + this.x + "," + this.y + ")]";
},
// ----------
// Function: distance
// Returns the distance from this point to the given <Point>.
@ -109,6 +116,13 @@ function Rect(a, top, width, height) {
};
Rect.prototype = {
// ----------
// Function: toString
// Prints [Rect (left,top,width,height)] for debug use
toString: function Rect_toString() {
return "[Rect (" + this.left + "," + this.top + "," +
this.width + "," + this.height + ")]";
},
get right() this.left + this.width,
set right(value) {
@ -282,6 +296,13 @@ function Range(min, max) {
};
Range.prototype = {
// ----------
// Function: toString
// Prints [Range (min,max)] for debug use
toString: function Range_toString() {
return "[Range (" + this.min + "," + this.max + ")]";
},
// Variable: extent
// Equivalent to max-min
get extent() {
@ -464,6 +485,13 @@ Subscribable.prototype = {
let Utils = {
defaultFaviconURL: "chrome://mozapps/skin/places/defaultFavicon.png",
// ----------
// Function: toString
// Prints [Utils] for debug use
toString: function Utils_toString() {
return "[Utils]";
},
// ___ Logging
useConsole: true, // as opposed to dump
showTime: false,

View File

@ -116,6 +116,13 @@ function scorePatternMatch(pattern, matched, offset) {
// <TabItem>s and <xul:tab>s without having to worry which
// one is which.
var TabUtils = {
// ----------
// Function: toString
// Prints [TabUtils] for debug use
toString: function TabUtils_toString() {
return "[TabUtils]";
},
// ---------
// Function: _nameOfTab
// Given a <TabItem> or a <xul:tab> returns the tab's name.
@ -166,7 +173,14 @@ function TabMatcher(term) {
this.term = term;
}
TabMatcher.prototype = {
TabMatcher.prototype = {
// ----------
// Function: toString
// Prints [TabMatcher (term)] for debug use
toString: function TabMatcher_toString() {
return "[TabMatcher (" + this.term + ")]";
},
// ---------
// Function: _filterAndSortMatches
// Given an array of <TabItem>s and <xul:tab>s returns a new array
@ -316,6 +330,13 @@ function SearchEventHandlerClass() {
}
SearchEventHandlerClass.prototype = {
// ----------
// Function: toString
// Prints [SearchEventHandler] for debug use
toString: function SearchEventHandlerClass_toString() {
return "[SearchEventHandler]";
},
// ----------
// Function: init
// Initializes the searchbox to be focused, and everything

View File

@ -50,6 +50,13 @@ let Storage = {
CACHE_CLIENT_IDENTIFIER: "tabview-cache",
CACHE_PREFIX: "moz-panorama:",
// ----------
// Function: toString
// Prints [Storage] for debug use
toString: function Storage_toString() {
return "[Storage]";
},
// ----------
// Function: init
// Sets up the object.
@ -413,6 +420,13 @@ function CacheListener(callback) {
};
CacheListener.prototype = {
// ----------
// Function: toString
// Prints [CacheListener] for debug use
toString: function CacheListener_toString() {
return "[CacheListener]";
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsICacheListener]),
onCacheEntryAvailable: function (entry, access, status) {
this.callback(entry, access, status);

View File

@ -212,6 +212,13 @@ function TabItem(tab, options) {
};
TabItem.prototype = Utils.extend(new Item(), new Subscribable(), {
// ----------
// Function: toString
// Prints [TabItem (tab)] for debug use
toString: function TabItem_toString() {
return "[TabItem (" + this.tab + ")]";
},
// ----------
// Function: forceCanvasSize
// Repaints the thumbnail with the given resolution, and forces it
@ -814,6 +821,13 @@ let TabItems = {
_reconnectingPaused: false,
tabItemPadding: {},
// ----------
// Function: toString
// Prints [TabItems count=count] for debug use
toString: function TabItems_toString() {
return "[TabItems count=" + this.items.length + "]";
},
// ----------
// Function: init
// Set up the necessary tracking to maintain the <TabItems>s.
@ -1342,6 +1356,13 @@ TabPriorityQueue.prototype = {
_low: [], // low priority queue
_high: [], // high priority queue
// ----------
// Function: toString
// Prints [TabPriorityQueue count=count] for debug use
toString: function TabPriorityQueue_toString() {
return "[TabPriorityQueue count=" + (this._low.length + this._high.length) + "]";
},
// ----------
// Function: clear
// Empty the update queue
@ -1443,6 +1464,13 @@ function TabCanvas(tab, canvas) {
};
TabCanvas.prototype = {
// ----------
// Function: toString
// Prints [TabCanvas (tab)] for debug use
toString: function TabCanvas_toString() {
return "[TabCanvas (" + this.tab + ")]";
},
// ----------
// Function: paint
paint: function TabCanvas_paint(evt) {

View File

@ -110,6 +110,15 @@ function Trench(element, xory, type, edge) {
};
Trench.prototype = {
// ----------
// Function: toString
// Prints [Trench edge type (parentItem)] for debug use
toString: function Trench_toString() {
return "[Trench " + this.edge + " " + this.type +
(this.parentItem ? " (" + this.parentItem + ")" : "") +
"]";
},
//----------
// Variable: radius
// (integer) radius is how far away we should snap from
@ -481,6 +490,13 @@ var Trenches = {
trenches: [],
// ----------
// Function: toString
// Prints [Trenches count=count] for debug use
toString: function Trenches_toString() {
return "[Trenches count=" + this.trenches.length + "]";
},
// ---------
// Function: getById
// Return the specified <Trench>.

View File

@ -132,6 +132,13 @@ let UI = {
// windows is about to close.
isDOMWindowClosing: false,
// ----------
// Function: toString
// Prints [UI] for debug use
toString: function UI_toString() {
return "[UI]";
},
// ----------
// Function: init
// Must be called after the object is created.