Skip to content

Commit d4f6799

Browse files
committed
Improvements in response to feedback from AMO-editors.
1 parent 8048085 commit d4f6799

File tree

5 files changed

+7
-24
lines changed

5 files changed

+7
-24
lines changed

src/chrome/content/code/ApplicableList.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,9 @@ ApplicableList.prototype = {
212212

213213
add_command: function(rule) {
214214
var command = this.document.createElement("command");
215-
if (typeof rule.id !== 'number') {
216-
this.log(WARN, "Rule has invalid id " + rule.id);
217-
return;
218-
}
219215
command.setAttribute('id', rule.id+'-command');
220216
command.setAttribute('label', rule.name);
221-
command.setAttribute('oncommand', 'toggle_rule("'+rule.id+'")');
217+
command.setAttribute('oncommand', 'toggle_rule("'+JSON.stringify(rule.id)+'")');
222218
this.commandset.appendChild(command);
223219
},
224220

src/chrome/content/code/ChannelReplacement.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CtxCapturingListener.prototype = {
1313
},
1414
onDataAvailable: function(request, ctx, inputStream, offset, count) {},
1515
onStopRequest: function(request, ctx, statusCode) {},
16-
QueryInterface: xpcom_generateQI([Ci.nsIStreamListener])
16+
QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener])
1717
};
1818

1919
function ChannelReplacement(chan, newURI, newMethod) {
@@ -211,7 +211,7 @@ ChannelReplacement.prototype = {
211211

212212
_redirectCallback: ("nsIAsyncVerifyRedirectCallback" in Ci)
213213
? {
214-
QueryInterface: xpcom_generateQI([Ci.nsIAsyncVerifyRedirectCallback]),
214+
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAsyncVerifyRedirectCallback]),
215215
onRedirectVerifyCallback: function(result) {}
216216
}
217217
: null
@@ -332,7 +332,7 @@ function LoadGroupWrapper(channel, callback) {
332332
channel.loadGroup = this;
333333
}
334334
LoadGroupWrapper.prototype = {
335-
QueryInterface: xpcom_generateQI([Ci.nsILoadGroup]),
335+
QueryInterface: XPCOMUtils.generateQI([Ci.nsILoadGroup]),
336336

337337
get activeCount() {
338338
return this._inner ? this._inner.activeCount : 0;
@@ -380,7 +380,7 @@ LoadGroupWrapper.prototype = {
380380
if (this._channel.loadGroup) this._channel.loadGroup = this._inner;
381381
},
382382
_emptyEnum: {
383-
QueryInterface: xpcom_generateQI([Ci.nsISimpleEnumerator]),
383+
QueryInterface: XPCOMUtils.generateQI([Ci.nsISimpleEnumerator]),
384384
getNext: function() { return null; },
385385
hasMoreElements: function() { return false; }
386386
}

src/chrome/content/code/Cookie.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,6 @@ Cookie.prototype = {
143143
get isDomain() { return this.domain && this.domain[0] == '.'; },
144144
policy: 0,
145145
status: 0,
146-
QueryInterface: xpcom_generateQI([Ci.nsICookie, Ci.nsICookie2])
146+
QueryInterface: XPCOMUtils.generateQI([Ci.nsICookie, Ci.nsICookie2])
147147

148148
};

src/chrome/content/code/IOUtil.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function nsISupportsWrapper(wrapped) {
5757
this.wrappedJSObject = wrapped;
5858
}
5959
nsISupportsWrapper.prototype = {
60-
QueryInterface: xpcom_generateQI([])
60+
QueryInterface: XPCOMUtils.generateQI([])
6161
};
6262

6363
const IOUtil = {

src/components/https-everywhere.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,26 +125,13 @@ var ABE = {
125125
}
126126
};
127127

128-
function xpcom_generateQI(iids) {
129-
var checks = [];
130-
for each (var iid in iids) {
131-
checks.push("CI." + iid.name + ".equals(iid)");
132-
}
133-
var src = checks.length
134-
? "if (" + checks.join(" || ") + ") return this;\n"
135-
: "";
136-
return new Function("iid", src + "throw Components.results.NS_ERROR_NO_INTERFACE;");
137-
}
138-
139128
function xpcom_checkInterfaces(iid,iids,ex) {
140129
for (var j = iids.length; j-- >0;) {
141130
if (iid.equals(iids[j])) return true;
142131
}
143132
throw ex;
144133
}
145134

146-
INCLUDE('ChannelReplacement', 'IOUtil', 'HTTPSRules', 'HTTPS', 'Thread', 'ApplicableList');
147-
148135
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
149136

150137
// This is black magic for storing Expando data w/ an nsIDOMWindow

0 commit comments

Comments
 (0)