mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
+ Got rid of Utils.logger and replaced it with Utils.log, Utils.trace and Utils.error
+ Fixed "new tabs create 2 thumbnails" bug
This commit is contained in:
parent
c7608d3d62
commit
e771f496b6
@ -8,8 +8,11 @@ const Cr = Components.results;
|
||||
// Get this in a way where we can load the page automatically
|
||||
// where it doesn't need to be focused...
|
||||
var homeWindow = Cc["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher)
|
||||
.activeWindow;
|
||||
.getService(Ci.nsIWindowWatcher)
|
||||
.activeWindow;
|
||||
|
||||
var consoleService = Cc["@mozilla.org/consoleservice;1"]
|
||||
.getService(Components.interfaces.nsIConsoleService);
|
||||
|
||||
var Utils = {
|
||||
get activeWindow(){
|
||||
@ -26,7 +29,6 @@ var Utils = {
|
||||
return tabBrowser.selectedTab;
|
||||
},
|
||||
|
||||
|
||||
get homeTab(){
|
||||
for( var i=0; i<Tabs.length; i++){
|
||||
if(Tabs[i].contentWindow.location.host == "tabcandy"){
|
||||
@ -36,11 +38,40 @@ var Utils = {
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
log: function(value) {
|
||||
if(typeof(value) == 'object')
|
||||
value = this.expandObject(value);
|
||||
|
||||
consoleService.logStringMessage(value);
|
||||
},
|
||||
|
||||
get logger(){
|
||||
return homeWindow.Firebug.Console
|
||||
}
|
||||
error: function(text) {
|
||||
Components.utils.reportError(text);
|
||||
},
|
||||
|
||||
trace: function(text) {
|
||||
if(typeof(printStackTrace) != 'function')
|
||||
this.log(text + ' trace: you need to include stacktrace.js');
|
||||
else {
|
||||
var calls = printStackTrace();
|
||||
calls.splice(0, 3); // Remove this call and the printStackTrace calls
|
||||
this.log(text + ' trace:\n' + calls.join('\n'));
|
||||
}
|
||||
},
|
||||
|
||||
expandObject: function(obj) {
|
||||
var s = obj + ' = {';
|
||||
for(prop in obj) {
|
||||
var value = obj[prop];
|
||||
s += prop + ": "
|
||||
+ (typeof(value) == 'string' ? '\'' : '')
|
||||
+ value
|
||||
+ (typeof(value) == 'string' ? '\'' : '')
|
||||
+ ", ";
|
||||
}
|
||||
return s + '}';
|
||||
}
|
||||
}
|
||||
|
||||
window.Utils = Utils;
|
||||
|
Loading…
Reference in New Issue
Block a user