Skip to content

Commit

Permalink
Simplify error reporting from getTabPrivacyContext()
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Feb 26, 2016
1 parent e49f6cf commit 7973197
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -4062,7 +4062,7 @@ var privateTab = {
return window.gBrowser.contentWindow
|| window.gBrowser.contentWindowAsCPOW;
},
getTabPrivacyContext: function(tab) {
getTabPrivacyContext: function(tab, _silent) {
var browser = tab.linkedBrowser;
if(!browser) {
Components.utils.reportError(
Expand All @@ -4071,21 +4071,15 @@ var privateTab = {
);
}
var window = browser.contentWindow || browser.contentWindowAsCPOW;
try { // Yes, even this simple check may raise "cross-process JS call failed" error
if(!window || !("QueryInterface" in window))
throw "not usable";
try {
return this.getPrivacyContext(window);
}
catch(e) {
if(e != "not usable")
if(!_silent)
Components.utils.reportError(e);
Components.utils.reportError(
LOG_PREFIX
+ "getTabPrivacyContext(): tab.linkedBrowser.contentWindow is null or not usable. Electrolysis?"
+ "\nCall stack:\n" + new Error().stack
);
return null; // Nothing to do, sorry
_log("getTabPrivacyContext() failed. Electrolysis? Call stack:\n" + new Error().stack);
}
return this.getPrivacyContext(window);
return null;
},
isPrivateTab: function(tab) {
var privacyContext = this.getTabPrivacyContext(tab);
Expand Down

0 comments on commit 7973197

Please sign in to comment.