CSS Cross-Domain loading in Chrome and Safari is broken #53

Closed
manuelschneider opened this Issue Jul 28, 2011 · 3 comments

Comments

Projects
None yet
4 participants
@manuelschneider

It seems Webkit always hit the 10-seconds timeout when loading a CSS-File from another Domain.

I guess the reason is, that in line 138 those browser won't fire a security-exception for link.sheet - the element is just empty.

I created Demos to help understanding the problem:

http://sellaround.efreetsystems.de/yepnope/bugDemo.html
http://sellaround.efreetsystems.de/yepnope/bugDemoFixed.html

NOTE: The interesting part here is the JS-Callback - the CSS applies of course as soon as it's loaded.

I created a patch which should fix this:

  138c138,139
  <               if ( link.sheet.cssRules.length )  {
  ---
  >               // Chrome won't throw a security or denied exception in case of same origin - cssRules will simply stay empty
  >               if ( (isWebkit && link.sheet !== null) || (isGecko && link.sheet.cssRules.length) ) {

I tested it with Safari 5.1 and Chrome 12.

Last but not least: Thank you for this great tool!

@SlexAxton

This comment has been minimized.

Show comment
Hide comment
@SlexAxton

SlexAxton Jul 29, 2011

Owner

Cool! Thanks for the work on this. Any chance you wanna do a pull request so you get the credz in the log?

Owner

SlexAxton commented Jul 29, 2011

Cool! Thanks for the work on this. Any chance you wanna do a pull request so you get the credz in the log?

@SlexAxton

This comment has been minimized.

Show comment
Hide comment
@SlexAxton

SlexAxton Oct 24, 2011

Owner

@ralphholzmann - you put this fix in the v1.1 stuff, yes? Either way, when we take out the CSS callbacks by default, let's make sure this fix is in the new plugin to support this. We won't pull this into master since we're changing the way it works, but it'll be fixed in the appropriate spot. Many thank yous.

Owner

SlexAxton commented Oct 24, 2011

@ralphholzmann - you put this fix in the v1.1 stuff, yes? Either way, when we take out the CSS callbacks by default, let's make sure this fix is in the new plugin to support this. We won't pull this into master since we're changing the way it works, but it'll be fixed in the appropriate spot. Many thank yous.

@magus424

This comment has been minimized.

Show comment
Hide comment
@magus424

magus424 Dec 3, 2012

did this not make it into the CSS plugin? cross domain CSS is currently broken in Safari w/the plugin

magus424 commented Dec 3, 2012

did this not make it into the CSS plugin? cross domain CSS is currently broken in Safari w/the plugin

@SlexAxton SlexAxton closed this Jul 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment