Add regex to match additional googlesource review links
Should match any googlesource links that have -review in them, with
content before -review and optional content after -review.
That way bug reports can be filed from chromium, android, etc.
Change-Id: I69bf739dbdad953d171ea34e1f0fcd156c5df006
diff --git a/popup.js b/popup.js
index 25d93f0..61c51e7 100644
--- a/popup.js
+++ b/popup.js
@@ -1,3 +1,6 @@
+const REVIEW_LINK_REGEX =
+ /^(?!.*(internal|googleplex))https:\/\/([a-zA-Z0-9-]+)-review\.googlesource\.com/g;
+
function GerritBugReport(currentTab) {
this.image = '';
this.url = currentTab;
@@ -62,9 +65,11 @@
document.addEventListener('DOMContentLoaded', function() {
chrome.tabs.query({currentWindow: true, active: true}, function(tabs){
const currentTab = tabs[0].url;
- if (!currentTab.startsWith('https://gerrit-review.googlesource.com')) {
+
+ if (!currentTab.match(REVIEW_LINK_REGEX)) {
return;
}
+
document.getElementById('error').classList.add('hidden');
document.getElementById('gerritBugReport').classList.remove('hidden');
const button = document.getElementById('screenshotBtn');