Skip to content

Commit bf925e3

Browse files
committed
Validate rule.id before adding handler with it.
1 parent cd16b6a commit bf925e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/chrome/content/code/ApplicableList.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ 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+
}
215219
command.setAttribute('id', rule.id+'-command');
216220
command.setAttribute('label', rule.name);
217221
command.setAttribute('oncommand', 'toggle_rule("'+rule.id+'")');

0 commit comments

Comments
 (0)