Diff
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -23,69 +23,52 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-function Bugzilla(baseURL) {
- this.baseURL = baseURL;
- this._cache = {};
-}
+var bugzilla = bugzilla || {};
-Bugzilla.prototype = {
- quickSearch: function(query, callback) {
- var cacheKey = 'quickSearch_' + query;
- if (cacheKey in this._cache) {
- callback(this._cache[cacheKey]);
- return;
- }
+(function() {
- var callbacksCacheKey = 'quickSearchCallbacks_' + query;
- if (callbacksCacheKey in this._cache) {
- this._cache[callbacksCacheKey].push(callback);
- return;
- }
+var kOpenStatuses = {
+ UNCONFIRMED: true,
+ NEW: true,
+ ASSIGNED: true,
+ REOPENED: true,
+};
- this._cache[callbacksCacheKey] = [callback];
+var g_searchCache = new base.AsynchronousCache(function(query, callback) {
+ var url = "" + '/buglist.cgi?' + $.param({
+ ctype: 'rss',
+ order: 'bugs.bug_id desc',
+ quicksearch: query,
+ });
- var queryParameters = {
- ctype: 'rss',
- order: 'bugs.bug_id desc',
- quicksearch: query,
- };
-
- var self = this;
- fetchResource(this.baseURL + 'buglist.cgi', 'POST', queryParameters, function(xhr) {
- var entries = xhr.responseXML.getElementsByTagName('entry');
- var results = Array.prototype.map.call(entries, function(entry) {
- var container = document.createElement('div');
- container.innerHTML = entry.getElementsByTagName('summary')[0].textContent;
- var statusRow = container.querySelector('tr.bz_feed_bug_status');
- return {
- title: entry.getElementsByTagName('title')[0].textContent,
- url: entry.getElementsByTagName('id')[0].textContent,
- status: statusRow.cells[1].textContent,
- };
- });
-
- self._cache[cacheKey] = results;
-
- var callbacks = self._cache[callbacksCacheKey];
- delete self._cache[callbacksCacheKey];
-
- callbacks.forEach(function(callback) {
- callback(results);
- });
+ $.get(url, function(responseXML) {
+ var entries = responseXML.getElementsByTagName('entry');
+ var results = Array.prototype.map.call(entries, function(entry) {
+ var container = document.createElement('div');
+ // FIXME: Is this an XSS risk?
+ container.innerHTML = entry.getElementsByTagName('summary')[0].textContent;
+ var statusRow = container.querySelector('tr.bz_feed_bug_status');
+ return {
+ title: entry.getElementsByTagName('title')[0].textContent,
+ url: entry.getElementsByTagName('id')[0].textContent,
+ status: statusRow.cells[1].textContent,
+ };
});
- },
+ callback(results);
+ });
+});
+
+bugzilla.quickSearch = function(query, callback)
+{
+ g_searchCache.get(query, callback);
};
-Bugzilla.isOpenStatus = function(status) {
- const openStatuses = {
- UNCONFIRMED: true,
- NEW: true,
- ASSIGNED: true,
- REOPENED: true,
-
- };
- return status in openStatuses;
+bugzilla.isOpenStatus = function(status)
+{
+ return status in kOpenStatuses;
};
// This value is built-in to all Bugzilla installations. See <http://webkit.org/b/61660>.
-Bugzilla.maximumBugTitleLength = 255;
+bugzilla.kMaximumBugTitleLength = 255;
+
+})();
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -23,8 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-function FailingTestsBugForm(bugzilla, tester, failingBuildName, passingBuildName, failingTests) {
- TestRelatedBugForm.call(this, bugzilla, tester);
+function FailingTestsBugForm(tester, failingBuildName, passingBuildName, failingTests) {
+ TestRelatedBugForm.call(this, tester);
this._failingBuildName = failingBuildName;
this._passingBuildName = passingBuildName;
@@ -79,19 +79,19 @@
var titleSuffix = ' failing on ' + this._tester.name;
var title = titlePrefix + this._failingTests.join(', ') + titleSuffix;
- if (title.length <= Bugzilla.maximumBugTitleLength)
+ if (title.length <= bugzilla.kMaximumBugTitleLength)
return title;
var pathPrefix = longestCommonPathPrefix(this._failingTests);
if (pathPrefix) {
title = titlePrefix + this._failingTests.length + ' ' + pathPrefix + ' tests' + titleSuffix;
- if (title.length <= Bugzilla.maximumBugTitleLength)
+ if (title.length <= bugzilla.kMaximumBugTitleLength)
return title;
}
title = titlePrefix + this._failingTests.length + ' tests' + titleSuffix;
- console.assert(title.length <= Bugzilla.maximumBugTitleLength);
+ console.assert(title.length <= bugzilla.kMaximumBugTitleLength);
return title;
},
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -28,9 +28,6 @@
module('FailingTestsBugForm');
function createTestForm(testerName, failingBuildName, passingBuildName, failingTests) {
- var mockBugzilla = {};
- mockBugzilla.baseURL = '[BUGZILLA BASE URL]';
-
var mockBuildbot = {};
mockBuildbot.parseBuildName = function(buildName) {
var match = /(\d+)/.exec(buildName);
@@ -47,7 +44,7 @@
return '[RESULTS PAGE URL ' + this.name + ', ' + buildName + ']';
}
- return new FailingTestsBugForm(mockBugzilla, mockBuilder, failingBuildName, passingBuildName, failingTests);
+ return new FailingTestsBugForm(mockBuilder, failingBuildName, passingBuildName, failingTests);
}
test('keywords are set', 1, function() {
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -23,8 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-function FlakyTestBugForm(bugzilla, tester, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) {
- TestRelatedBugForm.call(this, bugzilla, tester);
+function FlakyTestBugForm(tester, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) {
+ TestRelatedBugForm.call(this, tester);
this._failingBuildNames = failingBuildNames;
this._failingTest = failingTest;
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -28,9 +28,6 @@
module('FlakyTestBugForm');
function createTestForm(failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) {
- var mockBugzilla = {};
- mockBugzilla.baseURL = '[BUGZILLA BASE URL]';
-
var mockBuildbot = {};
mockBuildbot.parseBuildName = function(buildName) {
var match = /(\d+)/.exec(buildName);
@@ -47,7 +44,7 @@
return '[RESULTS PAGE URL ' + this.name + ', ' + buildName + ']';
}
- return new FlakyTestBugForm(mockBugzilla, mockBuilder, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount);
+ return new FlakyTestBugForm(mockBuilder, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount);
}
const testCases = [
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-function NewBugForm(bugzilla) {
- this._bugzilla = bugzilla;
+function NewBugForm() {
}
NewBugForm.prototype = {
@@ -52,7 +51,7 @@
var form = document.createElement('form');
form.method = 'POST';
- form.action = "" + 'enter_bug.cgi';
+ form.action = "" + '/enter_bug.cgi';
for (var key in formData) {
var input = document.createElement('input');
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -40,10 +40,7 @@
};
function createTestForm() {
- var mockBugzilla = {};
- mockBugzilla.baseURL = 'http://bugs.example.com/';
-
- var form = new NewBugForm(mockBugzilla);
+ var form = new NewBugForm();
for (var key in testFormData) {
form[key] = testFormData[key].value;
}
@@ -62,7 +59,7 @@
var formElement = createTestForm().domElement();
equal(formElement.tagName, 'FORM');
equal(formElement.method, 'POST');
- equal(formElement.action, 'http://bugs.example.com/enter_bug.cgi');
+ equal(formElement.action, 'https://bugs.webkit.org/enter_bug.cgi');
});
test('domElement() contains only hidden input elements', 9, function() {
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -23,8 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-function TestRelatedBugForm(bugzilla, tester) {
- NewBugForm.call(this, bugzilla);
+function TestRelatedBugForm(tester) {
+ NewBugForm.call(this);
this._tester = tester;
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -28,9 +28,6 @@
module('TestRelatedBugForm');
function createTestForm(testerName) {
- var mockBugzilla = {};
- mockBugzilla.baseURL = '[BUGZILLA BASE URL]';
-
var mockBuildbot = {};
mockBuildbot.parseBuildName = function(buildName) {
var match = /(\d+)/.exec(buildName);
@@ -47,7 +44,7 @@
return '[RESULTS PAGE URL ' + this.name + ', ' + buildName + ']';
}
- return new TestRelatedBugForm(mockBugzilla, mockBuilder);
+ return new TestRelatedBugForm(mockBuilder);
}
test('component and keywords are set', 2, function() {
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -23,9 +23,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-function ViewController(buildbot, bugzilla) {
+function ViewController(buildbot) {
this._buildbot = buildbot;
- this._bugzilla = bugzilla;
this._navigationID = 0;
var self = this;
@@ -103,7 +102,7 @@
item.appendChild(self._domForRegressionRange(builder, buildName, passingBuildName, failingTestNames));
if (passingBuildName || !stillFetchingData) {
- var bugForm = new FailingTestsBugForm(self._bugzilla, builder, buildName, passingBuildName, failingTestNames);
+ var bugForm = new FailingTestsBugForm(builder, buildName, passingBuildName, failingTestNames);
item.appendChild(self._domForNewAndExistingBugs(builder, failingTestNames, bugForm))
}
});
@@ -244,9 +243,6 @@
},
_domForAuxiliaryUIElements: function() {
- if (!this._bugzilla)
- return document.createDocumentFragment();
-
var aside = document.createElement('aside');
aside.appendChild(document.createTextNode('Something not working? Have an idea to improve this page? '));
var link = document.createElement('a');
@@ -261,7 +257,7 @@
cc: '[email protected]',
short_desc: 'TestFailures page needs more unicorns!',
};
- link.href = "" + 'enter_bug.cgi', queryParameters);
+ link.href = "" + 'enter_bug.cgi', queryParameters);
link.target = '_blank';
return aside;
@@ -327,9 +323,6 @@
_domForNewAndExistingBugs: function(tester, failingTests, bugForm) {
var result = document.createDocumentFragment();
- if (!this._bugzilla)
- return result;
-
var container = document.createElement('p');
result.appendChild(container);
@@ -340,7 +333,7 @@
bugsContainer.appendChild(document.createTextNode('Searching for bugs related to ' + (failingTests.length > 1 ? 'these tests' : 'this test') + '\u2026'));
- this._bugzilla.quickSearch('ALL ' + failingTests.join('|'), function(bugs) {
+ bugzilla.quickSearch('ALL ' + failingTests.join('|'), function(bugs) {
if (!bugs.length) {
bugsContainer.parentNode.removeChild(bugsContainer);
return;
@@ -367,8 +360,8 @@
return item;
}
- var openBugs = bugs.filter(function(bug) { return Bugzilla.isOpenStatus(bug.status) });
- var closedBugs = bugs.filter(function(bug) { return !Bugzilla.isOpenStatus(bug.status) });
+ var openBugs = bugs.filter(function(bug) { return bugzilla.isOpenStatus(bug.status) });
+ var closedBugs = bugs.filter(function(bug) { return !bugzilla.isOpenStatus(bug.status) });
list.appendChildren(openBugs.map(bugToListItem));
@@ -454,7 +447,7 @@
}));
var failingBuildNames = failures.map(function(historyItem) { return historyItem.build });
- var bugForm = new FlakyTestBugForm(self._bugzilla, builder, failingBuildNames, testName, allBuilds.last(), allBuilds[0], allBuilds.length);
+ var bugForm = new FlakyTestBugForm(builder, failingBuildNames, testName, allBuilds.last(), allBuilds[0], allBuilds.length);
container.appendChild(self._domForNewAndExistingBugs(builder, [testName], bugForm));
}
});
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js 2011-08-01 19:25:00 UTC (rev 92135)
@@ -30,6 +30,7 @@
];
config.kTracURL = 'http://trac.webkit.org';
+config.kBugzillaURL = 'https://bugs.webkit.org';
config.kRevisionAttr = 'data-revision';
config.kTestNameAttr = 'data-test-name';
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html 2011-08-01 19:25:00 UTC (rev 92135)
@@ -32,6 +32,7 @@
<script src=""
<script src=""
<script src=""
+<script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html (92134 => 92135)
--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html 2011-08-01 19:25:00 UTC (rev 92135)
@@ -52,7 +52,7 @@
<script src=""
<script src=""
<script>
- var viewController = new ViewController(new WebKitBuildbot(), new Bugzilla('https://bugs.webkit.org/'));
+ var viewController = new ViewController(new WebKitBuildbot());
</script>
</head>
<body>
Modified: trunk/Tools/ChangeLog (92134 => 92135)
--- trunk/Tools/ChangeLog 2011-08-01 19:23:21 UTC (rev 92134)
+++ trunk/Tools/ChangeLog 2011-08-01 19:25:00 UTC (rev 92135)
@@ -1,5 +1,50 @@
2011-08-01 Adam Barth <[email protected]>
+ Refactor bugzilla.js for use by garden-o-matic
+ https://bugs.webkit.org/show_bug.cgi?id=65450
+
+ Reviewed by Dimitri Glazkov.
+
+ This patch refactors bugzilla.js to use the AsynchronousCache and
+ updates the style to use a module instead of an object. This patch
+ then fixes all the existing code that uses this class to use the new
+ API style.
+
+ This main benefit of this patch is we remove the tricky manual caching
+ and this code is now available to use in garden-o-matic (since the
+ dependency on Utilities.js is now gone).
+
+ I ran all the unit tests and poked around in TestFailures a bit to see
+ that everything seemed to be working properly.
+
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js:
+ (FailingTestsBugForm):
+ (FailingTestsBugForm.prototype._createBugTitle):
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js:
+ (FlakyTestBugForm):
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js:
+ (NewBugForm):
+ (NewBugForm.prototype.domElement):
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js:
+ (TestRelatedBugForm):
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js:
+ (ViewController.prototype._displayBuilder.start):
+ (ViewController.prototype._displayBuilder):
+ (ViewController.prototype._domForAuxiliaryUIElements):
+ (ViewController.prototype._domForNewAndExistingBugs.bugzilla.quickSearch):
+ (ViewController.prototype._domForPossiblyFlakyTests.flakyList.appendChildren):
+ (ViewController.prototype._domForPossiblyFlakyTests):
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html:
+ * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html:
+
+2011-08-01 Adam Barth <[email protected]>
+
garden-o-matic shouldn't require local server to determine if compile failed
https://bugs.webkit.org/show_bug.cgi?id=65446