Changeset 227082 in webkit
- Timestamp:
- Jan 17, 2018 1:53:26 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r227081 r227082 1 2018-01-17 Antti Koivisto <antti@apple.com> 2 3 REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32 4 https://bugs.webkit.org/show_bug.cgi?id=181742 5 <rdar://problem/36334726> 6 7 Reviewed by David Kilzer. 8 9 * fast/media/mediaqueryevaluator-crash-expected.txt: Added. 10 * fast/media/mediaqueryevaluator-crash.html: Added. 11 1 12 2018-01-17 Matt Lewis <jlewis3@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r227079 r227082 1 2018-01-17 Antti Koivisto <antti@apple.com> 2 3 REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32 4 https://bugs.webkit.org/show_bug.cgi?id=181742 5 <rdar://problem/36334726> 6 7 Reviewed by David Kilzer. 8 9 Test: fast/media/mediaqueryevaluator-crash.html 10 11 * css/MediaQueryEvaluator.cpp: 12 (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): 13 14 Use WeakPtr<Document> instead of a plain Frame pointer. 15 16 (WebCore::MediaQueryEvaluator::evaluate const): 17 18 Get the frame via document. 19 20 * css/MediaQueryEvaluator.h: 21 * dom/Document.cpp: 22 (WebCore::Document::prepareForDestruction): 23 24 Take care to clear style resolver. 25 1 26 2018-01-17 Youenn Fablet <youenn@apple.com> 2 27 -
trunk/Source/WebCore/css/MediaQueryEvaluator.cpp
r225639 r227082 110 110 MediaQueryEvaluator::MediaQueryEvaluator(const String& acceptedMediaType, const Document& document, const RenderStyle* style) 111 111 : m_mediaType(acceptedMediaType) 112 , m_ frame(document.frame())112 , m_document(const_cast<Document&>(document).createWeakPtr()) 113 113 , m_style(style) 114 114 { … … 138 138 bool MediaQueryEvaluator::evaluate(const MediaQuerySet& querySet, StyleResolver* styleResolver) const 139 139 { 140 LOG_WITH_STREAM(MediaQueries, stream << "MediaQueryEvaluator::evaluate on " << (m_ frame && m_frame->document() ? m_frame->document()->url().string() : emptyString()));140 LOG_WITH_STREAM(MediaQueries, stream << "MediaQueryEvaluator::evaluate on " << (m_document ? m_document->url().string() : emptyString())); 141 141 142 142 auto& queries = querySet.queryVector(); … … 770 770 bool MediaQueryEvaluator::evaluate(const MediaQueryExpression& expression) const 771 771 { 772 if (!m_frame || !m_frame->view() || !m_style) 772 if (!m_document) 773 return m_fallbackResult; 774 775 Document& document = *m_document; 776 auto* frame = document.frame(); 777 if (!frame || !frame->view() || !m_style) 773 778 return m_fallbackResult; 774 779 … … 788 793 return false; 789 794 790 Document& document = *m_frame->document();791 795 if (!document.documentElement()) 792 796 return false; 793 return function(expression.value(), { m_style, document.documentElement()->renderStyle(), document.renderView(), 1, false }, * m_frame, NoPrefix);797 return function(expression.value(), { m_style, document.documentElement()->renderStyle(), document.renderView(), 1, false }, *frame, NoPrefix); 794 798 } 795 799 -
trunk/Source/WebCore/css/MediaQueryEvaluator.h
r217247 r227082 29 29 30 30 #include "MediaQueryExpression.h" 31 #include <wtf/WeakPtr.h> 31 32 32 33 namespace WebCore { … … 75 76 private: 76 77 String m_mediaType; 77 Frame* m_frame { nullptr }; // not owned78 WeakPtr<Document> m_document; 78 79 const RenderStyle* m_style { nullptr }; 79 80 bool m_fallbackResult { false }; -
trunk/Source/WebCore/dom/Document.cpp
r227006 r227082 2362 2362 m_domWindow->willDetachDocumentFromFrame(); 2363 2363 2364 styleScope().clearResolver(); 2365 2364 2366 if (hasLivingRenderTree()) 2365 2367 destroyRenderTree();
Note: See TracChangeset
for help on using the changeset viewer.