diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -2383,26 +2383,30 @@ nsHTMLInputElement::SubmitNamesValues(ns
nsAutoString name;
PRBool nameThere = GetNameIfExists(name);
//
// Submit .x, .y for input type=image
//
if (mType == NS_FORM_INPUT_IMAGE) {
// Get a property set by the frame to find out where it was clicked.
- nsAutoString xVal;
- nsAutoString yVal;
-
nsIntPoint* lastClickedPoint =
static_cast(GetProperty(nsGkAtoms::imageClickedPoint));
+ PRInt32 x, y;
if (lastClickedPoint) {
// Convert the values to strings for submission
- xVal.AppendInt(lastClickedPoint->x);
- yVal.AppendInt(lastClickedPoint->y);
+ x = lastClickedPoint->x;
+ y = lastClickedPoint->y;
+ } else {
+ x = y = 0;
}
+
+ nsAutoString xVal, yVal;
+ xVal.AppendInt(x);
+ yVal.AppendInt(y);
if (!name.IsEmpty()) {
aFormSubmission->AddNameValuePair(this,
name + NS_LITERAL_STRING(".x"), xVal);
aFormSubmission->AddNameValuePair(this,
name + NS_LITERAL_STRING(".y"), yVal);
} else {
// If the Image Element has no name, simply return x and y
diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -94,16 +94,17 @@ _TEST_FILES = test_bug589.html \
test_bug375003-1.html \
test_bug375003-2.html \
test_bug384419.html \
test_bug386496.html \
test_bug386728.html \
test_bug386996.html \
test_bug388558.html \
test_bug388746.html \
+ test_bug388794.html \
test_bug389797.html \
test_bug390975.html \
test_bug391994.html \
test_bug392567.html \
bug392567.jar \
bug392567.jar^headers^ \
test_bug394700.html \
test_bug395107.html \
--- /dev/null
+++ b/content/html/content/test/test_bug388794.html
@@ -0,0 +1,97 @@
+
+
+
+
+ Test for Bug 388794
+
+
+
+
+
+
+
+Mozilla Bug 388794
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+