Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#8809 closed defect (fixed)

[PATCH][CCLA] dojox.html.metrics throws errors if loaded from/used in an iframe

Reported by: Jared Jurkiewicz Owned by: Eugene Lazutkin
Priority: blocker Milestone: 1.3
Component: Dojox Version: 1.2.3
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Eugene Lazutkin)

The error is: window.parent.dojox.html.metrics is null or not an object.

Showed up my a co-worker of mine who has an app with grid running in an iframe. They use the IE view->change text size and that error threw. The use of window.parent here seems to be the source of the problem. Same problem shows on font scaling when on FF3

After some look, changing both the IE and non IE cases to:

if(dojo.isIE){
  f.onreadystatechange = function(){
    if(f.contentWindow.document.readyState == "complete"){
      //f.onresize = Function(f.contentWindow.parent[dojox._scopeName].html.metrics._fontresize());
      f.onresize = f.contentWindow.parent[dojox._scopeName].html.metrics._fontresize;
    }
  };
}else{
  f.onload = function(){
    //f.contentWindow.onresize = Function('window.parent.'+dojox._scopeName+'.html.metrics._fontresize()');
    f.contentWindow.onresize = f.contentWindow.parent[dojox._scopeName].html.metrics._fontresize;
  };
}

Seems to resolve it on IE and FF3

Change History (10)

comment:1 Changed 11 years ago by Jared Jurkiewicz

Summary: dojox.html.metrics throws errors if loaded from/used in an iframe[PATCH][CCLA] dojox.html.metrics throws errors if loaded from/used in an iframe

comment:2 Changed 11 years ago by Eugene Lazutkin

Component: GeneralDojox
Description: modified (diff)
Milestone: tbdfuture
Owner: changed from uhop to Eugene Lazutkin
Status: newassigned

comment:3 Changed 11 years ago by Jared Jurkiewicz

severity: normalcritical

I know apps this breaks on (particularly it breaks DataGrid?), when used in iframe cases (like in a portal case that draws dojo in an iframe).

comment:4 Changed 11 years ago by Eugene Lazutkin

Priority: normalhighest

comment:5 Changed 11 years ago by Jared Jurkiewicz

I've tested with this patch on:

FireFox? 2

FireFox? 3

IE 7

Safari 3.2

Chrome

comment:6 Changed 11 years ago by Jared Jurkiewicz

Looks good. I'll check this in. Thanks!

comment:7 Changed 11 years ago by Jared Jurkiewicz

Resolution: fixed
Status: assignedclosed

(In [16924]) Checking this fix in. Tested fine on many browsers. Also updated Ut to work on IE. Fixes #8809

comment:8 Changed 11 years ago by Adam Peller

Milestone: future1.3

batch move of tickets marked 'future' in the 1.3 timeframe

comment:9 Changed 8 years ago by kamalsomani

I encountered the same issue even in 1.7.1. tried to use it with xdomain. in IE it gives "Access Denied" error.

comment:10 Changed 8 years ago by Adam Peller

kamalsomani, do you have a simple example of cross-domain usage you could attach or reference at jsfiddle.net?

Note: See TracTickets for help on using tickets.