aboutsummaryrefslogtreecommitdiffstats
path: root/bugzillaBugTriage.js
diff options
context:
space:
mode:
Diffstat (limited to 'bugzillaBugTriage.js')
-rw-r--r--bugzillaBugTriage.js28
1 files changed, 20 insertions, 8 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index 0b5546f..c2a7094 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -467,6 +467,16 @@ BzPage.prototype.getOptionValue = function (id) {
* investigate https://developer.mozilla.org/en/How_to_Turn_Off_Form_Autocompletion
*
* <form method="post" action="process_bug.cgi" autocomplete="off">
+
+ Reading http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.13
+ random notes:
+ - 17.13.3 provides all steps necessary
+ - enctype != application/x-www-form-urlencoded => SHOULD fails (no further questions needed)
+ - http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2.1. is nice explanation
+ (albeit quite dated)
+ - on multiple values http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.6.1
+ - příliš jednoduché http://www.innovation.ch/java/HTTPClient/emulating_forms.html
+ -
*/
BzPage.prototype.serializeForm = function (form) {
var serialForm = {
@@ -477,7 +487,7 @@ BzPage.prototype.serializeForm = function (form) {
action: form.action, // TODO shouldn't we get a non-relative URL?
enctype: form.enctype,
autocomplete: form.getAttribute("autocomplete"),
- bugNo: this.bugNo;
+ bugNo: this.bugNo
};
function genURIElement(sName,sValue) {
@@ -494,7 +504,12 @@ BzPage.prototype.serializeForm = function (form) {
console.log("serializeControl val = " + val);
console.log("typeof val = " + typeof val);
console.log("val.toSource() = " + val.toSource());
- /* FIXME what is element with type="select-one" ??? */
+ /* FIXME what is element with type="select-one" ???
+ on HTMLSelectElement we have an attribute 'type' of type DOMString, readonly
+ The type of this form control. This is the string "select-multiple"
+ when the multiple attribute is true and the string "select-one" when
+ false.
+ */
if (val == null) {
return null;
} else if (val instanceof Array) {
@@ -507,9 +522,6 @@ BzPage.prototype.serializeForm = function (form) {
return Array.map(val,function (x) {
return genURIElement(element.name,x.value);
}).join("&");
- } else {
- throw "Unknown element found during serialization " +
- element.outerHTML;
}
}
@@ -539,7 +551,7 @@ function onlineCallback() {
function deserializeAndSend(formData) {
// FIXME notImplemented
// is it enough to just
- // run XMLHTTPRequest? Probably yes, this is just a form
+ // run XMLHttpRequest? Probably yes, this is just a form
// and this is just a HTTP request
// it is probably better to get already processed
// application/x-www-form-urlencoded
@@ -554,13 +566,13 @@ function onlineCallback() {
return ""; // FIXME check other HTTP headers to be set
var bugID = formData.bugNo;
- var req = new XMLHTTPRequest();
+ var req = new XMLHttpRequest();
req.open("POST",formData.action,true);
req.onreadystatechange = function (aEvt) {
if (req.readyState == 4) {
if (req.status == 200) {
console.log("Sent form for bug " + bugID);
- del myStorage.forms[bugID];
+ delete myStorage.forms[bugID];
} else {
console.error("Sending form for bug " + bugID +
"failed!");