Skip to content

Commit

Permalink
[shell mode] Fix unsafe use of object
Browse files Browse the repository at this point in the history
Parsing the word constructor would look up words["constructor"], and
return Object.prototype.constructor instead of a style string.

Closes #793
  • Loading branch information
marijnh committed Sep 4, 2012
1 parent 79fa0bd commit 9adaafa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mode/shell/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CodeMirror.defineMode('shell', function(config) {
stream.eatWhile(/\w/);
var cur = stream.current();
if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
return words[cur] || null;
return words.hasOwnProperty(cur) ? words[cur] : null;
}

function tokenString(quote) {
Expand Down

0 comments on commit 9adaafa

Please sign in to comment.