Bug 457050. Don't mess up our background load flag. r+sr=biesi

This commit is contained in:
Boris Zbarsky 2008-09-29 16:42:19 -04:00
Родитель eb1a613d0e
Коммит 2facb3c7ab
4 изменённых файлов: 52 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,8 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="javascript:'p { color: green }'">
</head>
<body onload="parent.next(window);">
<p>Hello</p>
</body>
</html>

Просмотреть файл

@ -0,0 +1,18 @@
<html class="reftest-wait">
<head>
<script type="text/javascript">
var i = 0;
function next(w)
{
++i;
if (i == 1)
w.location.reload();
if (i == 2)
document.documentElement.removeAttribute("class");
}
</script>
</head>
<body>
<iframe src="457050-1-inner.html"></iframe>
</body>
</html>

Просмотреть файл

@ -1,3 +1,4 @@
load 341963-1.html
load 344874-1.html
load 344996-1.xhtml
load 457050-1.html

Просмотреть файл

@ -849,6 +849,25 @@ nsJSChannel::GetLoadFlags(nsLoadFlags *aLoadFlags)
NS_IMETHODIMP
nsJSChannel::SetLoadFlags(nsLoadFlags aLoadFlags)
{
// Figure out whether the LOAD_BACKGROUND bit in aLoadFlags is
// actually right.
PRBool bogusLoadBackground = PR_FALSE;
if (mIsActive && !(mActualLoadFlags & LOAD_BACKGROUND) &&
(aLoadFlags & LOAD_BACKGROUND)) {
// We're getting a LOAD_BACKGROUND, but it's probably just our own fake
// flag being mirrored to us. The one exception is if our loadgroup is
// LOAD_BACKGROUND.
PRBool loadGroupIsBackground = PR_FALSE;
nsCOMPtr<nsILoadGroup> loadGroup;
mStreamChannel->GetLoadGroup(getter_AddRefs(loadGroup));
if (loadGroup) {
nsLoadFlags loadGroupFlags;
loadGroup->GetLoadFlags(&loadGroupFlags);
loadGroupIsBackground = ((loadGroupFlags & LOAD_BACKGROUND) != 0);
}
bogusLoadBackground = !loadGroupIsBackground;
}
// Since the javascript channel is never the actual channel that
// any data is loaded through, don't ever set the
// LOAD_DOCUMENT_URI flag on it, since that could lead to two
@ -860,6 +879,12 @@ nsJSChannel::SetLoadFlags(nsLoadFlags aLoadFlags)
mLoadFlags = aLoadFlags & ~LOAD_DOCUMENT_URI;
if (bogusLoadBackground) {
aLoadFlags = aLoadFlags & ~LOAD_BACKGROUND;
}
mActualLoadFlags = aLoadFlags;
// ... but the underlying stream channel should get this bit, if
// set, since that'll be the real document channel if the
// javascript: URL generated data.