DWR

File upload does not work in google chrome

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 3.0.RC1
  • Fix Version/s: 3.0.RC2
  • Component/s: Engine
  • Description:
    Error message chrome throws when trying to use the inbuilt dwr file upload is:

    Uncaught TypeError: Cannot set property 'batch' of null
    Uncaught TypeError: Cannot set property 'batch' of null /dwr/engine.js (line 1486)
  1. dwr.jar
    (1.12 MB)
    pankaj kumar
    28/Apr/11 2:36 AM
  2. file-upload.patch
    (4 kB)
    Jose Noheda
    20/May/09 9:32 AM
  3. fileupload-all-amendment.patch
    (2 kB)
    James Crow
    08/Apr/09 7:14 AM
  4. fileupload-all.patch
    (2 kB)
    Jose Noheda
    01/Apr/09 3:59 PM
  5. fileupload.patch
    (2 kB)
    Jose Noheda
    17/Feb/09 9:57 AM
  6. fileupload_engine.js.patch
    (3 kB)
    Jose Noheda
    18/Mar/09 6:36 PM

Activity

Hide
Jose Noheda added a comment - 12/Feb/09 9:11 AM

Change line 1485 of engine.js from

batch.iframe = batch.document.getElementById(idname);

to

batch.iframe = batch.div.firstChild;

The form is posted to a new tab though

Show
Jose Noheda added a comment - 12/Feb/09 9:11 AM Change line 1485 of engine.js from batch.iframe = batch.document.getElementById(idname); to batch.iframe = batch.div.firstChild; The form is posted to a new tab though
Hide
Joe Walker added a comment - 12/Feb/09 1:36 PM

I'm at a bit of a disadvantage with testing on chrome

So we're saying that only chrome fails to find the idname element? Do we know whay that is?

Jose - what do you mean by "posted to a new tab". Does that mean that chrome opens a new empty tab for the download? Is that down to the dwr.engine.openInDownload function?

Joe.

Show
Joe Walker added a comment - 12/Feb/09 1:36 PM I'm at a bit of a disadvantage with testing on chrome So we're saying that only chrome fails to find the idname element? Do we know whay that is? Jose - what do you mean by "posted to a new tab". Does that mean that chrome opens a new empty tab for the download? Is that down to the dwr.engine.openInDownload function? Joe.
Hide
Jose Noheda added a comment - 13/Feb/09 7:31 AM

I meant that the submit, for some unknown reason, does not target the hidden iframe and hence opens a new tab/window. There's an added problem because the call response fails with an "Incomplete response from server" message (probably it has something to do with the new opened window). So, the file is posted correctly but if the remote method returns something that will be lost. I'll investigate a little bit more.

Show
Jose Noheda added a comment - 13/Feb/09 7:31 AM I meant that the submit, for some unknown reason, does not target the hidden iframe and hence opens a new tab/window. There's an added problem because the call response fails with an "Incomplete response from server" message (probably it has something to do with the new opened window). So, the file is posted correctly but if the remote method returns something that will be lost. I'll investigate a little bit more.
Hide
Jose Noheda added a comment - 17/Feb/09 9:57 AM

Tested under IE7/8, FF3 and Chrome.

It stills fails under Opera but that may very well be resolved under another issue

Show
Jose Noheda added a comment - 17/Feb/09 9:57 AM Tested under IE7/8, FF3 and Chrome. It stills fails under Opera but that may very well be resolved under another issue
Hide
Jose Noheda added a comment - 18/Mar/09 6:36 PM

Current code in HEAD fails on all browsers. This patch fixes it and adds (hopefully) chrome support

Show
Jose Noheda added a comment - 18/Mar/09 6:36 PM Current code in HEAD fails on all browsers. This patch fixes it and adds (hopefully) chrome support
Hide
James Crow added a comment - 18/Mar/09 10:58 PM

I'll apply it to HEAD and let you know my findings!

Show
James Crow added a comment - 18/Mar/09 10:58 PM I'll apply it to HEAD and let you know my findings!
Hide
James Crow added a comment - 19/Mar/09 6:08 PM

Jose, great fix, I can confirm that file upload now works with:
Google Chrome
IE 6
IE 7
Safari 4
Firefox 3

