[Pkg-javascript-commits] [pdf.js] 43/115: Make `stripCommentHeaders` less greedy, to ensure that it doesn't eat 'use strict' directive at the top of files (PR 6627 follow-up)

David Prévot taffit at moszumanska.debian.org
Wed Dec 16 20:03:13 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit c310a3790e577cd6ff77ff748ce3181192c8a69c
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Sat Nov 21 18:45:06 2015 +0100

    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 https://hg.mozilla.org/integration/fx-team/rev/aef06cd725fc, 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.
---
 make.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/make.js b/make.js
index 72f0f3f..bb36b47 100644
--- a/make.js
+++ b/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;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list