Changeset 92135 in webkit
- Timestamp:
- Aug 1, 2011, 12:25:00 PM (15 years ago)
- Location:
- trunk/Tools
- Files:
-
- 14 edited
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js (modified) (1 diff)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js (modified) (4 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js (modified) (2 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js (modified) (1 diff)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js (modified) (2 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js (modified) (2 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js (modified) (2 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js (modified) (1 diff)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js (modified) (2 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js (modified) (8 diffs)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js (modified) (1 diff)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html (modified) (1 diff)
-
BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html (modified) (1 diff)
-
ChangeLog (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js
r89588 r92135 24 24 */ 25 25 26 function Bugzilla(baseURL) { 27 this.baseURL = baseURL; 28 this._cache = {}; 29 } 26 var bugzilla = bugzilla || {}; 30 27 31 Bugzilla.prototype = { 32 quickSearch: function(query, callback) { 33 var cacheKey = 'quickSearch_' + query; 34 if (cacheKey in this._cache) { 35 callback(this._cache[cacheKey]); 36 return; 37 } 28 (function() { 38 29 39 var callbacksCacheKey = 'quickSearchCallbacks_' + query; 40 if (callbacksCacheKey in this._cache) { 41 this._cache[callbacksCacheKey].push(callback); 42 return; 43 } 44 45 this._cache[callbacksCacheKey] = [callback]; 46 47 var queryParameters = { 48 ctype: 'rss', 49 order: 'bugs.bug_id desc', 50 quicksearch: query, 51 }; 52 53 var self = this; 54 fetchResource(this.baseURL + 'buglist.cgi', 'POST', queryParameters, function(xhr) { 55 var entries = xhr.responseXML.getElementsByTagName('entry'); 56 var results = Array.prototype.map.call(entries, function(entry) { 57 var container = document.createElement('div'); 58 container.innerHTML = entry.getElementsByTagName('summary')[0].textContent; 59 var statusRow = container.querySelector('tr.bz_feed_bug_status'); 60 return { 61 title: entry.getElementsByTagName('title')[0].textContent, 62 url: entry.getElementsByTagName('id')[0].textContent, 63 status: statusRow.cells[1].textContent, 64 }; 65 }); 66 67 self._cache[cacheKey] = results; 68 69 var callbacks = self._cache[callbacksCacheKey]; 70 delete self._cache[callbacksCacheKey]; 71 72 callbacks.forEach(function(callback) { 73 callback(results); 74 }); 75 }); 76 }, 30 var kOpenStatuses = { 31 UNCONFIRMED: true, 32 NEW: true, 33 ASSIGNED: true, 34 REOPENED: true, 77 35 }; 78 36 79 Bugzilla.isOpenStatus = function(status) {80 const openStatuses ={81 UNCONFIRMED: true,82 NEW: true,83 ASSIGNED: true,84 REOPENED: true,37 var g_searchCache = new base.AsynchronousCache(function(query, callback) { 38 var url = config.kBugzillaURL + '/buglist.cgi?' + $.param({ 39 ctype: 'rss', 40 order: 'bugs.bug_id desc', 41 quicksearch: query, 42 }); 85 43 86 }; 87 return status in openStatuses; 44 $.get(url, function(responseXML) { 45 var entries = responseXML.getElementsByTagName('entry'); 46 var results = Array.prototype.map.call(entries, function(entry) { 47 var container = document.createElement('div'); 48 // FIXME: Is this an XSS risk? 49 container.innerHTML = entry.getElementsByTagName('summary')[0].textContent; 50 var statusRow = container.querySelector('tr.bz_feed_bug_status'); 51 return { 52 title: entry.getElementsByTagName('title')[0].textContent, 53 url: entry.getElementsByTagName('id')[0].textContent, 54 status: statusRow.cells[1].textContent, 55 }; 56 }); 57 callback(results); 58 }); 59 }); 60 61 bugzilla.quickSearch = function(query, callback) 62 { 63 g_searchCache.get(query, callback); 64 }; 65 66 bugzilla.isOpenStatus = function(status) 67 { 68 return status in kOpenStatuses; 88 69 }; 89 70 90 71 // This value is built-in to all Bugzilla installations. See <http://webkit.org/b/61660>. 91 Bugzilla.maximumBugTitleLength = 255; 72 bugzilla.kMaximumBugTitleLength = 255; 73 74 })(); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js
r91538 r92135 24 24 */ 25 25 26 function FailingTestsBugForm( bugzilla,tester, failingBuildName, passingBuildName, failingTests) {27 TestRelatedBugForm.call(this, bugzilla,tester);26 function FailingTestsBugForm(tester, failingBuildName, passingBuildName, failingTests) { 27 TestRelatedBugForm.call(this, tester); 28 28 29 29 this._failingBuildName = failingBuildName; … … 80 80 var title = titlePrefix + this._failingTests.join(', ') + titleSuffix; 81 81 82 if (title.length <= Bugzilla.maximumBugTitleLength)82 if (title.length <= bugzilla.kMaximumBugTitleLength) 83 83 return title; 84 84 … … 86 86 if (pathPrefix) { 87 87 title = titlePrefix + this._failingTests.length + ' ' + pathPrefix + ' tests' + titleSuffix; 88 if (title.length <= Bugzilla.maximumBugTitleLength)88 if (title.length <= bugzilla.kMaximumBugTitleLength) 89 89 return title; 90 90 } … … 92 92 title = titlePrefix + this._failingTests.length + ' tests' + titleSuffix; 93 93 94 console.assert(title.length <= Bugzilla.maximumBugTitleLength);94 console.assert(title.length <= bugzilla.kMaximumBugTitleLength); 95 95 return title; 96 96 }, -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js
r91538 r92135 29 29 30 30 function createTestForm(testerName, failingBuildName, passingBuildName, failingTests) { 31 var mockBugzilla = {};32 mockBugzilla.baseURL = '[BUGZILLA BASE URL]';33 34 31 var mockBuildbot = {}; 35 32 mockBuildbot.parseBuildName = function(buildName) { … … 48 45 } 49 46 50 return new FailingTestsBugForm(mockBu gzilla, mockBuilder, failingBuildName, passingBuildName, failingTests);47 return new FailingTestsBugForm(mockBuilder, failingBuildName, passingBuildName, failingTests); 51 48 } 52 49 -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js
r91278 r92135 24 24 */ 25 25 26 function FlakyTestBugForm( bugzilla,tester, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) {27 TestRelatedBugForm.call(this, bugzilla,tester);26 function FlakyTestBugForm(tester, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) { 27 TestRelatedBugForm.call(this, tester); 28 28 29 29 this._failingBuildNames = failingBuildNames; -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js
r91278 r92135 29 29 30 30 function createTestForm(failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount) { 31 var mockBugzilla = {};32 mockBugzilla.baseURL = '[BUGZILLA BASE URL]';33 34 31 var mockBuildbot = {}; 35 32 mockBuildbot.parseBuildName = function(buildName) { … … 48 45 } 49 46 50 return new FlakyTestBugForm(mockBu gzilla, mockBuilder, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount);47 return new FlakyTestBugForm(mockBuilder, failingBuildNames, failingTest, oldestAnalyzedBuild, newestAnalyzedBuild, analyzedBuildCount); 51 48 } 52 49 -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js
r90814 r92135 24 24 */ 25 25 26 function NewBugForm(bugzilla) { 27 this._bugzilla = bugzilla; 26 function NewBugForm() { 28 27 } 29 28 … … 53 52 var form = document.createElement('form'); 54 53 form.method = 'POST'; 55 form.action = this._bugzilla.baseURL + 'enter_bug.cgi';54 form.action = config.kBugzillaURL + '/enter_bug.cgi'; 56 55 57 56 for (var key in formData) { -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js
r90814 r92135 41 41 42 42 function createTestForm() { 43 var mockBugzilla = {}; 44 mockBugzilla.baseURL = 'http://bugs.example.com/'; 45 46 var form = new NewBugForm(mockBugzilla); 43 var form = new NewBugForm(); 47 44 for (var key in testFormData) { 48 45 form[key] = testFormData[key].value; … … 63 60 equal(formElement.tagName, 'FORM'); 64 61 equal(formElement.method, 'POST'); 65 equal(formElement.action, 'http ://bugs.example.com/enter_bug.cgi');62 equal(formElement.action, 'https://bugs.webkit.org/enter_bug.cgi'); 66 63 }); 67 64 -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js
r91272 r92135 24 24 */ 25 25 26 function TestRelatedBugForm( bugzilla,tester) {27 NewBugForm.call(this , bugzilla);26 function TestRelatedBugForm(tester) { 27 NewBugForm.call(this); 28 28 29 29 this._tester = tester; -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js
r91272 r92135 29 29 30 30 function createTestForm(testerName) { 31 var mockBugzilla = {};32 mockBugzilla.baseURL = '[BUGZILLA BASE URL]';33 34 31 var mockBuildbot = {}; 35 32 mockBuildbot.parseBuildName = function(buildName) { … … 48 45 } 49 46 50 return new TestRelatedBugForm(mockBu gzilla, mockBuilder);47 return new TestRelatedBugForm(mockBuilder); 51 48 } 52 49 -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js
r91546 r92135 24 24 */ 25 25 26 function ViewController(buildbot , bugzilla) {26 function ViewController(buildbot) { 27 27 this._buildbot = buildbot; 28 this._bugzilla = bugzilla;29 28 this._navigationID = 0; 30 29 … … 104 103 105 104 if (passingBuildName || !stillFetchingData) { 106 var bugForm = new FailingTestsBugForm( self._bugzilla,builder, buildName, passingBuildName, failingTestNames);105 var bugForm = new FailingTestsBugForm(builder, buildName, passingBuildName, failingTestNames); 107 106 item.appendChild(self._domForNewAndExistingBugs(builder, failingTestNames, bugForm)) 108 107 } … … 245 244 246 245 _domForAuxiliaryUIElements: function() { 247 if (!this._bugzilla)248 return document.createDocumentFragment();249 250 246 var aside = document.createElement('aside'); 251 247 aside.appendChild(document.createTextNode('Something not working? Have an idea to improve this page? ')); … … 262 258 short_desc: 'TestFailures page needs more unicorns!', 263 259 }; 264 link.href = addQueryParametersToURL( this._bugzilla.baseURL + 'enter_bug.cgi', queryParameters);260 link.href = addQueryParametersToURL(config.kBugzillaURL + 'enter_bug.cgi', queryParameters); 265 261 link.target = '_blank'; 266 262 … … 328 324 var result = document.createDocumentFragment(); 329 325 330 if (!this._bugzilla)331 return result;332 333 326 var container = document.createElement('p'); 334 327 result.appendChild(container); … … 341 334 bugsContainer.appendChild(document.createTextNode('Searching for bugs related to ' + (failingTests.length > 1 ? 'these tests' : 'this test') + '\u2026')); 342 335 343 this._bugzilla.quickSearch('ALL ' + failingTests.join('|'), function(bugs) {336 bugzilla.quickSearch('ALL ' + failingTests.join('|'), function(bugs) { 344 337 if (!bugs.length) { 345 338 bugsContainer.parentNode.removeChild(bugsContainer); … … 368 361 } 369 362 370 var openBugs = bugs.filter(function(bug) { return Bugzilla.isOpenStatus(bug.status) });371 var closedBugs = bugs.filter(function(bug) { return ! Bugzilla.isOpenStatus(bug.status) });363 var openBugs = bugs.filter(function(bug) { return bugzilla.isOpenStatus(bug.status) }); 364 var closedBugs = bugs.filter(function(bug) { return !bugzilla.isOpenStatus(bug.status) }); 372 365 373 366 list.appendChildren(openBugs.map(bugToListItem)); … … 455 448 456 449 var failingBuildNames = failures.map(function(historyItem) { return historyItem.build }); 457 var bugForm = new FlakyTestBugForm( self._bugzilla,builder, failingBuildNames, testName, allBuilds.last(), allBuilds[0], allBuilds.length);450 var bugForm = new FlakyTestBugForm(builder, failingBuildNames, testName, allBuilds.last(), allBuilds[0], allBuilds.length); 458 451 container.appendChild(self._domForNewAndExistingBugs(builder, [testName], bugForm)); 459 452 } -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js
r92060 r92135 31 31 32 32 config.kTracURL = 'http://trac.webkit.org'; 33 config.kBugzillaURL = 'https://bugs.webkit.org'; 33 34 34 35 config.kRevisionAttr = 'data-revision'; -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html
r92134 r92135 33 33 <script src="base.js"></script> 34 34 <script src="Trac.js"></script> 35 <script src="Bugzilla.js"></script> 35 36 <script src="builders.js"></script> 36 37 <script src="checkout.js"></script> -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html
r91538 r92135 53 53 <script src="WebKitBuildbot.js"></script> 54 54 <script> 55 var viewController = new ViewController(new WebKitBuildbot() , new Bugzilla('https://bugs.webkit.org/'));55 var viewController = new ViewController(new WebKitBuildbot()); 56 56 </script> 57 57 </head> -
trunk/Tools/ChangeLog
r92134 r92135 1 2011-08-01 Adam Barth <abarth@webkit.org> 2 3 Refactor bugzilla.js for use by garden-o-matic 4 https://bugs.webkit.org/show_bug.cgi?id=65450 5 6 Reviewed by Dimitri Glazkov. 7 8 This patch refactors bugzilla.js to use the AsynchronousCache and 9 updates the style to use a module instead of an object. This patch 10 then fixes all the existing code that uses this class to use the new 11 API style. 12 13 This main benefit of this patch is we remove the tricky manual caching 14 and this code is now available to use in garden-o-matic (since the 15 dependency on Utilities.js is now gone). 16 17 I ran all the unit tests and poked around in TestFailures a bit to see 18 that everything seemed to be working properly. 19 20 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/Bugzilla.js: 21 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm.js: 22 (FailingTestsBugForm): 23 (FailingTestsBugForm.prototype._createBugTitle): 24 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FailingTestsBugForm_unittests.js: 25 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm.js: 26 (FlakyTestBugForm): 27 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/FlakyTestBugForm_unittests.js: 28 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm.js: 29 (NewBugForm): 30 (NewBugForm.prototype.domElement): 31 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/NewBugForm_unittests.js: 32 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm.js: 33 (TestRelatedBugForm): 34 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/TestRelatedBugForm_unittests.js: 35 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/ViewController.js: 36 (ViewController.prototype._displayBuilder.start): 37 (ViewController.prototype._displayBuilder): 38 (ViewController.prototype._domForAuxiliaryUIElements): 39 (ViewController.prototype._domForNewAndExistingBugs.bugzilla.quickSearch): 40 (ViewController.prototype._domForPossiblyFlakyTests.flakyList.appendChildren): 41 (ViewController.prototype._domForPossiblyFlakyTests): 42 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/config.js: 43 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/garden-o-matic.html: 44 * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/index.html: 45 1 46 2011-08-01 Adam Barth <abarth@webkit.org> 2 47
Note:
See TracChangeset
for help on using the changeset viewer.