1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    7
    Vote Rating
    0
    chinohillsbanditos is on a distinguished road

      0  

    Default YAHOO.ext.util.CSS's this.getRules Cross-Domain Security FF

    YAHOO.ext.util.CSS's this.getRules Cross-Domain Security FF


    This isn't a major bug for the common folk, well, it might not exactly even be a real bug, but here it is...

    Inside yutil.js YAHOO.ext.util.CSS's this.getRules function will throw an exception only in Firefox (IE6 is fine) if the yui-ext.js javascript is loaded from another domain and it trys to access a css file that is loaded within a domain that is not within the originating URL. Yeah, the cross-domain security stuff....

    Uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://sub.domain/scripts/yuiext/yui-ext.js Line: 19"]

    First I had to add a try{} catch(e){} inside the getRules function at the inside beginning of the outer loop. That just hides the security error, then to get the grid working correctly I had to move the grid.css to the main domain instead of the static-only file server on the subdomain.

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    That is an interesting one. Thank you for posting about it. I have added a try/catch to the loop to avoid the error. Is this similar to what you did? I added it inside the loop so it still caches the rules that it can.

    Code:
     this.getRules = function(refreshCache){
       		if(rules == null || refreshCache){
       			rules = {};
       			var ds = document.styleSheets;
       			for(var i =0, len = ds.length; i < len; i++){
       			    try{
        		        var ss = ds[i];
        		        var ssRules = ss.cssRules || ss.rules;
        		        for(var j = ssRules.length-1; j >= 0; --j){
        		        	rules[ssRules[j].selectorText] = ssRules[j];
        		        }
       			    }catch(e){} // try catch for cross domain access issue
    	        }
       		}
       		return rules;
       	};

  3. #3
    Ext User
    Join Date
    Mar 2007
    Posts
    7
    Vote Rating
    0
    chinohillsbanditos is on a distinguished road

      0  

    Default


    Yeah, the new code now looks exactly how I added it. Thanks

  4. #4
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    Thanks for reporting it! Nice timing too, I was just putting the final touches on a release and it was easy to add in.

Similar Threads

  1. Problem with YAHOO.util.History
    By ziutek in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 23 Mar 2007, 8:33 AM
  2. doubts using YAHOO.util.Connect?
    By franklt69 in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 9 Mar 2007, 5:23 AM
  3. YAHOO.ext.util has no properties
    By griffiti93 in forum Ext 1.x: Help & Discussion
    Replies: 12
    Last Post: 26 Jan 2007, 10:28 AM
  4. AJAX Cross Domain
    By ameikle in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 12 Jan 2007, 1:03 PM
  5. YAHOO.util.Connect questions.....
    By genius551v in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 21 Nov 2006, 10:49 AM

Thread Participants: 1