Skip to content

Commit 27b0f73

Browse files
committed
Convert SSL Observatory to use getBrowserForChannel.
1 parent d324c10 commit 27b0f73

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

https-everywhere-tests/test_profile_skeleton/prefs.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ user_pref("general.warnOnAboutConfig", false);
1212
// Minimize unnecesary requests.
1313
user_pref("browser.safebrowsing.enabled", false);
1414
user_pref("browser.safebrowsing.malware.enabled", false);
15+
// These two preferences allow debugging the extension
16+
// using Tools > Web Developer > Browser Toolbox
17+
// (Note: Since this is not an SDK extension, you can't use the Addon
18+
// Debugger, but the Browser Toolbox is just about as good).
19+
user_pref("devtools.chrome.enabled", true);
20+
user_pref("devtools.debugger.remote-enabled", true);

src/components/ssl-observatory.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,13 @@ SSLObservatory.prototype = {
502502
// active now
503503
return this.everSeenPrivateBrowsing;
504504
}
505-
var win = this.HTTPSEverywhere.getWindowForChannel(channel);
506-
if (!win) return this.everSeenPrivateBrowsing; // windowless request
505+
var browser = this.HTTPSEverywhere.getBrowserForChannel(channel);
506+
// windowless request
507+
if (!browser || !browser.contentWindow) {
508+
return this.everSeenPrivateBrowsing;
509+
}
507510

508-
if (PrivateBrowsingUtils.isWindowPrivate(win)) {
511+
if (PrivateBrowsingUtils.isWindowPrivate(browser.contentWindow)) {
509512
this.everSeenPrivateBrowsing = true;
510513
return true;
511514
}
@@ -816,7 +819,11 @@ SSLObservatory.prototype = {
816819

817820
var that = this; // We have neither SSLObservatory nor this in scope in the lambda
818821

819-
var win = channel ? this.HTTPSEverywhere.getWindowForChannel(channel) : null;
822+
var win = null
823+
if (channel) {
824+
var browser = this.HTTPSEverywhere.getBrowserForChannel(channel);
825+
var win = browser.contentWindow;
826+
}
820827
var req = this.buildRequest(params);
821828
req.timeout = TIMEOUT;
822829

0 commit comments

Comments
 (0)