Skip to content

Commit 8e92b51

Browse files
committed
Pass URI instead of browser in ApplicableList constructor
1 parent b576002 commit 8e92b51

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/chrome/content/code/ApplicableList.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44

55
serial_number = 0;
66

7-
function ApplicableList(logger, browser) {
7+
function ApplicableList(logger, uri) {
88
this.log = logger;
9-
this.uri = browser.currentURI.clone();
9+
this.uri = uri.clone();
1010
if (!this.uri) {
1111
this.log(WARN,"NULL CLONING URI " + doc);
12-
if (browser)
13-
this.log(WARN,"NULL CLONING URI " + browser.currentURI);
14-
if (browser.currentURI)
15-
this.log(WARN,"NULL CLONING URI " + browser.currentURI.spec);
12+
if (uri) {
13+
this.log(WARN,"NULL CLONING URI " + uri.spec);
14+
}
1615
}
17-
this.home = browser.currentURI.spec; // what doc we're housekeeping for
16+
this.home = uri.spec; // what doc we're housekeeping for
1817
this.active = {};
1918
this.breaking = {}; // rulesets with redirection loops
2019
this.inactive = {};

src/chrome/content/toolbar_button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function show_applicable_list(menupopup) {
286286
// This case occurs for error pages and similar. We need a dummy alist
287287
// because populate_menu lives in there. Would be good to refactor this
288288
// away.
289-
alist = new HTTPSEverywhere.ApplicableList(HTTPSEverywhere.log, browser);
289+
alist = new HTTPSEverywhere.ApplicableList(HTTPSEverywhere.log, browser.currentURI);
290290
weird = true;
291291
}
292292
alist.populate_menu(document, menupopup, weird);

src/components/https-everywhere.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ HTTPSEverywhere.prototype = {
341341
this.log(WARN, "Get alist without browser");
342342
return null;
343343
}
344-
var alist = new ApplicableList(this.log,browser);
344+
var alist = new ApplicableList(this.log, browser.currentURI);
345345
this.setExpando(browser,"applicable_rules",alist);
346346
return alist;
347347
},
@@ -355,7 +355,7 @@ HTTPSEverywhere.prototype = {
355355
if (alist) {
356356
return alist;
357357
} else {
358-
alist = new ApplicableList(this.log,browser);
358+
alist = new ApplicableList(this.log, browser.currentURI);
359359
this.setExpando(browser,"applicable_rules",alist);
360360
}
361361
return alist;
@@ -608,7 +608,7 @@ HTTPSEverywhere.prototype = {
608608
new_alist = old_alist;
609609
this.setExpando(browser,"applicable_rules",new_alist);
610610
} else if (!new_alist) {
611-
new_alist = new ApplicableList(this.log, browser);
611+
new_alist = new ApplicableList(this.log, browser.currentURI);
612612
this.setExpando(browser,"applicable_rules",new_alist);
613613
}
614614
return new_alist;

0 commit comments

Comments
 (0)