Bug 17847

Summary: CSS caching corruption
Product: WebKit Reporter: Derk-Jan Hartman <hartman.wiki>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED INVALID    
Severity: Normal CC: grahamperrin, macpherson, shanestephens
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   

Derk-Jan Hartman
Reported 2008-03-14 09:19:20 PDT
This is a very complicated bug. I encountered this issue when using the javascript tool twinkle on Wikipedia. The tool gives you extra tabs, that open tools in a CSS window. After finishing the "job", the tool redirects you to the original page you visited. Website of the tool: http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/Twinkle In Safari 3 (and the NB), I was experiencing a problem where after the redirect, my page was only showing the background image. Screenshot: http://deneb.student.utwente.nl/~hartman/weird%20issue.png It appeared as if all my CSS styling was down the drain somehow. If I opened other Wikipedia pages on other tabs or windows the problem persisted. I had to force a reload to make the issue disappear. I believe it was reproducible with this webarchive: http://deneb.student.utwente.nl/~hartman/wikipedia/saferversion.webarchive I have now looked further into this issue. It was very hard to reduce what was causing this. However I think i have now traced the issue. Making the following changes in the javascript tool fixed the problem for me: http://en.wikipedia.org/w/index.php?title=User%3ATheDJ%2Fmorebits.js&diff=198208031&oldid=197808959 Basically I changed var cssNode = document.createElement('style'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.appendChild( document.createTextNode("")); // Safari bugfix document.getElementsByTagName("head")[0].appendChild(cssNode); var styles = cssNode.sheet ? cssNode.sheet : cssNode.stylesSheet; styles.insertRule("my line of CSS", 0); styles.insertRule("another line of CSS", 0); to var cssNode = document.createElement('style'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.appendChild( document.createTextNode("myCSS" )); document.getElementsByTagName("head")[0].appendChild(cssNode); So it seems that DOM editing and then using insertRule() breaks something that, as far as I know it should not break. As you may note in the original code there is a reference to a Safari bugfix. This would be bug #14462. It might be related in some way, but I'm not sure.
Attachments
Mark Rowe (bdash)
Comment 1 2008-03-14 10:15:17 PDT
*** Bug 17848 has been marked as a duplicate of this bug. ***
Shane Stephens
Comment 2 2011-07-06 20:52:56 PDT
Is this still happening in recent versions of WebKit? Any chance of a reduction?
Note You need to log in before you can comment on or make changes to this bug.