Index: third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp b/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
index 349287aed4bc887a2a296dfffab347247ad03620..c2ca8114c9bde6d76d3d923334f2a3bf2b04989a 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLStyleElement.cpp |
@@ -107,9 +107,13 @@ const AtomicString& HTMLStyleElement::type() const { |
void HTMLStyleElement::DispatchPendingEvent( |
std::unique_ptr<IncrementLoadEventDelayCount> count) { |
- DispatchEvent(Event::Create(loaded_sheet_ ? EventTypeNames::load |
- : EventTypeNames::error)); |
- |
+ if (loaded_sheet_) { |
+ if (GetDocument().HasListenerType( |
+ Document::LOAD_LISTENER_AT_CAPTURE_PHASE_OR_AT_STYLE_ELEMENT)) |
+ DispatchEvent(Event::Create(EventTypeNames::load)); |
+ } else { |
+ DispatchEvent(Event::Create(EventTypeNames::error)); |
+ } |
// Checks Document's load event synchronously here for performance. |
// This is safe because dispatchPendingEvent() is called asynchronously. |
count->ClearAndCheckLoadEvent(); |