Commit 27a28d44 authored by ddkilzer's avatar ddkilzer
Browse files

LayoutTests:

        Reviewed by David Hyatt.

        - tests for http://bugs.webkit.org/show_bug.cgi?id=13563
          REGRESSION: Crash loading message in Yahoo! Mail

        * fast/css/stale-style-selector-crash-1-expected.txt: Added.
        * fast/css/stale-style-selector-crash-1.html: Added.
        * fast/css/stale-style-selector-crash-2-expected.txt: Added.
        * fast/css/stale-style-selector-crash-2.html: Added.

WebCore:

        Reviewed by David Hyatt.

        - fix http://bugs.webkit.org/show_bug.cgi?id=13563
          REGRESSION: Crash loading message in Yahoo! Mail

        Tests: fast/css/stale-style-selector-crash-1.html
               fast/css/stale-style-selector-crash-2.html

        * dom/Document.cpp:
        (WebCore::Document::Document): Initialize the m_didCalculateStyleSelector
        flag to 'false'.
        (WebCore::Document::updateStyleSelector): Do not bail out if we have ever
        calculated a non-trivial style selector, even if at the moment we are
        pending style sheets. We could have calculated a non-trivial selector
        already either because at some point there were no pending style sheets
        (so the currently pending ones were added dynamically) or because we were
        forced to do a layout ignoring pending style sheets. Either way, once
        there is a style selector, we need to keep it up to date, otherwise we can
        crash under recalcStyle() during updateRendering() or simply not recalculate
        style correctly for dynamic changes.
        (WebCore::Document::recalcStyleSelector): Set m_didCalculateStyleSelector
        to 'true' when creating a new style selector.
        * dom/Document.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9a44838d
<<<<<<< .mine
2007-05-23 Mitz Pettel <mitz@webkit.org>
Reviewed by David Hyatt.
- tests for http://bugs.webkit.org/show_bug.cgi?id=13563
REGRESSION: Crash loading message in Yahoo! Mail
* fast/css/stale-style-selector-crash-1-expected.txt: Added.
* fast/css/stale-style-selector-crash-1.html: Added.
* fast/css/stale-style-selector-crash-2-expected.txt: Added.
* fast/css/stale-style-selector-crash-2.html: Added.
=======
2007-05-23 Darin Adler <darin@apple.com>
 
Reviewed by Hyatt.
......@@ -20,6 +34,7 @@
* fast/dom/prototype-chain-expected.txt:
* fast/dom/prototype-chain.html:
 
>>>>>>> .r21688
2007-05-23 Kevin McCullough <kmccullough@apple.com>
 
