diff options
-rw-r--r-- | data/bzpage.js | 90 | ||||
-rw-r--r-- | data/rhbzpage.js | 56 | ||||
-rw-r--r-- | docs/bzpage.md | 0 | ||||
-rw-r--r-- | docs/rhbzpage.md | 0 |
4 files changed, 81 insertions, 65 deletions
diff --git a/data/bzpage.js b/data/bzpage.js index 7538b80..def12a7 100644 --- a/data/bzpage.js +++ b/data/bzpage.js @@ -13,6 +13,22 @@ var BTSPassRealm = "BTSXMLRPCPass"; // ============================================ +/** + * object to pack messaging. Use as in + postMessage(new Message("GetPassword", { + login: login, + hostname: location.hostname + })); + */ +function Message(cmd, data) { + this.cmd = cmd; + this.data = data; +} + +function log(msg) { + postMessage(new Message("LogMessage", msg)); +} + var NotLoggedinException = function NotLoggedinException (message) { this.message = message; this.name = "NotLoggedinException"; @@ -28,7 +44,7 @@ exports.NotLoggedinException = NotLoggedinException; * In case URL contains alias, not the real bug number, get the real bug no * from the XML representation. Sets correct value to this.bugNo. */ -function getRealBugNo() { +nonTestedFunction getRealBugNo() { console.log("We have to deal with bug aliased as " + this.bugNo); var that = this; // https://bugzilla.redhat.com/show_bug.cgi?ctype=xml&id=serialWacom @@ -51,7 +67,7 @@ function getRealBugNo() { /** * */ -function getInstalledPackages(cfg) { +nonTestedFunction getInstalledPackages(cfg) { var installedPackages = {}; var enabledPackages = []; @@ -89,7 +105,7 @@ function getInstalledPackages(cfg) { * @param cmdLabel String with the name of the command to be executed * @param cmdParams Object with the appropriate parameters for the command */ -function centralCommandDispatch (cmdLabel, cmdParams) { +nonTestedFunction centralCommandDispatch (cmdLabel, cmdParams) { switch (cmdLabel) { case "resolution": case "product": @@ -198,7 +214,7 @@ function centralCommandDispatch (cmdLabel, cmdParams) { * everywhere except of Internet Explorer this should work well, but waiting * impatiently when this bite us. */ -function executeCommand (cmd) { +nonTestedFunction executeCommand (cmd) { var cmdArr = cmd.split("//"); var commentObj = this.packages[cmdArr[0]][cmdArr[1]]; @@ -215,7 +231,7 @@ function executeCommand (cmd) { * Value null clears "Reset Assignee to default for component" checkbox * @return none */ -function changeAssignee (newAssignee) { +nonTestedFunction changeAssignee (newAssignee) { var defAssigneeButton = null; // Previous assignee should know what's going on in his bug this.addToCCList(this.owner); @@ -257,7 +273,7 @@ function changeAssignee (newAssignee) { * If the 'comment_action' scroll down box doesn't exist, this * function will set up new one. */ -function addToCommentsDropdown (pkg, cmd) { +nonTestedFunction addToCommentsDropdown (pkg, cmd) { var select = this.doc.getElementById("comment_action"); if (!select) { var that = this; @@ -299,7 +315,7 @@ function addToCommentsDropdown (pkg, cmd) { * @param Boolean breakBefore if there should be a <br> element before. * @return none */ -function createDeadLink (id, text, parent, callback, params, before, covered, accesskey) { +nonTestedFunction createDeadLink (id, text, parent, callback, params, before, covered, accesskey) { var that = this; params = util.valToArray(params); var locParent = {}; @@ -346,7 +362,7 @@ function createDeadLink (id, text, parent, callback, params, before, covered, ac * @param id String which command to take * @return none */ -function createNewButton (location, after, pkg, id) { +nonTestedFunction createNewButton (location, after, pkg, id) { var that = this; var cmdObj = this.packages[pkg][id]; var newId = id + "_btn"; @@ -398,7 +414,7 @@ function createNewButton (location, after, pkg, id) { /** * */ -function generateButtons () { +nonTestedFunction generateButtons () { var topRowPosition = "topRowPositionID"; var bottomRowPosition = "commit"; @@ -432,7 +448,7 @@ function generateButtons () { } } -function setConfigurationButton () { +nonTestedFunction setConfigurationButton () { var additionalButtons = this.doc.querySelector("#bugzilla-body *.related_actions"); var configurationButtonUI = this.doc.createElement("li"); configurationButtonUI.innerHTML = "\u00A0-\u00A0<a href='' id='configurationButton'>" @@ -464,7 +480,7 @@ function setConfigurationButton () { * @return String with the address or null * */ -function parseMailto(aElement) { +nonTestedFunction parseMailto(aElement) { var emailStr = "", hrefStr = ""; // use url utils if (aElement) { @@ -485,7 +501,7 @@ function parseMailto(aElement) { * * @return string */ -function getReporter () { +nonTestedFunction getReporter () { var reporterElement = this.getOptionTableCell("bz_show_bug_column_2", "Reported"); // RH Bugzilla after upgrade to 3.6.2 moved the information to other column if (!reporterElement) { @@ -496,7 +512,7 @@ function getReporter () { return this.parseMailto(reporterElement); } -function getComponent() { +nonTestedFunction getComponent() { var elem = this.doc.getElementById("component"); if (elem) { return elem.value; @@ -505,7 +521,7 @@ function getComponent() { } -function commentsWalker (fce) { +nonTestedFunction commentsWalker (fce) { var comments = this.doc.getElementById("comments").getElementsByClassName( "bz_comment"); Array.forEach(comments, function(item) { @@ -517,7 +533,7 @@ function commentsWalker (fce) { * Set background color of all comments made by reporter in ReporterColor color * */ -function checkComments () { +nonTestedFunction checkComments () { var that = this; var reporterRE = new RegExp(this.getReporter()); this.commentsWalker(function(x) { @@ -529,7 +545,7 @@ function checkComments () { }); } -function collectComments () { +nonTestedFunction collectComments () { var outStr = ""; this.commentsWalker(function(x) { outStr += x.getElementsByTagName("pre")[0].textContent + "\n"; @@ -548,7 +564,7 @@ function collectComments () { * @return none * */ -function selectOption (id, label, fireEvent) { +nonTestedFunction selectOption (id, label, fireEvent) { if (!fireEvent) { fireEvent = true; } @@ -561,7 +577,7 @@ function selectOption (id, label, fireEvent) { } } -function selectOptionByLabel(id, label, fireEvent) { +nonTestedFunction selectOptionByLabel(id, label, fireEvent) { if (!fireEvent) { fireEvent = true; } @@ -588,7 +604,7 @@ function selectOptionByLabel(id, label, fireEvent) { * @param String ID of the element to send mouseclick to * @return None */ -function clickMouse (targetID) { +nonTestedFunction clickMouse (targetID) { var localEvent = this.doc.createEvent("MouseEvents"); localEvent.initMouseEvent("click", true, true, this.doc.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null); @@ -603,7 +619,7 @@ function clickMouse (targetID) { * * @return none */ -function addStuffToTextBox (id, stuff) { +nonTestedFunction addStuffToTextBox (id, stuff) { var textBox = this.doc.getElementById(id); if (textBox.tagName.toLowerCase() === "textarea") { stuff = textBox.value ? "\n\n" + stuff : stuff; @@ -619,7 +635,7 @@ function addStuffToTextBox (id, stuff) { * @param id String with the id of the element * @param stuff String/Array with keyword(s) to be removed */ -function removeStuffFromTextBox (id, stuff) { +nonTestedFunction removeStuffFromTextBox (id, stuff) { var changedElement = this.getElementById(id); changedElement.value = util.removeCSVValue(changedElement.value,stuff); } @@ -631,7 +647,7 @@ function removeStuffFromTextBox (id, stuff) { * @param str String to be searched for * @return Boolean found? */ -function idContainsWord (id, str) { +nonTestedFunction idContainsWord (id, str) { var kwd = ""; try { kwd = this.doc.getElementById(id).value; @@ -648,7 +664,7 @@ function idContainsWord (id, str) { * @param str String with the keyword * @return Boolean */ -function hasKeyword (str) { +nonTestedFunction hasKeyword (str) { return (this.idContainsWord('keywords', str)); } @@ -656,7 +672,7 @@ function hasKeyword (str) { @return Element with the href attribute containng the information */ -function getOptionTableCell(tableId, label) { +nonTestedFunction getOptionTableCell(tableId, label) { var cleanLabelRE = /^\s*([^.:]*):?\s*$/; label = label.trim().replace(cleanLabelRE,"$1").toLowerCase(); @@ -682,7 +698,7 @@ function getOptionTableCell(tableId, label) { * @todo TODO we may extend this to general setNeedinfo function * with parameter [reporter|assignee|general-email-address] */ -function setNeedinfoReporter () { +nonTestedFunction setNeedinfoReporter () { this.clickMouse("needinfo"); this.selectOption("needinfo_role", "reporter"); } @@ -690,7 +706,7 @@ function setNeedinfoReporter () { /** * */ -function getOwner () { +nonTestedFunction getOwner () { // TODO(maemo) doesn't work on maemo var assigneeAElement = this.getOptionTableCell("bz_show_bug_column_1","Assigned To"); return this.parseMailto(assigneeAElement); @@ -702,7 +718,7 @@ function getOwner () { * * @return String with the maintainer's email address */ -function getDefaultBugzillaMaintainer (component) { +nonTestedFunction getDefaultBugzillaMaintainer (component) { var address = util.filterByRegexp(this.defBugzillaMaintainerArr, component); return address; } @@ -716,7 +732,7 @@ function getDefaultBugzillaMaintainer (component) { * element itself */ -function parseAttachmentLine(inElem) { +nonTestedFunction parseAttachmentLine(inElem) { var MIMEtype = ""; var size = 0; @@ -753,7 +769,7 @@ function parseAttachmentLine(inElem) { * string of MIME type, integer of size in kilobytes, and the whole * element itself */ -function getAttachments () { +nonTestedFunction getAttachments () { var outAtts = []; var atts = this.doc.getElementById("attachment_table") .getElementsByTagName("tr"); @@ -768,7 +784,7 @@ function getAttachments () { * * @return String with the login name of the currently logged-in user */ -function getLogin () { +nonTestedFunction getLogin () { var lastLIElement = this.doc.querySelector("#header ul.links li:last-of-type"); var loginArr = lastLIElement.textContent.split("\n"); var loginStr = loginArr[loginArr.length - 1].trim(); @@ -781,7 +797,7 @@ function getLogin () { * * @return String with the password */ -function getPassword (login) { +nonTestedFunction getPassword (login) { var passPrompt = "Enter your Bugzilla password for fixing MIME attachment types"; var switchPrompt = "Do you want to switch off features requiring password completely?"; var prefName = BTSPrefNS+"withoutPassowrd"; @@ -810,7 +826,7 @@ function getPassword (login) { /** * */ -function setUpLogging () { +nonTestedFunction setUpLogging () { // Protection against double-call if (this.doc.getElementById("generateTSButton")) { return ; @@ -860,7 +876,7 @@ function setUpLogging () { } } -function getSelectionOrClipboard () { +nonTestedFunction getSelectionOrClipboard () { var text = selection.text; if (!text) { text = clip.get(); @@ -878,7 +894,7 @@ function getSelectionOrClipboard () { * @return None * */ -function queryInNewTab(text, component, product) { +nonTestedFunction queryInNewTab(text, component, product) { var urlStr = "https://bugzilla.redhat.com/buglist.cgi?query_format=advanced"; if (product) { urlStr += "&product=" + product.trim(); @@ -926,7 +942,7 @@ function queryInNewTab(text, component, product) { * Get the text to search for and prepare other things for the real executive * function this.queryInNewTab, and run it. */ -function queryForSelection() { +nonTestedFunction queryForSelection() { var text = this.getSelectionOrClipboard(); if (text) { this.queryInNewTab(text, this.getComponent()); @@ -939,7 +955,7 @@ function queryForSelection() { * @param who String with email address or "self" if the current user * of the bugzilla should be added */ -function addToCCList (who) { +nonTestedFunction addToCCList (who) { if (!who) { return ; } @@ -958,7 +974,7 @@ function addToCCList (who) { * * @return Array with email addresses as Strings. */ -function getCCList () { +nonTestedFunction getCCList () { var CCListSelect = this.doc.getElementById("cc"); var outCCList = []; if (CCListSelect) { diff --git a/data/rhbzpage.js b/data/rhbzpage.js index d4d071a..1d0907a 100644 --- a/data/rhbzpage.js +++ b/data/rhbzpage.js @@ -13,7 +13,7 @@ var titleParsedAttachment = "Part of the thread where crash happened"; * @return String what would be a default assignee if * we haven't set it up. */ -function getDefaultAssignee() { +nonTestedFunction getDefaultAssignee() { return util.filterByRegexp(this.constantData.defaultAssignee, this.getComponent()).toLowerCase(); } @@ -24,7 +24,7 @@ function getDefaultAssignee() { * @return none * sets this.defaultAssignee property according to defaultAssignee list */ -function setDefaultAssignee() { +nonTestedFunction setDefaultAssignee() { this.defaultAssignee = this.getDefaultAssignee(); var defAss = this.defaultAssignee; @@ -38,7 +38,7 @@ function setDefaultAssignee() { /** * Auxiliary function to compute more complicated resolution */ -function closeSomeRelease() { +nonTestedFunction closeSomeRelease() { // for RAWHIDE close as RAWHIDE, // if active selection -> CURRENTRELEASE // and put the release version to @@ -65,7 +65,7 @@ function closeSomeRelease() { /** * Additional commands specific for this subclass, overriding superclass one. */ -function RHcentralCommandDispatch(cmdLabel, cmdParams) { +nonTestedFunction RHcentralCommandDispatch(cmdLabel, cmdParams) { console.log("cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams); switch (cmdLabel) { // Set up our own commands @@ -100,7 +100,7 @@ function RHcentralCommandDispatch(cmdLabel, cmdParams) { * This has to stay in RHBugzillaPage because upstream doesn't have addAttachment * XML-RPC call yet. */ -function addAttachment(data, callback, param) { +nonTestedFunction addAttachment(data, callback, param) { var msg = new xrpc.XMLRPCMessage("bugzilla.addAttachment"); var that = this; @@ -135,7 +135,7 @@ function addAttachment(data, callback, param) { /** * */ -function pasteBacktraceInComments() { +nonTestedFunction pasteBacktraceInComments() { var that = this; /* @@ -210,7 +210,7 @@ function pasteBacktraceInComments() { * @param id Number of the attachment id * @return none */ -function showAttachment(id) { +nonTestedFunction showAttachment(id) { var that = this; Request({ url: "https://" + that.hostname + "/attachment.cgi?id=" + id, @@ -233,7 +233,7 @@ function showAttachment(id) { * * @param att Attachment object */ -function addShowParsedBTLink(att) { +nonTestedFunction addShowParsedBTLink(att) { var elem = att[4].querySelector("td:last-of-type"); this.createDeadLink("showParsedBacktraceWindow-" + att[1], "showBT", elem, this.showAttachment, att[1], true); @@ -242,7 +242,7 @@ function addShowParsedBTLink(att) { /** * Unfinished ... see above */ -function addNewAttachmentRow(origAtt, +nonTestedFunction addNewAttachmentRow(origAtt, newAttId, newAttSize) { var that = this; var oldAddBTLink = this.doc.getElementById("attachBacktraceActivator"); @@ -291,7 +291,7 @@ function addNewAttachmentRow(origAtt, * @param snippet String with parsed backtrace * @return none */ -function addCheckShowLink(oldAtt, snippet) { +nonTestedFunction addCheckShowLink(oldAtt, snippet) { var that = this; var elem = oldAtt[4].querySelector("td:last-of-type"); this.createDeadLink("attachBacktraceActivator", "add parsed BT", elem, function(x) { @@ -307,7 +307,7 @@ function addCheckShowLink(oldAtt, snippet) { * @param atts Array of attachments subarrays * @return none */ -function markBadAttachments(atts) { +nonTestedFunction markBadAttachments(atts) { var that = this; var badMIMEArray = [ "application/octet-stream", "text/x-log", "undefined" ]; if (!this.password) { @@ -340,7 +340,7 @@ function markBadAttachments(atts) { * * @return Boolean true if it is a RHEL bug */ -function isEnterprise() { +nonTestedFunction isEnterprise() { var prod = this.product; var result = this.constantData.ProfessionalProducts.some(function(elem,idx,arr) { return new RegExp(elem).test(prod); @@ -353,7 +353,7 @@ function isEnterprise() { * * @return Boolean whether the bug has been triaged or not */ -function isTriaged() { +nonTestedFunction isTriaged() { return this.hasKeyword("Triaged"); } @@ -365,7 +365,7 @@ function isTriaged() { * @param its String with the IsueTracker numbers * @return none */ -function setBranding() { +nonTestedFunction setBranding() { var brandColor = {}; var TriagedColor = {}; @@ -436,7 +436,7 @@ function setBranding() { * * @return none */ -function queryUpstream() { +nonTestedFunction queryUpstream() { var text = this.getSelectionOrClipboard(); if (text) { var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug; @@ -462,7 +462,7 @@ function queryUpstream() { * * @return none */ -function sendBugUpstream() { +nonTestedFunction sendBugUpstream() { var that = this; var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this .getComponent()); @@ -487,7 +487,7 @@ function sendBugUpstream() { * * @return none */ -function addCheckXorgLogLink() { +nonTestedFunction addCheckXorgLogLink() { var that = this; if (this.xorglogAnalysis) { this.XorgLogAttList.forEach(function (row) { @@ -507,7 +507,7 @@ function addCheckXorgLogLink() { * @param driverStr String with the driver name * @return None */ -function fillInWhiteBoard(iLine, driverStr) { +nonTestedFunction fillInWhiteBoard(iLine, driverStr) { var that = this; function groupIDs(manStr, cardStrID) { @@ -587,7 +587,7 @@ function fillInWhiteBoard(iLine, driverStr) { * * @return None */ -function fillInChipMagic() { +nonTestedFunction fillInChipMagic() { var that = this; var XorgLogURL = ""; var XorgLogAttID = ""; @@ -629,7 +629,7 @@ function fillInChipMagic() { this.XorgLogAttListIndex++; } -function analyzeXorgLog(attachID) { +nonTestedFunction analyzeXorgLog(attachID) { var infoWin = this.win.open("", "Check att. " + attachID, "width=640,height=640,status=no,location=no"); var doc = infoWin.document; @@ -676,7 +676,7 @@ function analyzeXorgLog(attachID) { * @param URLhostname String hostname of the external bugzilla * @return String with the string for the external_id SELECT */ -function getBugzillaName(URLhostname) { +nonTestedFunction getBugzillaName(URLhostname) { var bugzillaID = ""; var bzLabelNames = JSON.parse(self.data.load("bugzillalabelNames.json")); if (bzLabelNames[URLhostname]) { @@ -696,7 +696,7 @@ function getBugzillaName(URLhostname) { * + responseHeaders * + responseText */ -function XMLRPCcallback() { +nonTestedFunction XMLRPCcallback() { var that = this; this.reqCounter--; if (this.reqCounter <= 0) { @@ -728,7 +728,7 @@ function XMLRPCcallback() { * this change }; * */ -function fixAttachById(id, type, email) { +nonTestedFunction fixAttachById(id, type, email) { if (type === undefined) { type = "text/plain"; } @@ -769,7 +769,7 @@ function fixAttachById(id, type, email) { * <TR> DOM jQuery element with a bad attachment * @return none */ -function addTextLink(row) { +nonTestedFunction addTextLink(row) { var elemS = row[4].getElementsByTagName("td"); var elem = elemS[elemS.length - 1]; this.createDeadLink("addFix2TextLink", "text", elem, @@ -782,7 +782,7 @@ function addTextLink(row) { * @param evt Event which called this handler * @return none */ -function addClosingUpstream() { +nonTestedFunction addClosingUpstream() { var refs = this.doc.getElementById("external_bugs_table") .getElementsByTagName("tr"); @@ -826,7 +826,7 @@ function addClosingUpstream() { } } -function markBugTriaged() { +nonTestedFunction markBugTriaged() { // Now we lie completely, we just set keyword Triaged, // this is not just plain ASSIGNED, but // modified according to @@ -849,7 +849,7 @@ function markBugTriaged() { /** * */ -function parseBacktrace (ret) { +nonTestedFunction parseBacktrace (ret) { var splitArray = ret.split("\n"); var i = 0, ii = splitArray.length; var outStr = "", curLine = "", numStr = ""; @@ -881,7 +881,7 @@ function parseBacktrace (ret) { return ""; } -function RHBugzillaPage(win, config) { +nonTestedFunction RHBugzillaPage(win, config) { // inheritance ... call superobject's constructor BZPage.call(this, win, config); diff --git a/docs/bzpage.md b/docs/bzpage.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/docs/bzpage.md diff --git a/docs/rhbzpage.md b/docs/rhbzpage.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/docs/rhbzpage.md |