yuntaozhu / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

goog.net.IframeIo doesn't clear state after use #561

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
Fire off a request, for example in my case I was using

var io = new goog.net.IframeIo();
goog.events.listen(io, "success", function(){
    // Handle stuff...
    io.dispose();
});
io.send(this.newTableURL, "POST", true, {
        tableName: "Test",
        category: "Category1"
});

In my case the server would return the error "Duplicate table name" and would 
ask the user to change this value and submit again. Doing so means a new 
instance of goog.net.IframeIo would be created and sent with new values.

Would expect the new values to be posted, instead the old values from the 
previously disposed instance are sent.

This is because the instance uses a static form, the same form for every 
instance and the form values (input fields) are never cleared.

Would expect dispose() to clear these values.

Original issue reported on code.google.com by ali.taf...@googlemail.com on 22 May 2013 at 8:46

GoogleCodeExporter commented 8 years ago
My fix is to clear the innerHTML of the form before adding new inputs.

iframeio.js
Line 349

+   form.innerHTML = "";

Original comment by ali.taf...@googlemail.com on 22 May 2013 at 8:55