aboutsummaryrefslogtreecommitdiff
path: root/main_background.js
diff options
context:
space:
mode:
authorRuben Rodriguez <ruben@fsf.org>2018-05-11 13:46:51 -0400
committerRuben Rodriguez <ruben@fsf.org>2018-05-11 13:46:51 -0400
commitd71fe0501fc2a792b65f76145550f040201bd386 (patch)
treeac16dec656175325cb9186982a0549871d63ca09 /main_background.js
parent598ca7b8d266f5d60a306e92993bc79d97d5f9aa (diff)
Generalize comment styles for @license matching at license_read(), and avoid parsing empty whitespace sections
Diffstat (limited to 'main_background.js')
-rw-r--r--main_background.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/main_background.js b/main_background.js
index 050f41e..7a856b8 100644
--- a/main_background.js
+++ b/main_background.js
@@ -869,7 +869,11 @@ function license_read(script_src, name){
}
while(true){ // TODO: refactor me
// TODO: support multiline comments
- var matches = /\/\/\s*?(@license)\s([\S]+)\s([\S]+$)/gm.exec(unedited_src);
+ var matches = /\/[\/\*]\s*?(@license)\s([\S]+)\s([\S]+$)/gm.exec(unedited_src);
+ var empty = /[^\s]/gm.exec(unedited_src);
+ if(empty == null){
+ return [true,edited_src,reason_text];
+ }
if(matches == null){
nontrivial_status = evaluate(unedited_src,name);
if(nontrivial_status[0] == true){