Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index f8d2de1a09bec550aed51295f19009f354839eef..e55ea85204d0fb7c4ef4e951607fd3d934be500a 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -2275,12 +2275,14 @@ void Document::implicitClose() |
if (f) |
f->animation()->resumeAnimationsForDocument(this); |
- ImageLoader::dispatchPendingBeforeLoadEvents(); |
- ImageLoader::dispatchPendingLoadEvents(); |
- ImageLoader::dispatchPendingErrorEvents(); |
+ if (f && f->script()->canExecuteScripts(NotAboutToExecuteScript)) { |
+ ImageLoader::dispatchPendingBeforeLoadEvents(); |
+ ImageLoader::dispatchPendingLoadEvents(); |
+ ImageLoader::dispatchPendingErrorEvents(); |
- HTMLLinkElement::dispatchPendingLoadEvents(); |
- HTMLStyleElement::dispatchPendingLoadEvents(); |
+ HTMLLinkElement::dispatchPendingLoadEvents(); |
+ HTMLStyleElement::dispatchPendingLoadEvents(); |
+ } |
// To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from |
// here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false", |