Think this closes quite a few other bugs that are in "Unscheduled" at the minute (I raised one about file upload in general being broken in HEAD)

Show
James Crow added a comment - 19/Mar/09 6:08 PM Jose, great fix, I can confirm that file upload now works with: Google Chrome IE 6 IE 7 Safari 4 Firefox 3 Think this closes quite a few other bugs that are in "Unscheduled" at the minute (I raised one about file upload in general being broken in HEAD)
Hide
James Crow added a comment - 30/Mar/09 12:02 PM

Is this going to make it into HEAD? I applied to patch manually and it worked fine...

Show
James Crow added a comment - 30/Mar/09 12:02 PM Is this going to make it into HEAD? I applied to patch manually and it worked fine...
Hide
Jose Noheda added a comment - 01/Apr/09 3:59 PM

This last one seems pretty good. Solves the Opera issues as well

Show
Jose Noheda added a comment - 01/Apr/09 3:59 PM This last one seems pretty good. Solves the Opera issues as well
Hide
James Crow added a comment - 08/Apr/09 7:14 AM

The last patch you attached still works but introduces a bug in non-IE browsers - the batch.div is created but never appended to the document body, this just moves the creation of the batch.div into the IE-only section (which appends it to the document body)

Show
James Crow added a comment - 08/Apr/09 7:14 AM The last patch you attached still works but introduces a bug in non-IE browsers - the batch.div is created but never appended to the document body, this just moves the creation of the batch.div into the IE-only section (which appends it to the document body)
Hide
James Crow added a comment - 08/Apr/09 7:16 AM

With reference to my last comment, the bug introduced was in the remove function, where batch.div existed but had no parentNode and was erroring:

