Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#1164 closed defect (fixed)

dojo.widget.PopupManager initialization fails with cross-domain-iframes

Reported by: rsaccon [at] gmail [dot] com Owned by: liucougar
Priority: high Milestone:
Component: Widgets Version: 0.3
Keywords: Cc:
Blocked By: Blocking:

Description

I discovered this annoyance when embedding Google Adsense on the same page as dojo. Probably happens with any cross-domain-embedded iframes. I am using dojo trunk and on IE 6 I get the error message "access denied" and on firefox/firebug it either fails silently (can't explain why, but dojo.addOnLoad didn't work anymore) or it works (can't explain either !)

the problem happens at the following block within dojo.widget.PopupManager?:

       this.registerAllWindows = function(targetWindow){
               //starting from window.top, clicking everywhere in this page
               //should close popup menus
               if(!targetWindow)  targetWindow =
dojo.html.getDocumentWindow(window.top.document); //see comment below

               this.registerWin(targetWindow);

               for (var i = 0; i < targetWindow.frames.length; i++){
                       //do not remove  dojo.html.getDocumentWindow, see comment in it
                       var win = dojo.html.getDocumentWindow(targetWindow.frames[i].document);
                       if(win){
                               this.registerAllWindows(win);
                       }
               }
       };

       dojo.addOnLoad(this, "registerAllWindows");

The simlpest way to make a test-case for this problem is to copy/paste a google adsense snippet (see below the mine) into dojo/tests/widgets/test_Menu2_Bar.html and open it in IE 6.

Google adssense snippet:

<script type="text/javascript"><!--
google_ad_client = "pub-7326210199806617";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "DDDDEE";
google_color_bg = "EAEAFF";
google_color_link = "0000AA";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

Change History (6)

comment:1 Changed 13 years ago by dylan

Milestone: 0.5
Version: 0.40.3

comment:2 Changed 13 years ago by dylan

Component: GeneralWidgets
Owner: changed from anonymous to bill

comment:3 Changed 13 years ago by liucougar

what about adding a "try/catch" around the offending block?

comment:4 Changed 13 years ago by liucougar

Milestone: 0.50.4
Owner: changed from bill to liucougar

comment:5 Changed 13 years ago by liucougar

Resolution: fixed
Status: newclosed

(In [5472]) fixes #1164: dojo.widget.PopupManager? initialization fails with cross-domain-iframes squelch the error for now (any better idea?)

comment:6 Changed 12 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.