summaryrefslogtreecommitdiff
path: root/Source/WebCore/loader
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/loader')
-rw-r--r--Source/WebCore/loader/DocumentWriter.cpp6
-rw-r--r--Source/WebCore/loader/FrameLoader.cpp5
2 files changed, 10 insertions, 1 deletions
diff --git a/Source/WebCore/loader/DocumentWriter.cpp b/Source/WebCore/loader/DocumentWriter.cpp
index 442e3bf57..593c0a5e7 100644
--- a/Source/WebCore/loader/DocumentWriter.cpp
+++ b/Source/WebCore/loader/DocumentWriter.cpp
@@ -71,6 +71,12 @@ DocumentWriter::DocumentWriter(Frame* frame)
void DocumentWriter::replaceDocument(const String& source, Document* ownerDocument)
{
m_frame->loader().stopAllLoaders();
+
+ // If we are in the midst of changing the frame's document, don't execute script
+ // that modifes the document further:
+ if (m_frame->documentIsBeingReplaced())
+ return;
+
begin(m_frame->document()->url(), true, ownerDocument);
// begin() might fire an unload event, which will result in a situation where no new document has been attached,
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 705b0f5a5..1d6c60ba5 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -591,7 +591,7 @@ void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool
if (clearWindowProperties) {
InspectorInstrumentation::frameWindowDiscarded(&m_frame, m_frame.document()->domWindow());
m_frame.document()->domWindow()->resetUnlessSuspendedForDocumentSuspension();
- m_frame.script().clearWindowShell(newDocument->domWindow(), m_frame.document()->inPageCache());
+ m_frame.script().clearWindowShellsNotMatchingDOMWindow(newDocument->domWindow(), m_frame.document()->inPageCache());
}
m_frame.selection().prepareForDestruction();
@@ -609,6 +609,9 @@ void FrameLoader::clear(Document* newDocument, bool clearWindowProperties, bool
subframeLoader().clear();
+ if (clearWindowProperties)
+ m_frame.script().setDOMWindowForWindowShell(newDocument->domWindow());
+
if (clearScriptObjects)
m_frame.script().clearScriptObjects();