summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/_debugger.js4
-rw-r--r--test/simple/test-debugger-repl-break-in-module.js10
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/_debugger.js b/lib/_debugger.js
index 170f5e7e6e..10096b5eaa 100644
--- a/lib/_debugger.js
+++ b/lib/_debugger.js
@@ -1398,8 +1398,8 @@ Interface.prototype.setBreakpoint = function(script, line,
};
} else {
this.print('Warning: script \'' + script + '\' was not loaded yet.');
- var normalizedPath = script.replace('([/.?*])', '\\$1');
- var scriptPathRegex = '^(.*[\\/\\\\])?' + normalizedPath + '$';
+ var escapedPath = script.replace(/([/\\.?*()^${}|[\]])/g, '\\$1');
+ var scriptPathRegex = '^(.*[\\/\\\\])?' + escapedPath + '$';
req = {
type: 'scriptRegExp',
target: scriptPathRegex,
diff --git a/test/simple/test-debugger-repl-break-in-module.js b/test/simple/test-debugger-repl-break-in-module.js
index ddf17f8ee1..1fe0aba841 100644
--- a/test/simple/test-debugger-repl-break-in-module.js
+++ b/test/simple/test-debugger-repl-break-in-module.js
@@ -31,6 +31,12 @@ repl.addTest('sb("mod.js", 23)', [
/1/, /2/, /3/, /4/, /5/, /6/
]);
+// Check escaping of regex characters
+repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
+ /Warning: script '[^']+' was not loaded yet\./,
+ /1/, /2/, /3/, /4/, /5/, /6/
+]);
+
// continue - the breakpoint should be triggered
repl.addTest('c', [
/break in .*[\\\/]mod\.js:23/,
@@ -47,7 +53,9 @@ repl.addTest('restart', [].concat(
repl.handshakeLines,
[
/Restoring breakpoint mod.js:23/,
- /Warning: script 'mod\.js' was not loaded yet\./
+ /Warning: script 'mod\.js' was not loaded yet\./,
+ /Restoring breakpoint \).*:\d+/,
+ /Warning: script '\)[^']*' was not loaded yet\./
],
repl.initialBreakLines));