mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Merge pull request #3134 from Rummskartoffel/master
Prevent setURL from setting invalid RegEx patterns
This commit is contained in:
commit
5915cdc10f
1 changed files with 12 additions and 3 deletions
|
@ -1142,8 +1142,10 @@ const platform_defaults = {
|
|||
},
|
||||
linux: {
|
||||
nmaps: {
|
||||
";x": 'hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + pos.x + " " + pos.y + "; xdotool click 1")}',
|
||||
";X": 'hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + pos.x + " " + pos.y + "; xdotool keydown ctrl+shift; xdotool click 1; xdotool keyup ctrl+shift")}',
|
||||
";x":
|
||||
'hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + pos.x + " " + pos.y + "; xdotool click 1")}',
|
||||
";X":
|
||||
'hint -F e => { const pos = tri.dom.getAbsoluteCentre(e); tri.excmds.exclaim_quiet("xdotool mousemove --sync " + pos.x + " " + pos.y + "; xdotool keydown ctrl+shift; xdotool click 1; xdotool keyup ctrl+shift")}',
|
||||
} as unknown,
|
||||
},
|
||||
} as Record<browser.runtime.PlatformOs, default_config>
|
||||
|
@ -1356,7 +1358,14 @@ export async function pull() {
|
|||
* Like set(), but for a specific pattern.
|
||||
*/
|
||||
export function setURL(pattern, ...args) {
|
||||
try {
|
||||
new RegExp(pattern)
|
||||
return set("subconfigs", pattern, ...args)
|
||||
} catch (err) {
|
||||
if (err instanceof SyntaxError)
|
||||
throw new SyntaxError(`invalid pattern: ${err.message}`)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
/** Full target specification, then value
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue