Backout Bug 818559 to fix Bug 820067, a=me

This commit is contained in:
Olli Pettay 2012-12-10 21:52:01 +02:00
parent 639134ed10
commit 5b5db16421
4 changed files with 8 additions and 18 deletions

View File

@ -23,7 +23,6 @@ function test () {
function testLink(link, name, next) {
addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function (win) {
is(doc.getElementById("unload-flag").textContent, "Okay", "beforeunload shouldn't have fired");
is(win.document.getElementById("location").value, name, "file name should match");
win.close();
next();
@ -118,4 +117,4 @@ TabOpenListener.prototype = {
this.closecallback = null;
}
}
};
};

View File

@ -33,15 +33,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=676619
li.appendChild(a);
document.getElementsByTagName('ul')[0].appendChild(li);
window.addEventListener("beforeunload", function (evt) {
document.getElementById("unload-flag").textContent = "Fail";
});
</script>
<ul>
<li><a href="http://example.com/"
download="example.com" id="link7" target="_blank">Download "example.com"</a></li>
<ul>
<div id="unload-flag">Okay</div>
</body>
</html>

View File

@ -8982,13 +8982,12 @@ nsDocShell::InternalLoad(nsIURI * aURI,
if (!bIsJavascript) {
MaybeInitTiming();
}
bool timeBeforeUnload = mTiming && aFileName.IsVoid();
if (timeBeforeUnload) {
if (mTiming) {
mTiming->NotifyBeforeUnload();
}
// Check if the page doesn't want to be unloaded. The javascript:
// protocol handler deals with this for javascript: URLs.
if (!bIsJavascript && aFileName.IsVoid() && mContentViewer) {
if (!bIsJavascript && mContentViewer) {
bool okToUnload;
rv = mContentViewer->PermitUnload(false, &okToUnload);
@ -8999,7 +8998,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
}
}
if (timeBeforeUnload) {
if (mTiming) {
mTiming->NotifyUnloadAccepted(mCurrentURI);
}

View File

@ -785,13 +785,10 @@ nsJSChannel::EvaluateScript()
nsLoadFlags loadFlags;
mStreamChannel->GetLoadFlags(&loadFlags);
uint32_t disposition;
if (NS_FAILED(mStreamChannel->GetContentDisposition(&disposition)))
disposition = nsIChannel::DISPOSITION_INLINE;
if (loadFlags & LOAD_DOCUMENT_URI && disposition != nsIChannel::DISPOSITION_ATTACHMENT) {
// We're loaded as the document channel and not expecting to download
// the result. If we go on, we'll blow away the current document. Make
// sure that's ok. If so, stop all pending network loads.
if (loadFlags & LOAD_DOCUMENT_URI) {
// We're loaded as the document channel. If we go on,
// we'll blow away the current document. Make sure that's
// ok. If so, stop all pending network loads.
nsCOMPtr<nsIDocShell> docShell;
NS_QueryNotificationCallbacks(mStreamChannel, docShell);