-
14 Oct 2006 1:40 AM #1
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.
-
14 Oct 2006 1:56 AM #2
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; };
-
14 Oct 2006 11:53 AM #3
Yeah, the new code now looks exactly how I added it. Thanks

-
14 Oct 2006 12:03 PM #4
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
-
Problem with YAHOO.util.History
By ziutek in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 23 Mar 2007, 8:33 AM -
doubts using YAHOO.util.Connect?
By franklt69 in forum Ext 1.x: Help & DiscussionReplies: 4Last Post: 9 Mar 2007, 5:23 AM -
YAHOO.ext.util has no properties
By griffiti93 in forum Ext 1.x: Help & DiscussionReplies: 12Last Post: 26 Jan 2007, 10:28 AM -
AJAX Cross Domain
By ameikle in forum Ext 1.x: Help & DiscussionReplies: 6Last Post: 12 Jan 2007, 1:03 PM -
YAHOO.util.Connect questions.....
By genius551v in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 21 Nov 2006, 10:49 AM


Reply With Quote