Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10792 closed defect (duplicate)

dijit.isTabNavigable will result in "Access Denied" error when an iframe is x-domain

Reported by: druspini Owned by: bill
Priority: high Milestone: 1.4.2
Component: Dijit Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

We had this error in several places of AOL webmail client when porting from dojo 1.3 to 1.4, because of changes to this function. Specifically in the case of iframes it attempts to access the contentWindow.document of the iframe which of course will fail and produce the "Access Denied" error if the iframe is x-domain.

Our fix was to put a try/catch around the call:

case "iframe":
	// If it's an editor <iframe> then it's tab navigable.
	if(dojo.isMoz){
		return elem.contentDocument.designMode == "on";
	}else if(dojo.isWebKit){
		var doc = elem.contentDocument,
			body = doc && doc.body;
		return body && body.contentEditable == 'true';
	}else{
		try {
			doc = elem.contentWindow.document;
			body = doc && doc.body;
			return body && body.firstChild && body.firstChild.contentEditable == 'true';
		}
		catch(e) {
			// if elem was an iframe and its content is from a different domain,
			// there is no access to its window
			return false;
		}
	}

Change History (3)

comment:1 Changed 9 years ago by bill

Component: GeneralDijit
Milestone: tbd1.5
Owner: changed from anonymous to bill
Status: newassigned

Makes sense, I'll add that in, thanks.

comment:2 Changed 9 years ago by bill

Resolution: duplicate
Status: assignedclosed

Oh actually this is already fixed. Dup of #10771.

comment:3 Changed 9 years ago by bill

Milestone: 1.51.4.2
Note: See TracTickets for help on using tickets.