Skip to content

Commit

Permalink
Detect and handle Firebug related problems.
Browse files Browse the repository at this point in the history
* Check for `chromeWin.Firebug`.
* Check for an undefined `fbContext`.

Intentionally leave logging in place, so that if error cases have been
missed (or appear), they are noticed in the future.

Signed-off-by: Johan Sundström <oyasumi+github@gmail.com>
  • Loading branch information
arantius authored and johan committed Aug 13, 2009
1 parent f47d7f6 commit f02d2e3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/greasemonkey.js
Expand Up @@ -380,13 +380,23 @@ var greasemonkeyService = {
},

getFirebugConsole: function(unsafeContentWin, chromeWin) {
// If we can't find this object, there's no chance the rest of this
// function will work.
if ('undefined'==typeof chromeWin.Firebug) return null;

try {
chromeWin = chromeWin.top;
var fbVersion = parseFloat(chromeWin.Firebug.version, 10);
var fbConsole = chromeWin.Firebug.Console;
var fbContext = chromeWin.TabWatcher &&
chromeWin.TabWatcher.getContextByWindow(unsafeContentWin);

// Firebug 1.4 will give no context, when disabled for the current site.
// We can't run that way.
if ('undefined'==typeof fbContext) {
return null;
}

function findActiveContext() {
for (var i=0; i<fbContext.activeConsoleHandlers.length; i++) {
if (fbContext.activeConsoleHandlers[i].window == unsafeContentWin) {
Expand Down Expand Up @@ -437,8 +447,6 @@ var greasemonkeyService = {

greasemonkeyService.wrappedJSObject = greasemonkeyService;

//loggify(greasemonkeyService, "greasemonkeyService");



/**
Expand Down

0 comments on commit f02d2e3

Please sign in to comment.