From 201d1593d976012a9ebfff501593a24b9b258dcf Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 29 Sep 2008 16:42:19 -0400 Subject: [PATCH] Bug 457050. Don't mess up our background load flag. r+sr=biesi --- dom/src/jsurl/crashtests/457050-1-inner.html | 8 +++++++ dom/src/jsurl/crashtests/457050-1.html | 18 ++++++++++++++ dom/src/jsurl/crashtests/crashtests.list | 1 + dom/src/jsurl/nsJSProtocolHandler.cpp | 25 ++++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 dom/src/jsurl/crashtests/457050-1-inner.html create mode 100644 dom/src/jsurl/crashtests/457050-1.html diff --git a/dom/src/jsurl/crashtests/457050-1-inner.html b/dom/src/jsurl/crashtests/457050-1-inner.html new file mode 100644 index 00000000000..54521c9a50d --- /dev/null +++ b/dom/src/jsurl/crashtests/457050-1-inner.html @@ -0,0 +1,8 @@ + + + + + +

Hello

+ + diff --git a/dom/src/jsurl/crashtests/457050-1.html b/dom/src/jsurl/crashtests/457050-1.html new file mode 100644 index 00000000000..17e3faf8e22 --- /dev/null +++ b/dom/src/jsurl/crashtests/457050-1.html @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/dom/src/jsurl/crashtests/crashtests.list b/dom/src/jsurl/crashtests/crashtests.list index 6ff35ca7ad7..51f92d51b52 100644 --- a/dom/src/jsurl/crashtests/crashtests.list +++ b/dom/src/jsurl/crashtests/crashtests.list @@ -1,3 +1,4 @@ load 341963-1.html load 344874-1.html load 344996-1.xhtml +load 457050-1.html diff --git a/dom/src/jsurl/nsJSProtocolHandler.cpp b/dom/src/jsurl/nsJSProtocolHandler.cpp index 7d214e2bf20..c2c4cc5b4a2 100644 --- a/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -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 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.