remove:function(batch) {
// TODO: make it so that we don't need these if statements
if (batch.div) { batch.div.parentNode.removeChild(batch.div); }
.....

Show
James Crow added a comment - 08/Apr/09 7:16 AM With reference to my last comment, the bug introduced was in the remove function, where batch.div existed but had no parentNode and was erroring: remove:function(batch) { // TODO: make it so that we don't need these if statements if (batch.div) { batch.div.parentNode.removeChild(batch.div); } .....
Hide
James Crow added a comment - 08/Apr/09 7:55 AM

Additionally the patch you applied causes a bug in chrome only, such that a file upload causes a new tab to open with a url of dwr/call/htmlcall/<method>. I have reverted back to the 2nd path (fileupload.patch) which for the minute seems to be the best working one.

Show
James Crow added a comment - 08/Apr/09 7:55 AM Additionally the patch you applied causes a bug in chrome only, such that a file upload causes a new tab to open with a url of dwr/call/htmlcall/<method>. I have reverted back to the 2nd path (fileupload.patch) which for the minute seems to be the best working one.
Hide
David Marginian added a comment - 13/May/09 4:02 AM

There is still an outstanding issue here. I just tried the upload demo in the dwr.war in chrome and opera and it locked up both. Everything worked fine in IE and Firefox.

Show
David Marginian added a comment - 13/May/09 4:02 AM There is still an outstanding issue here. I just tried the upload demo in the dwr.war in chrome and opera and it locked up both. Everything worked fine in IE and Firefox.
Hide
David Marginian added a comment - 13/May/09 4:15 AM

I take that back. I had actually reverted your patch .

I just added it and re-tested. It works fine in all browsers. I also did not notice any of the issues described by James.

James, I have checked in Jose's latest patch if you are interested in grabbing and building from svn.

Show
David Marginian added a comment - 13/May/09 4:15 AM I take that back. I had actually reverted your patch . I just added it and re-tested. It works fine in all browsers. I also did not notice any of the issues described by James. James, I have checked in Jose's latest patch if you are interested in grabbing and building from svn.
Hide
James Crow added a comment - 13/May/09 9:29 AM

Still get the issue I reported before:

Non-IE bug introduced in the remove function, where batch.div existed but had no parentNode and was erroring:

remove:function(batch) {
// TODO: make it so that we don't need these if statements
if (batch.div) { batch.div.parentNode.removeChild(batch.div); }

Additionally can't test the chrome bug right now but i'd imagine it still remains since it's the same patch I applied manually...

Show
James Crow added a comment - 13/May/09 9:29 AM Still get the issue I reported before: Non-IE bug introduced in the remove function, where batch.div existed but had no parentNode and was erroring: remove:function(batch) { // TODO: make it so that we don't need these if statements if (batch.div) { batch.div.parentNode.removeChild(batch.div); } Additionally can't test the chrome bug right now but i'd imagine it still remains since it's the same patch I applied manually...
Hide
Mike Wilson added a comment - 15/May/09 4:26 PM

Jose, I am equally impressed by, and frightened by, the solution to get this working in Chrome etc
I tried out the patch back in April and, as we discussed on the mailing list, getting it to work in Chrome et al seems to depend on creating a totally unrelated DIV before triggering the iframe request. This make me feel that there is something lurking inside the iframe code that will bite us soon again...
I know Dojo has an iframe io provider, could you have a look at that and see if they manage without creating such a dummy element?
I'm really hoping that you can find an updated solution. That would probably also fix the Opera part of DWR-241.

Show
Mike Wilson added a comment - 15/May/09 4:26 PM Jose, I am equally impressed by, and frightened by, the solution to get this working in Chrome etc I tried out the patch back in April and, as we discussed on the mailing list, getting it to work in Chrome et al seems to depend on creating a totally unrelated DIV before triggering the iframe request. This make me feel that there is something lurking inside the iframe code that will bite us soon again... I know Dojo has an iframe io provider, could you have a look at that and see if they manage without creating such a dummy element? I'm really hoping that you can find an updated solution. That would probably also fix the Opera part of DWR-241.
Hide
Mike Wilson added a comment - 15/May/09 4:43 PM

BTW, the current file upload fails in Safari 2. I get an error dialog in the browser and an
INFO UploadDownload.uploadFiles(null, null, "FFFFFF")
in the DWR log.
Again, Safari 2 seems to be handled by the Dojo code so could be interesting to look at.

Show
Mike Wilson added a comment - 15/May/09 4:43 PM BTW, the current file upload fails in Safari 2. I get an error dialog in the browser and an INFO UploadDownload.uploadFiles(null, null, "FFFFFF") in the DWR log. Again, Safari 2 seems to be handled by the Dojo code so could be interesting to look at.
Hide
Jose Noheda added a comment - 20/May/09 9:32 AM

Let's hope...

Show
Jose Noheda added a comment - 20/May/09 9:32 AM Let's hope...
Hide
Mike Wilson added a comment - 24/May/09 2:00 AM

I'll take a look and see if I find some way to stop that spinning in Chrome 1 and Safari 3...

Show
Mike Wilson added a comment - 24/May/09 2:00 AM I'll take a look and see if I find some way to stop that spinning in Chrome 1 and Safari 3...
Hide
Mike Wilson added a comment - 01/Jun/09 9:41 PM

I have now checked in a fix for getting a clean "iframe close" for Chrome 1 and Safari 3, which gets rid of the endless loading spinner.

Show
Mike Wilson added a comment - 01/Jun/09 9:41 PM I have now checked in a fix for getting a clean "iframe close" for Chrome 1 and Safari 3, which gets rid of the endless loading spinner.
Hide
James Crow added a comment - 01/Jun/09 9:44 PM

Awesome, will give this a check tomorrow and let you know my findings!

Show
James Crow added a comment - 01/Jun/09 9:44 PM Awesome, will give this a check tomorrow and let you know my findings!
Hide
Nicolas Bourdeau added a comment - 11/May/10 9:56 AM

I have the same exact bug right now with Chrome 5.0.375.29 beta (on linux) and DWR RC1 (build 116)
Is there a way to work around this bug while waiting for RC2 to come out ?
Is there planning on RC2 release ?

Show
Nicolas Bourdeau added a comment - 11/May/10 9:56 AM I have the same exact bug right now with Chrome 5.0.375.29 beta (on linux) and DWR RC1 (build 116) Is there a way to work around this bug while waiting for RC2 to come out ? Is there planning on RC2 release ?
Hide
Mike Wilson added a comment - 14/May/10 12:59 PM

Get the latest dev build from http://ci.directwebremoting.org/bamboo/ to sort this out.
Hopefully we will get RC2 out soon.

Show
Mike Wilson added a comment - 14/May/10 12:59 PM Get the latest dev build from http://ci.directwebremoting.org/bamboo/ to sort this out. Hopefully we will get RC2 out soon.
Hide
Diego A added a comment - 04/Feb/11 3:41 AM

Could anyone give me the engine.js file updated solving this issue?

Show
Diego A added a comment - 04/Feb/11 3:41 AM Could anyone give me the engine.js file updated solving this issue?
Hide
David Marginian added a comment - 04/Feb/11 3:46 AM

Get the latest trunk build artifacts from here:
http://ci.directwebremoting.org/bamboo/

Show
David Marginian added a comment - 04/Feb/11 3:46 AM Get the latest trunk build artifacts from here: http://ci.directwebremoting.org/bamboo/
Hide
Diego A added a comment - 04/Feb/11 3:49 AM

I tried but I don't know how to do it, I don't see the links to download the files, I just get the file names.

Show
Diego A added a comment - 04/Feb/11 3:49 AM I tried but I don't know how to do it, I don't see the links to download the files, I just get the file names.
Hide
David Marginian added a comment - 04/Feb/11 3:51 AM

That is because a build was active. You would need to go to the history during an active build. Anyway the build is done now:

http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-171/artifact

Show
David Marginian added a comment - 04/Feb/11 3:51 AM That is because a build was active. You would need to go to the history during an active build. Anyway the build is done now: http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-171/artifact
Hide
Diego A added a comment - 04/Feb/11 4:14 AM

Thank you. I downloaded the dwr.jar file, but now, my AJAX functionality is not working.
With the normal DWR version 3.0.rc1, I just need to upload pictures with browsers as Safari and Chrome, due to in Firefox and IE It works properly.

Hope you can help me.

Show
Diego A added a comment - 04/Feb/11 4:14 AM Thank you. I downloaded the dwr.jar file, but now, my AJAX functionality is not working. With the normal DWR version 3.0.rc1, I just need to upload pictures with browsers as Safari and Chrome, due to in Firefox and IE It works properly. Hope you can help me.
Hide
David Marginian added a comment - 04/Feb/11 4:19 AM

1) You need to ask a question on the mailing list, this is not the proper place to ask questions.
2) You also need to provide more information, as "not working" doesn't help anyone (always helps to do some debugging on your own as well).

Show
David Marginian added a comment - 04/Feb/11 4:19 AM 1) You need to ask a question on the mailing list, this is not the proper place to ask questions. 2) You also need to provide more information, as "not working" doesn't help anyone (always helps to do some debugging on your own as well).
Hide
Diego A added a comment - 04/Feb/11 4:35 AM

