From d71fe0501fc2a792b65f76145550f040201bd386 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Fri, 11 May 2018 13:46:51 -0400 Subject: Generalize comment styles for @license matching at license_read(), and avoid parsing empty whitespace sections --- main_background.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'main_background.js') 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){ -- cgit v1.2.3