| Index: lib/elemHide.js |
| =================================================================== |
| --- a/lib/elemHide.js |
| +++ b/lib/elemHide.js |
| @@ -248,34 +248,41 @@ let ElemHide = exports.ElemHide = |
| return; |
| } |
| IO.writeToFile(styleURL.file, this._generateCSSContent(), function(e) |
| { |
| TimeLine.enter("ElemHide.apply() write callback"); |
| this._applying = false; |
| - if (e && e.result == Cr.NS_ERROR_NOT_AVAILABLE) |
| - IO.removeFile(styleURL.file, function(e2) {}); |
| + // _generateCSSContent is throwing NS_ERROR_NOT_AVAILABLE to indicate that |
| + // there are no filters. If that exception is passed through XPCOM we will |
| + // see a proper exception here, otherwise a number. |
| + let noFilters = (e == Cr.NS_ERROR_NOT_AVAILABLE || (e && e.result == Cr.NS_ERROR_NOT_AVAILABLE)); |
| + if (noFilters) |
| + { |
| + e = null; |
| + IO.removeFile(styleURL.file, function(e) {}); |
| + } |
| else if (e) |
| Cu.reportError(e); |
| if (this._needsApply) |
| { |
| this._needsApply = false; |
| this.apply(); |
| } |
| - else if (!e || e.result == Cr.NS_ERROR_NOT_AVAILABLE) |
| + else if (!e) |
| { |
| ElemHide.isDirty = false; |
| ElemHide.unapply(); |
| TimeLine.log("ElemHide.unapply() finished"); |
| - if (!e) |
| + if (!noFilters) |
| { |
| try |
| { |
| Utils.styleService.loadAndRegisterSheet(styleURL, Ci.nsIStyleSheetService.USER_SHEET); |
| ElemHide.applied = true; |
| } |
| catch (e) |
| { |