Merge pull request #34 from esben-semmle/js/twitter_text-library

Approved by xiemaisi
This commit is contained in:
semmle-qlci
2018-08-15 14:45:52 +01:00
committed by GitHub
4 changed files with 49 additions and 0 deletions

View File

@@ -843,6 +843,41 @@ private class ApplicationInsights extends FrameworkLibraryWithURLRegex {
}
}
/**
* The twitter-text framework.
*/
private class TwitterText extends FrameworkLibraryWithGenericURL, FrameworkLibraryWithMarkerComment {
TwitterText() { this = "twitter-text" }
override string getAMarkerCommentRegex() {
result = "(?s).*twitter-text\\s*(<VERSION>).*"
}
}
/**
* The classic version of twitter-text, as seen in the wild.
*/
private class TwitterTextClassic extends FrameworkLibraryWithURLRegex {
TwitterTextClassic() { this = "twitter-text" }
override string getAURLRegex() {
result = ".*(?:^|/)twitter_text" + variantRegex() + "\\.js"
}
}
/**
* A copy of twitter-text.
*/
private class TwitterTextClassicInstance extends FrameworkLibraryInstance {
TwitterTextClassicInstance() {
this.(TopLevel).getFile().getAbsolutePath().regexpMatch(any(TwitterTextClassic t).getAURLRegex())
}
override predicate info(FrameworkLibrary fl, string v) {
fl instanceof TwitterTextClassic and
v = ""
}
}
/**
* A `FrameworkLibraryReference` that refers to a recognised `FrameworkLibraryInstance`,
* that is, a `<script>` tag where the `src` attribute can be resolved to a local file

View File

@@ -19,6 +19,8 @@
| tmpl.html:0:0:0:0 | tmpl.html | template |
| tst.browserify.js:0:0:0:0 | tst.browserify.js | generated |
| tst.dart.js:0:0:0:0 | tst.dart.js | generated |
| twitter-text.js:0:0:0:0 | twitter-text.js | library |
| twitter_text.js:0:0:0:0 | twitter_text.js | library |
| unannotated-externs-1.js:0:0:0:0 | unannotated-externs-1.js | externs |
| unannotated-externs-2.js:0:0:0:0 | unannotated-externs-2.js | externs |
| unannotated-externs-3.js:0:0:0:0 | unannotated-externs-3.js | externs |

View File

@@ -0,0 +1,11 @@
/*!
* twitter-text 2.0.4
*
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this work except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*/

View File

@@ -0,0 +1 @@
// classic version of twitter-text, as seen in the wild