Skip to content

Commit

Permalink
Do not attempt to assign to a property of Components.utils.
Browse files Browse the repository at this point in the history
Like 912cd95 for the 0.9 branch, but cleaner syntax given a night to sleep on it.

Refs greasemonkey#1578
Refs greasemonkey#1594
  • Loading branch information
arantius committed Aug 1, 2012
1 parent 2a09200 commit d8c6165
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions components/greasemonkey.js
Expand Up @@ -14,10 +14,6 @@ Cu.import("resource://greasemonkey/prefmanager.js");
Cu.import("resource://greasemonkey/util.js"); Cu.import("resource://greasemonkey/util.js");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");


if (!Cu.isDeadWrapper) {
Cu.isDeadWrapper = function() { return false; };
}

var gScriptDirPath = (function() { var gScriptDirPath = (function() {
var ios = Components.classes["@mozilla.org/network/io-service;1"] var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService); .getService(Components.interfaces.nsIIOService);
Expand Down Expand Up @@ -431,7 +427,11 @@ service.prototype.__defineGetter__('config', function() {


service.prototype.contentDestroyed = function(contentWindowId) { service.prototype.contentDestroyed = function(contentWindowId) {
this.withAllMenuCommandsForWindowId(null, function(index, command) { 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) { } try { closed = command.contentWindow.closed; } catch (e) { }


if (closed || if (closed ||
Expand Down

0 comments on commit d8c6165

Please sign in to comment.