Index: Source/core/svg/SVGScriptElement.cpp |
diff --git a/Source/core/svg/SVGScriptElement.cpp b/Source/core/svg/SVGScriptElement.cpp |
index aed347235f0873f06885603424445d49e6afde42..5ab4c0d2d457467d749b8a5cb93e8c803dc13b02 100644 |
--- a/Source/core/svg/SVGScriptElement.cpp |
+++ b/Source/core/svg/SVGScriptElement.cpp |
@@ -126,7 +126,8 @@ void SVGScriptElement::childrenChanged(const ChildrenChange& change) |
void SVGScriptElement::didMoveToNewDocument(Document& oldDocument) |
{ |
- oldDocument.scriptRunner()->movePendingAsyncScript(document().scriptRunner(), m_loader.get()); |
+ if (RefPtrWillBeRawPtr<Document> contextDocument = document().contextDocument().get()) |
+ oldDocument.scriptRunner()->movePendingAsyncScript(contextDocument->scriptRunner(), m_loader.get()); |
SVGElement::didMoveToNewDocument(oldDocument); |
} |