Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2888953004: Check that SVGImage is loaded in ImageNotifyFinished() (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index 8c34ea90b7adca781799ab40528b5f1a96055a91..916ed6ef70eae575a8176344e5200d1151d503e2 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -30,6 +30,7 @@
#include "core/animation/DocumentAnimations.h"
#include "core/animation/DocumentTimeline.h"
#include "core/dom/NodeTraversal.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/dom/shadow/FlatTreeTraversal.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
@@ -120,13 +121,21 @@ bool SVGImage::IsInSVGImage(const Node* node) {
return page->GetChromeClient().IsSVGImageChromeClient();
}
+void SVGImage::CheckLoaded() const {
+ CHECK(page_);
+
+ LocalFrame* frame = ToLocalFrame(page_->MainFrame());
+
+ CHECK(frame->GetDocument()->LoadEventFinished());
+}
+
bool SVGImage::CurrentFrameHasSingleSecurityOrigin() const {
if (!page_)
return true;
LocalFrame* frame = ToLocalFrame(page_->MainFrame());
- CHECK(frame->GetDocument()->LoadEventFinished());
+ CheckLoaded();
SVGSVGElement* root_element =
frame->GetDocument()->AccessSVGExtensions().rootElement();
@@ -640,8 +649,15 @@ void SVGImage::LoadCompleted() {
case kWaitingForAsyncLoadCompletion:
load_state_ = kLoadCompleted;
- if (GetImageObserver())
- GetImageObserver()->AsyncLoadCompleted(this);
+ if (GetImageObserver()) {
+ TaskRunnerHelper::Get(TaskType::kDOMManipulation,
+ ToLocalFrame(page_->MainFrame())->GetDocument())
+ ->PostTask(
+ BLINK_FROM_HERE,
+ WTF::Bind(&ImageObserver::AsyncLoadCompleted,
+ WeakPersistent<ImageObserver>(GetImageObserver()),
+ RefPtr<SVGImage>(this)));
+ }
break;
case kDataChangedNotStarted:

Powered by Google App Engine
This is Rietveld 408576698