I will try to help find this out. Thank you very much for your help.

Show
Diego A added a comment - 04/Feb/11 4:35 AM I will try to help find this out. Thank you very much for your help.
Hide
Diego A added a comment - 04/Feb/11 5:17 AM

After downloading the 171 artifact, when I use a DWR Object, I receive the next javascript error:

"FormBeansDWR" is undefined.

I am using the next DWR.xml in my prroject:

<!DOCTYPE dwr PUBLIC
"-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN"
"http://getahead.org/dwr//dwr30.dtd">
<dwr>
<allow>
<create creator="new" javascript="FormBeansDWR">
<param name="class" value="com.miramiobra.dwr.FormBeansDWR"/>
</create>
<create creator="new" javascript="UtilidadesDWR">
<param name="class" value="com.miramiobra.dwr.UtilidadesDWR"/>
</create>
<convert converter="bean" match="com.miramiobra.dwr.bean.*"/>
</allow>
</dwr>

Hope you can help me. Thanks.

Show
Diego A added a comment - 04/Feb/11 5:17 AM After downloading the 171 artifact, when I use a DWR Object, I receive the next javascript error: "FormBeansDWR" is undefined. I am using the next DWR.xml in my prroject: <!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN" "http://getahead.org/dwr//dwr30.dtd"> <dwr> <allow> <create creator="new" javascript="FormBeansDWR"> <param name="class" value="com.miramiobra.dwr.FormBeansDWR"/> </create> <create creator="new" javascript="UtilidadesDWR"> <param name="class" value="com.miramiobra.dwr.UtilidadesDWR"/> </create> <convert converter="bean" match="com.miramiobra.dwr.bean.*"/> </allow> </dwr> Hope you can help me. Thanks.
Hide
David Marginian added a comment - 04/Feb/11 5:24 AM

