Permalink
Browse files

Do not attempt to assign to a property of Components.utils.

Like 912cd95 for the 0.9 branch, but cleaner syntax given a night to sleep on it.

Refs #1578
Refs #1594
  • Loading branch information...
1 parent 2a09200 commit d8c616572f527bfd44eeb756ea373b101abceb82 @arantius committed Aug 1, 2012
Showing with 5 additions and 5 deletions.
  1. +5 −5 components/greasemonkey.js
View
@@ -14,10 +14,6 @@ Cu.import("resource://greasemonkey/prefmanager.js");
Cu.import("resource://greasemonkey/util.js");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-if (!Cu.isDeadWrapper) {
- Cu.isDeadWrapper = function() { return false; };
-}
-
var gScriptDirPath = (function() {
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
@@ -431,7 +427,11 @@ service.prototype.__defineGetter__('config', function() {
service.prototype.contentDestroyed = function(contentWindowId) {
this.withAllMenuCommandsForWindowId(null, function(index, command) {
- var closed = Cu.isDeadWrapper(command.contentWindow);
+ // Only Firefox 15+ defines isDeadWrapper; use it to detect dead windows
+ // (for which we will never be able to access the .closed property).
+ var closed = Cu.isDeadWrapper
+ ? Cu.isDeadWrapper(command.contentWindow)
+ : false;
try { closed = command.contentWindow.closed; } catch (e) { }
if (closed ||

0 comments on commit d8c6165

Please sign in to comment.