Reviewed by Darin.
Test for http://bugs.webkit.org/show_bug.cgi?id=13563 REGRESSION: Crash loading message in Yahoo! Mail.
The following line should say SUCCESS in green letters over a white background.
SUCCESS
<html>
<head id="head">
<style id="inlineRules">
#foo { background-color: red; }
</style>
</head>
<body>
<p>
Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=13563">http://bugs.webkit.org/show_bug.cgi?id=13563</a>
REGRESSION: Crash loading message in Yahoo! Mail</i>.
</p>
<p>
The following line should say SUCCESS in green letters over a white background.
</p>
<div id="foo">SUCCESS</div>
<script>
function test()
{
var head = document.getElementById("head");
var link = document.createElement("link");
link.setAttribute("href", "data:text/css,");
link.setAttribute("rel", "stylesheet");
// This will increase the pending stylesheet count
head.appendChild(link);
var inline = document.getElementById("inlineRules");
// This will delete the rule (duh) but since we have
// pending stylesheets, will NOT update the style selector
inline.sheet.deleteRule(0);
// Make ourselves need a style recalc, so that
// updateRendering() will do something when called soon
document.getElementById("foo").style.color = "green";
if (window.layoutTestController)
layoutTestController.notifyDone();
}
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
setTimeout(test, 0);
</script>
</body>
</html>
Test for http://bugs.webkit.org/show_bug.cgi?id=13563 REGRESSION: Crash loading message in Yahoo! Mail.
The following line should say SUCCESS in green letters over a white background.
SUCCESS
<html>
<head id="head">
<style id="inlineRules">
#foo { background-color: red; }
</style>
<link rel="stylesheet" href="data:text/css,">
</head>
<body>
<p>
Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=13563">http://bugs.webkit.org/show_bug.cgi?id=13563</a>
REGRESSION: Crash loading message in Yahoo! Mail</i>.
</p>
<p>
The following line should say SUCCESS in green letters over a white background.
</p>
<div id="foo">SUCCESS</div>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
// Force a layout ignoring pending stylesheets
document.body.offsetTop;
var inline = document.getElementById("inlineRules");
// This will delete the rule (duh) but since we have
// pending stylesheets, will NOT update the style selector
inline.sheet.deleteRule(0);
// Make ourselves need a style recalc, so that
// updateRendering() will do something when called soon
document.getElementById("foo").style.color = "green";
</script>
</body>
</html>
2007-05-23 Mitz Pettel <mitz@webkit.org>
Reviewed by David Hyatt.
- fix http://bugs.webkit.org/show_bug.cgi?id=13563
REGRESSION: Crash loading message in Yahoo! Mail
Tests: fast/css/stale-style-selector-crash-1.html
fast/css/stale-style-selector-crash-2.html
* dom/Document.cpp:
(WebCore::Document::Document): Initialize the m_didCalculateStyleSelector
flag to 'false'.
(WebCore::Document::updateStyleSelector): Do not bail out if we have ever
calculated a non-trivial style selector, even if at the moment we are
pending style sheets. We could have calculated a non-trivial selector
already either because at some point there were no pending style sheets
(so the currently pending ones were added dynamically) or because we were
forced to do a layout ignoring pending style sheets. Either way, once
there is a style selector, we need to keep it up to date, otherwise we can
crash under recalcStyle() during updateRendering() or simply not recalculate
style correctly for dynamic changes.
(WebCore::Document::recalcStyleSelector): Set m_didCalculateStyleSelector
to 'true' when creating a new style selector.
* dom/Document.h:
2007-05-23 Anders Carlsson <andersca@apple.com>
 
Reviewed by Adam.
......@@ -308,6 +308,7 @@ Document::Document(DOMImplementation* impl, Frame* frame)
m_usesFirstLineRules = false;
m_styleSelector = new CSSStyleSelector(this, m_usersheet, m_styleSheets.get(), !inCompatMode());
m_didCalculateStyleSelector = false;
m_pendingStylesheets = 0;
m_ignorePendingStylesheets = false;
m_pendingSheetLayout = NoLayoutWithPendingSheets;
......@@ -1912,8 +1913,9 @@ void Document::stylesheetLoaded()
void Document::updateStyleSelector()
{
// Don't bother updating, since we haven't loaded all our style info yet.
if (!haveStylesheetsLoaded())
// Don't bother updating, since we haven't loaded all our style info yet
// and haven't calculated the style selector for the first time.
if (!m_didCalculateStyleSelector && !haveStylesheetsLoaded())
return;
if (didLayoutWithPendingStylesheets() && m_pendingStylesheets <= 0) {
......@@ -2068,6 +2070,7 @@ void Document::recalcStyleSelector()
usersheet += m_printSheet;
m_styleSelector = new CSSStyleSelector(this, usersheet, m_styleSheets.get(), !inCompatMode());
m_styleSelector->setEncodedURL(m_url);
m_didCalculateStyleSelector = true;
}
void Document::setHoverNode(PassRefPtr<Node> newHoverNode)
......
......@@ -646,8 +646,9 @@ public:
protected:
CSSStyleSelector* m_styleSelector;
Frame* m_frame;
bool m_didCalculateStyleSelector;
Frame* m_frame;
DocLoader* m_docLoader;
Tokenizer* m_tokenizer;
bool m_wellFormed;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment