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 = { Drag.prototype = {
// ----------
// Function: toString
// Prints [Drag (item)] for debug use
toString: function Drag_toString() {
return "[Drag (" + this.item + ")]";
},
// ---------- // ----------
// Function: snapBounds // Function: snapBounds
// Adjusts the given bounds according to the currently active trenches. Used by <Drag.snap> // 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(), { 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 // Variable: defaultName
// The prompt text for the title field. // The prompt text for the title field.
@ -1792,6 +1799,13 @@ let GroupItems = {
minGroupHeight: 110, minGroupHeight: 110,
minGroupWidth: 125, minGroupWidth: 125,
// ----------
// Function: toString
// Prints [GroupItems] for debug use
toString: function GroupItems_toString() {
return "[GroupItems count=" + this.groupItems.length + "]";
},
// ---------- // ----------
// Function: init // Function: init
init: function GroupItems_init() { init: function GroupItems_init() {

View File

@ -186,6 +186,23 @@ function iQClass(selector, context) {
iQClass.prototype = { 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 // Start with an empty selector
selector: "", selector: "",

View File

@ -854,6 +854,13 @@ Item.prototype = {
// Class: Items // Class: Items
// Keeps track of all Items. // Keeps track of all Items.
let Items = { let Items = {
// ----------
// Function: toString
// Prints [Items] for debug use
toString: function Items_toString() {
return "[Items]";
},
// ---------- // ----------
// Variable: defaultGutter // Variable: defaultGutter
// How far apart Items should be from each other and from bounds // 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 EXPORTED_SYMBOLS = ["AllTabs"];
let 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. * Get an array of all tabs from all tabbrowser windows.
* *

View File

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

View File

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

View File

@ -50,6 +50,13 @@ let Storage = {
CACHE_CLIENT_IDENTIFIER: "tabview-cache", CACHE_CLIENT_IDENTIFIER: "tabview-cache",
CACHE_PREFIX: "moz-panorama:", CACHE_PREFIX: "moz-panorama:",
// ----------
// Function: toString
// Prints [Storage] for debug use
toString: function Storage_toString() {
return "[Storage]";
},
// ---------- // ----------
// Function: init // Function: init
// Sets up the object. // Sets up the object.
@ -413,6 +420,13 @@ function CacheListener(callback) {
}; };
CacheListener.prototype = { CacheListener.prototype = {
// ----------
// Function: toString
// Prints [CacheListener] for debug use
toString: function CacheListener_toString() {
return "[CacheListener]";
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsICacheListener]), QueryInterface: XPCOMUtils.generateQI([Ci.nsICacheListener]),
onCacheEntryAvailable: function (entry, access, status) { onCacheEntryAvailable: function (entry, access, status) {
this.callback(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(), { 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 // Function: forceCanvasSize
// Repaints the thumbnail with the given resolution, and forces it // Repaints the thumbnail with the given resolution, and forces it
@ -814,6 +821,13 @@ let TabItems = {
_reconnectingPaused: false, _reconnectingPaused: false,
tabItemPadding: {}, tabItemPadding: {},
// ----------
// Function: toString
// Prints [TabItems count=count] for debug use
toString: function TabItems_toString() {
return "[TabItems count=" + this.items.length + "]";
},
// ---------- // ----------
// Function: init // Function: init
// Set up the necessary tracking to maintain the <TabItems>s. // Set up the necessary tracking to maintain the <TabItems>s.
@ -1342,6 +1356,13 @@ TabPriorityQueue.prototype = {
_low: [], // low priority queue _low: [], // low priority queue
_high: [], // high 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 // Function: clear
// Empty the update queue // Empty the update queue
@ -1443,6 +1464,13 @@ function TabCanvas(tab, canvas) {
}; };
TabCanvas.prototype = { TabCanvas.prototype = {
// ----------
// Function: toString
// Prints [TabCanvas (tab)] for debug use
toString: function TabCanvas_toString() {
return "[TabCanvas (" + this.tab + ")]";
},
// ---------- // ----------
// Function: paint // Function: paint
paint: function TabCanvas_paint(evt) { paint: function TabCanvas_paint(evt) {

View File

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

View File

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