Index: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
index 5a9d71fb75063c7ea70baf978b181de4b6595559..211e788f07cf79774ca859f35eb98dac317a5083 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp |
@@ -472,7 +472,8 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const |
clearSheet(); |
m_sheet = CSSStyleSheet::create(restoredSheet, m_owner); |
m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
- m_sheet->setTitle(m_owner->title()); |
+ if (m_owner->isInDocumentTree()) |
+ m_sheet->setTitle(m_owner->title()); |
setCrossOriginStylesheetStatus(m_sheet.get()); |
m_loading = false; |
@@ -493,7 +494,8 @@ void LinkStyle::setCSSStyleSheet(const String& href, const KURL& baseURL, const |
m_sheet = CSSStyleSheet::create(styleSheet, m_owner); |
m_sheet->setMediaQueries(MediaQuerySet::create(m_owner->media())); |
- m_sheet->setTitle(m_owner->title()); |
+ if (m_owner->isInDocumentTree()) |
+ m_sheet->setTitle(m_owner->title()); |
setCrossOriginStylesheetStatus(m_sheet.get()); |
styleSheet->parseAuthorStyleSheet(cachedStyleSheet, m_owner->document().getSecurityOrigin()); |
@@ -709,7 +711,7 @@ void LinkStyle::process() |
void LinkStyle::setSheetTitle(const String& title) |
{ |
- if (m_sheet) |
+ if (m_sheet && m_owner->isInDocumentTree()) |
m_sheet->setTitle(title); |
} |