(source: string)
| 133 | } |
| 134 | |
| 135 | private static trimSourceURLComment(source: string): string { |
| 136 | let sourceURLIndex = source.lastIndexOf('//# sourceURL='); |
| 137 | if (sourceURLIndex === -1) { |
| 138 | sourceURLIndex = source.lastIndexOf('//@ sourceURL='); |
| 139 | if (sourceURLIndex === -1) { |
| 140 | return source; |
| 141 | } |
| 142 | } |
| 143 | const sourceURLLineIndex = source.lastIndexOf('\n', sourceURLIndex); |
| 144 | if (sourceURLLineIndex === -1) { |
| 145 | return source; |
| 146 | } |
| 147 | const sourceURLLine = source.substr(sourceURLLineIndex + 1); |
| 148 | if (!sourceURLLine.match(sourceURLRegex)) { |
| 149 | return source; |
| 150 | } |
| 151 | return source.substr(0, sourceURLLineIndex); |
| 152 | } |
| 153 | |
| 154 | isContentScript(): boolean { |
| 155 | return this.#isContentScript; |
no test coverage detected