Changeset 206048 in webkit
- Timestamp:
- Sep 16, 2016 2:20:23 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206044 r206048 1 2016-09-16 Brent Fulgham <bfulgham@apple.com> 2 3 CaptionUserPreferences's use of the PageGroup's page map is incorrect 4 https://bugs.webkit.org/show_bug.cgi?id=122194 5 <rdar://problem/27332004> 6 7 Reviewed by Zalan Bujtas. 8 9 Avoid the possibility of dereferencing an unsafe iterator by checking 10 for an empty HashSet before using the result of 'begin()'. 11 12 No new tests because there is no change in behavior. 13 14 * page/CaptionUserPreferences.cpp: 15 (WebCore::CaptionUserPreferences::CaptionUserPreferences): Use new safer 16 accessor to retrieve the current page. 17 (WebCore::CaptionUserPreferences::setCaptionDisplayMode): Ditto. 18 (WebCore::CaptionUserPreferences::currentPage): Added. 19 (WebCore::CaptionUserPreferences::userPrefersCaptions): Use new safer 20 accessor to retrieve the current page. 21 (WebCore::CaptionUserPreferences::setUserPrefersCaptions): Ditto. 22 (WebCore::CaptionUserPreferences::userPrefersSubtitles): Ditto. 23 (WebCore::CaptionUserPreferences::setUserPrefersSubtitles): Ditto. 24 (WebCore::CaptionUserPreferences::userPrefersTextDescriptions): Ditto. 25 (WebCore::CaptionUserPreferences::setUserPrefersTextDescriptions): Ditto. 26 * page/CaptionUserPreferences.h: 27 1 28 2016-09-16 Alex Christensen <achristensen@webkit.org> 2 29 -
trunk/Source/WebCore/page/CaptionUserPreferences.cpp
r205462 r206048 1 1 /* 2 * Copyright (C) 2013 , 2015Apple Inc. All rights reserved.2 * Copyright (C) 2013-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 50 50 , m_displayMode(ForcedOnly) 51 51 , m_timer(*this, &CaptionUserPreferences::timerFired) 52 , m_testingMode(false)53 , m_havePreferences(false)54 52 { 55 53 } … … 100 98 } 101 99 100 Page* CaptionUserPreferences::currentPage() const 101 { 102 if (m_pageGroup.pages().isEmpty()) 103 return nullptr; 104 105 return *(m_pageGroup.pages().begin()); 106 } 107 102 108 bool CaptionUserPreferences::userPrefersCaptions() const 103 109 { 104 Page* page = *(m_pageGroup.pages().begin());110 Page* page = currentPage(); 105 111 if (!page) 106 112 return false; … … 111 117 void CaptionUserPreferences::setUserPrefersCaptions(bool preference) 112 118 { 113 Page* page = *(m_pageGroup.pages().begin());119 Page* page = currentPage(); 114 120 if (!page) 115 121 return; … … 121 127 bool CaptionUserPreferences::userPrefersSubtitles() const 122 128 { 123 Page* page = *(pageGroup().pages().begin());129 Page* page = currentPage(); 124 130 if (!page) 125 131 return false; … … 130 136 void CaptionUserPreferences::setUserPrefersSubtitles(bool preference) 131 137 { 132 Page* page = *(m_pageGroup.pages().begin());138 Page* page = currentPage(); 133 139 if (!page) 134 140 return; … … 140 146 bool CaptionUserPreferences::userPrefersTextDescriptions() const 141 147 { 142 Page* page = *(m_pageGroup.pages().begin());148 Page* page = currentPage(); 143 149 if (!page) 144 150 return false; … … 149 155 void CaptionUserPreferences::setUserPrefersTextDescriptions(bool preference) 150 156 { 151 Page* page = *(m_pageGroup.pages().begin());157 Page* page = currentPage(); 152 158 if (!page) 153 159 return; -
trunk/Source/WebCore/page/CaptionUserPreferences.h
r200673 r206048 1 1 /* 2 * Copyright (C) 2012 , 2013Apple Inc. All rights reserved.2 * Copyright (C) 2012-2016 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef CaptionUserPreferences_h 27 #define CaptionUserPreferences_h 26 #pragma once 28 27 29 28 #if ENABLE(VIDEO_TRACK) … … 106 105 void timerFired(); 107 106 void notify(); 107 Page* currentPage() const; 108 108 109 109 PageGroup& m_pageGroup; … … 115 115 String m_primaryAudioTrackLanguageOverride; 116 116 unsigned m_blockNotificationsCounter { 0 }; 117 bool m_testingMode ;118 bool m_havePreferences ;117 bool m_testingMode { false }; 118 bool m_havePreferences { false }; 119 119 }; 120 120 121 121 } 122 122 #endif 123 124 #endif
Note: See TracChangeset
for help on using the changeset viewer.