mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 448161. Don't crash when getting computed style for a link that's not in the document
This commit is contained in:
parent
afcaac529f
commit
4a8827b86c
22
layout/style/crashtests/448161-1.html
Normal file
22
layout/style/crashtests/448161-1.html
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<html class="reftest-wait">
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function boom()
|
||||||
|
{
|
||||||
|
var r = document.createRange();
|
||||||
|
r.setStart(document.body, 0);
|
||||||
|
r.setEnd(document.getElementById("g"), 0);
|
||||||
|
r.deleteContents();
|
||||||
|
|
||||||
|
// Give spell-check a chance to run
|
||||||
|
setTimeout(function() { document.documentElement.className = ""; },
|
||||||
|
50);
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body onload="boom();" contenteditable="true"><span><span contenteditable="true"><a href="http://www.mozilla.org/">5</a></span></span><span id="g"></span></body>
|
||||||
|
|
||||||
|
</html>
|
9
layout/style/crashtests/448161-2.html
Normal file
9
layout/style/crashtests/448161-2.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
var node = document.createElement("a");
|
||||||
|
node.href = "http://www.mozilla.org";
|
||||||
|
document.defaultView.getComputedStyle(node, "").color
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -18,3 +18,5 @@ load 444237-1.html
|
|||||||
load 444848-1.html
|
load 444848-1.html
|
||||||
load 447776-1.html
|
load 447776-1.html
|
||||||
load 447783-1.html
|
load 447783-1.html
|
||||||
|
load 448161-1.html
|
||||||
|
load 448161-2.html
|
||||||
|
@ -466,8 +466,8 @@ PRBool nsStyleUtil::IsHTMLLink(nsIContent *aContent, nsIAtom *aTag,
|
|||||||
} else {
|
} else {
|
||||||
linkState = eLinkState_NotLink;
|
linkState = eLinkState_NotLink;
|
||||||
}
|
}
|
||||||
if (linkState != eLinkState_NotLink && aForStyling) {
|
if (linkState != eLinkState_NotLink && aForStyling &&
|
||||||
NS_ASSERTION(aContent->GetCurrentDoc(), "Must have document!");
|
aContent->IsInDoc()) {
|
||||||
aContent->GetCurrentDoc()->AddStyleRelevantLink(aContent, hrefURI);
|
aContent->GetCurrentDoc()->AddStyleRelevantLink(aContent, hrefURI);
|
||||||
}
|
}
|
||||||
link->SetLinkState(linkState);
|
link->SetLinkState(linkState);
|
||||||
@ -500,8 +500,7 @@ PRBool nsStyleUtil::IsLink(nsIContent *aContent,
|
|||||||
nsCOMPtr<nsIURI> absURI;
|
nsCOMPtr<nsIURI> absURI;
|
||||||
if (aContent->IsLink(getter_AddRefs(absURI))) {
|
if (aContent->IsLink(getter_AddRefs(absURI))) {
|
||||||
*aState = GetLinkStateFromURI(absURI, aContent, aLinkHandler);
|
*aState = GetLinkStateFromURI(absURI, aContent, aLinkHandler);
|
||||||
if (aForStyling) {
|
if (aForStyling && aContent->IsInDoc()) {
|
||||||
NS_ASSERTION(aContent->GetCurrentDoc(), "Must have document!");
|
|
||||||
aContent->GetCurrentDoc()->AddStyleRelevantLink(aContent, absURI);
|
aContent->GetCurrentDoc()->AddStyleRelevantLink(aContent, absURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user