diff --git a/suite/common/src/nsSessionStore.js b/suite/common/src/nsSessionStore.js index 15afa505a2..7447355dae 100644 --- a/suite/common/src/nsSessionStore.js +++ b/suite/common/src/nsSessionStore.js @@ -1462,25 +1462,60 @@ SessionStoreService.prototype = { let data = {}; do { + let nId = node.id; + let hasDefaultValue = true; + let value; + // Only generate a limited number of XPath expressions for perf reasons (cf. bug 477564) - if (!node.id && ++generatedCount > MAX_GENERATED_XPATHS) + if (!nId && generatedCount > MAX_GENERATED_XPATHS) continue; - let id = node.id ? "#" + node.id : XPathHelper.generate(node); - if (node instanceof Components.interfaces.nsIDOMHTMLInputElement) { - if (node.type != "file") - data[id] = node.type == "checkbox" || node.type == "radio" ? node.checked : node.value; - else - data[id] = { type: "file", fileList: node.mozGetFileNameArray() }; + if (node instanceof Components.interfaces.nsIDOMHTMLInputElement || + node instanceof Components.interfaces.nsIDOMHTMLTextAreaElement) { + switch (node.type) { + case "checkbox": + case "radio": + value = node.checked; + hasDefaultValue = value == node.defaultChecked; + break; + case "file": + value = { type: "file", fileList: node.mozGetFileNameArray() }; + hasDefaultValue = !value.fileList.length; + break; + default: // text, textarea + value = node.value; + hasDefaultValue = value == node.defaultValue; + break; + } + } + else if (!node.multiple) { + // s with the multiple attribute are easier to determine the + // default value since each