I told you to post your question on the users mailing list:
http://java.net/projects/dwr/lists/users/archive

You should probably create an account and subscribe to the list.

I recommend looking at the troubleshooting page before posting as this is something you should not have to ask about:
http://directwebremoting.org/dwr/support/common_problems.html

I also recommend looking at the log files.

Show
David Marginian added a comment - 04/Feb/11 5:24 AM I told you to post your question on the users mailing list: http://java.net/projects/dwr/lists/users/archive You should probably create an account and subscribe to the list. I recommend looking at the troubleshooting page before posting as this is something you should not have to ask about: http://directwebremoting.org/dwr/support/common_problems.html I also recommend looking at the log files.
Hide
David Marginian added a comment - 04/Feb/11 6:17 AM

Also, the build you downloaded is working fine. I deployed it to our server and it is currently running the demos without issue:
http://directwebremoting.org/dwr-demo/

Show
David Marginian added a comment - 04/Feb/11 6:17 AM Also, the build you downloaded is working fine. I deployed it to our server and it is currently running the demos without issue: http://directwebremoting.org/dwr-demo/
Hide
David Marginian added a comment - 07/Feb/11 7:38 PM

We have the same build version deployed and everything works fine (I just tested the file upload demo in both Firefox and Chrome):
http://directwebremoting.org/dwr-demo/simple/upload.html

I told you several times to ask your questions on the mailing list. I am not sure why you refuse to follow simple directions.

Show
David Marginian added a comment - 07/Feb/11 7:38 PM We have the same build version deployed and everything works fine (I just tested the file upload demo in both Firefox and Chrome): http://directwebremoting.org/dwr-demo/simple/upload.html I told you several times to ask your questions on the mailing list. I am not sure why you refuse to follow simple directions.
Hide
Diego A added a comment - 08/Feb/11 12:56 AM

Sorry David if I didn't open the question in the mailing list.

The trouble was the cache in the browser. I delete everything and now AJAX DWR is working perfectly (uploading functionality works fine in the browsers...)

Thank you very much for your help. I appreciate so much your help.

Show
Diego A added a comment - 08/Feb/11 12:56 AM Sorry David if I didn't open the question in the mailing list. The trouble was the cache in the browser. I delete everything and now AJAX DWR is working perfectly (uploading functionality works fine in the browsers...) Thank you very much for your help. I appreciate so much your help.
Hide
pankaj kumar added a comment - 28/Apr/11 2:36 AM

try this jar file to make the upload work on crome, IE,mozilla etc.....

Show
pankaj kumar added a comment - 28/Apr/11 2:36 AM try this jar file to make the upload work on crome, IE,mozilla etc.....
Hide
Mike Wilson added a comment - 28/Apr/11 3:52 AM

This problem has been fixed in trunk for upcoming RC2, are you saying it is not working there?

Show
Mike Wilson added a comment - 28/Apr/11 3:52 AM This problem has been fixed in trunk for upcoming RC2, are you saying it is not working there?
Hide
David Marginian added a comment - 28/Apr/11 4:23 AM

Thanks Pakaj. But as Mike mentioned this has been fixed and has been in a fixed status for sometime.

You can get the latest development build which contains the fixes here - http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-250/artifact.

I have been testing for the upcoming release and the upload works in the latest version of all major browsers (chrome, ie, firefox, opera).

Show
David Marginian added a comment - 28/Apr/11 4:23 AM Thanks Pakaj. But as Mike mentioned this has been fixed and has been in a fixed status for sometime. You can get the latest development build which contains the fixes here - http://ci.directwebremoting.org/bamboo/browse/DWRTRUNK-ALL-250/artifact. I have been testing for the upcoming release and the upload works in the latest version of all major browsers (chrome, ie, firefox, opera).

People

Dates

  • Created:
    07/Jan/09 9:18 AM
    Updated:
    28/Apr/11 4:23 AM
    Resolved:
    01/Jun/09 9:41 PM