Opened 11 years ago

Closed 11 years ago

#5904 closed defect (fixed)

[Patch - CLA] File transfers (iframe.js) fail during second file upload

Reported by: guest Owned by: James Burke
Priority: high Milestone: 1.1
Component: IO Version: 1.0
Keywords: iframe file form ie dojo.io Cc:
Blocked By: Blocking:

Description

When uploading a file using iframeIO (iframe.js) and Dojo 1.0.1 the first submission succeeds but the second submission fails.

This is recreatable quite easily using embedded IE7 but I have seen reports by phiggins and others that they have experienced it as well.

Excerpt of dojo.:

	var bindArgs = {
			url: myUrl,
			form: dojo.byId(formId),
			method: "post",
			handleAs: 'json',
			preventCache: true,			
			content: {
				increment: ctr++,
				name: strFormFileSource,
				filename: myFileName
			}
		}
  var request = dojo.io.iframe.send(bindArgs);

The second request results in an error. Debugging (VS) shows that in iframe.doc() the passed iframeNode does not have access to it's contentWindow:

iframeNode.contentWindow
Object doesn't support this property or method

However, accessing this node via a manual fetch to the iframe does give us access to the iframe.contentWindow:

(document.getElementsByTagName("iframe")[iframeNode.name].contentWindow.document)

The patch which addresses this is attached (and below). It has been used for 2 months and no problems in IE reported by those using it.

CLA on file for "Matthew Knapp"

Patch Generated by SVN:

Index: iframe.js
===================================================================
--- iframe.js	(revision 11817)
+++ iframe.js	(working copy)
@@ -99,7 +99,8 @@
 		//summary: Returns the document object associated with the iframe DOM Node argument.
 		var doc = iframeNode.contentDocument || // W3
 			(
-				(iframeNode.contentWindow)&&(iframeNode.contentWindow.document)
+				((iframeNode.name)&&(iframeNode.document)&&(document.getElementsByTagName("iframe")[iframeNode.name].contentWindow)
+				&&(document.getElementsByTagName("iframe")[iframeNode.name].contentWindow.document))
 			) ||  // IE
 			(
 				(iframeNode.name)&&(document.frames[iframeNode.name])&&

Attachments (1)

iframe.js.diff (674 bytes) - added by guest 11 years ago.
Patch for iframe.js

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by guest

Attachment: iframe.js.diff added

Patch for iframe.js

comment:1 Changed 11 years ago by Adam Peller

Milestone: 1.1

comment:2 Changed 11 years ago by alex

Resolution: fixed
Status: newclosed

(In [12513]) applying patch from Mike Knapp for a really janktastic IE issue when using MSHTML in embedded environments. Fixes #5904. !strict

Note: See TracTickets for help on using tickets.