mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-27 22:03:36 +01:00
Add guard to mappings.add similar to that in commands.add, preventing external scripts from adding builtin mappings.
This commit is contained in:
@@ -338,6 +338,9 @@ var Mappings = Module("mappings", {
|
|||||||
* @optional
|
* @optional
|
||||||
*/
|
*/
|
||||||
add: function () {
|
add: function () {
|
||||||
|
util.assert(util.isDactyl(Components.stack.caller),
|
||||||
|
"User scripts may not add builtin mappings. Please use group.mappings.add instead.");
|
||||||
|
|
||||||
let map = this.builtin.add.apply(this.builtin, arguments);
|
let map = this.builtin.add.apply(this.builtin, arguments);
|
||||||
map.definedAt = contexts.getCaller(Components.stack.caller);
|
map.definedAt = contexts.getCaller(Components.stack.caller);
|
||||||
return map;
|
return map;
|
||||||
|
|||||||
Reference in New Issue
Block a user