mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Make stripCommentHeaders
less greedy, to ensure that it doesn't eat 'use strict' directive at the top of files (PR 6627 follow-up)
While browsing through the latest PDF.js update on mozilla-central, see aef06cd725
, I noticed that the `'use strict';` directives were missing at the top of a number of files.
This is fallout from the changes made in `make.js` in PR 6627, since `stripCommentHeaders` previously relied on the existence of the mode-lines.
I'm assuming that we do want *all* of the code (e.g. the viewer too) to execute in strict mode, hence this patch tweaks `stripCommentHeaders` to make it less greedy.
This commit is contained in:
parent
373da010ac
commit
c310a3790e
1 changed files with 3 additions and 2 deletions
5
make.js
5
make.js
|
@ -606,8 +606,9 @@ target.singlefile = function() {
|
|||
function stripCommentHeaders(content, filename) {
|
||||
var notEndOfComment = '(?:[^*]|\\*(?!/))+';
|
||||
var reg = new RegExp(
|
||||
'\n(?:/\\*' + notEndOfComment + '\\*/\\s*|//(?!#).*\n\\s*)+' +
|
||||
'\'use strict\';', 'g');
|
||||
'\n/\\* Copyright' + notEndOfComment + '\\*/\\s*' +
|
||||
'(?:/\\*' + notEndOfComment + '\\*/\\s*|//(?!#).*\n\\s*)*' +
|
||||
'\\s*\'use strict\';', 'g');
|
||||
content = content.replace(reg, '');
|
||||
return content;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue