bugs.webkit.org: "See Also" field should support Chromium bugs

Merge Bugzilla upstream master 3af55bfe0bd10a85b7cd69e26a19034a6d2e78f5.
<https://bugzilla.mozilla.org/show_bug.cgi?id=1252782>

* Bugzilla/BugUrl.pm: Add Bugzilla::BugUrl::Chromium class to
list of classes that parse supported URLs.
* Bugzilla/BugUrl/Chromium.pm: Added.
(should_handle):
(_check_value):
* template/en/default/global/user-error.html.tmpl: Update error
message.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@200457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Websites/bugs.webkit.org/Bugzilla/BugUrl.pm b/Websites/bugs.webkit.org/Bugzilla/BugUrl.pm
index 837c0d4..12d2cb8 100644
--- a/Websites/bugs.webkit.org/Bugzilla/BugUrl.pm
+++ b/Websites/bugs.webkit.org/Bugzilla/BugUrl.pm
@@ -64,6 +64,7 @@
     Bugzilla::BugUrl::Bugzilla
     Bugzilla::BugUrl::Launchpad
     Bugzilla::BugUrl::Google
+    Bugzilla::BugUrl::Chromium
     Bugzilla::BugUrl::Debian
     Bugzilla::BugUrl::JIRA
     Bugzilla::BugUrl::Trac
diff --git a/Websites/bugs.webkit.org/Bugzilla/BugUrl/Chromium.pm b/Websites/bugs.webkit.org/Bugzilla/BugUrl/Chromium.pm
new file mode 100644
index 0000000..5560df2
--- /dev/null
+++ b/Websites/bugs.webkit.org/Bugzilla/BugUrl/Chromium.pm
@@ -0,0 +1,49 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::BugUrl::Chromium;
+
+use 5.10.1;
+use strict;
+use warnings;
+
+use base qw(Bugzilla::BugUrl);
+
+use Bugzilla::Error;
+use Bugzilla::Util;
+
+###############################
+####        Methods        ####
+###############################
+
+sub should_handle {
+    my ($class, $uri) = @_;
+    return ($uri->authority =~ /^bugs.chromium.org$/i) ? 1 : 0;
+}
+
+sub _check_value {
+    my ($class, $uri) = @_;
+
+    $uri = $class->SUPER::_check_value($uri);
+
+    my $value = $uri->as_string;
+    my $project_name;
+    if ($uri->path =~ m|^/p/([^/]+)/issues/detail$|) {
+        $project_name = $1;
+    } else {
+        ThrowUserError('bug_url_invalid', { url => $value });
+    }
+    my $bug_id = $uri->query_param('id');
+    detaint_natural($bug_id);
+    if (!$bug_id) {
+        ThrowUserError('bug_url_invalid', { url => $value, reason => 'id' });
+    }
+
+    return URI->new($value);
+}
+
+1;
diff --git a/Websites/bugs.webkit.org/ChangeLog b/Websites/bugs.webkit.org/ChangeLog
index f67c159..62455f2 100644
--- a/Websites/bugs.webkit.org/ChangeLog
+++ b/Websites/bugs.webkit.org/ChangeLog
@@ -1,3 +1,18 @@
+2016-05-05  David Kilzer  <ddkilzer@apple.com>
+
+        bugs.webkit.org: "See Also" field should support Chromium bugs
+
+        Merge Bugzilla upstream master 3af55bfe0bd10a85b7cd69e26a19034a6d2e78f5.
+        <https://bugzilla.mozilla.org/show_bug.cgi?id=1252782>
+
+        * Bugzilla/BugUrl.pm: Add Bugzilla::BugUrl::Chromium class to
+        list of classes that parse supported URLs.
+        * Bugzilla/BugUrl/Chromium.pm: Added.
+        (should_handle):
+        (_check_value):
+        * template/en/default/global/user-error.html.tmpl: Update error
+        message.
+
 2015-12-09  Daniel Bates  <dabates@apple.com>
 
         REGRESSION: code-review-tests.html fails with error "Received an error at line 214"
diff --git a/Websites/bugs.webkit.org/template/en/default/global/user-error.html.tmpl b/Websites/bugs.webkit.org/template/en/default/global/user-error.html.tmpl
index 8de4124..90143ec 100644
--- a/Websites/bugs.webkit.org/template/en/default/global/user-error.html.tmpl
+++ b/Websites/bugs.webkit.org/template/en/default/global/user-error.html.tmpl
@@ -265,6 +265,7 @@
           installation.</li>
         <li>A b[% %]ug on launchpad.net</li>
         <li>An issue on code.google.com.</li>
+        <li>An issue on b[% %]ugs.chromium.org.</li>
         <li>A b[% %]ug on b[% %]ugs.debian.org.</li>
         <li>An issue in a JIRA installation.</li>
         <li>A ticket in a Trac installation.</li>