Skip to content

Instantly share code, notes, and snippets.

@torarnv
Created May 7, 2009 14:07
Show Gist options
  • Save torarnv/108099 to your computer and use it in GitHub Desktop.
Save torarnv/108099 to your computer and use it in GitHub Desktop.
commit 138df16970c56a829f9a05032e63108adb925200
Author: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
Date: Thu May 7 16:07:39 2009 +0200
Don't start a new load if one is already in progress
This can happen if the document loader is set to not defer main
resource data load, and the loaded data contains a piece of
JavaScript with an alert() or similar.
As part of passing the alert to the chrome a PageGroupLoadDeferrer
is used in Chrome::runJavaScriptAlert(), which will in turn call
MainResourceLoader::setDefersLoading(false) when going out of scope.
Since the resource loading is at that point started, but not finished,
(m_initialRequest is still valid), we need to guard against calling
loadNow() a second time (using m_response as that guard).
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index 8259d95..2409baa 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -545,7 +545,7 @@ void MainResourceLoader::setDefersLoading(bool defers)
if (m_substituteData.isValid() && m_documentLoader->deferMainResourceDataLoad())
startDataLoadTimer();
- else {
+ else if (m_response.isNull()) {
ResourceRequest r(m_initialRequest);
m_initialRequest = ResourceRequest();
loadNow(r);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment