From 42d700237558058eae8267ee91d95e46083fc9be Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 26 May 2010 01:31:12 +0200 Subject: Finally! Cancel in the comment dialog box avoids submit. --- bugzillaBugTriage.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index dcb6130..619ed33 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -654,8 +654,9 @@ Logger.prototype.addLogRecord = function(that) { rec.url = that.doc.location.toString(); rec.title = that.title; let comment = jetpack.tabs.focused.contentWindow.prompt( - "Enter comments for this comment").trim(); - if (comment.length > 0) { + "Enter comments for this comment"); + if (comment && comment.length > 0) { + comment = comment.trim(); console.log("comment = " + comment); console.log(""); rec.comment = comment; @@ -1424,7 +1425,9 @@ BZPage.prototype.setUpLogging = function() { console.log("Installing submit callback!"); this.doc.forms.namedItem("changeform").addEventListener("submit",function (evt) { console.log("Submit callback!"); - if (that.log.addLogRecord(that) === null) { + let resp = that.log.addLogRecord(that); + console.log("resp = " + resp); + if (resp === null) { console.log("Avoiding submitting!"); // FIXME doesn't work ... still submitting' evt.stopPropagation(); -- cgit