diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 9dd3992c5dc9e28939e97484b55323fea0ab8238..0a782478d936caaa6217de96418ed9da499f4b8e 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,23 @@ +2012-03-22 Raphael Kubo da Costa + + Crash in fast/dom/navigator-detached-nocrash.html + https://bugs.webkit.org/show_bug.cgi?id=81773 + + Reviewed by Adam Barth. + + BatteryManager::create() blindly assumes the Navigator* it + receives has a valid Frame, which is not always the case, as made + evident by the crashing test. + + Follow abarth's suggestion and just stop + NavigatorBattery::webkitBattery() before it reaches the call to + BatteryManager::create() if that's the case. + + No new tests, covered by fast/dom/navigator-detached-nocrash.html. + + * Modules/battery/NavigatorBattery.cpp: + (WebCore::NavigatorBattery::webkitBattery): + 2012-03-22 Emil A Eklund Unreviewed, add missing include statement for CSSValueList.h. diff --git a/Source/WebCore/Modules/battery/NavigatorBattery.cpp b/Source/WebCore/Modules/battery/NavigatorBattery.cpp index 1b67248b5f813a47b690b37d1bba1c8bf2ac9d16..e0d04dc9d7e31b5710f7941840f92296ac57f128 100644 --- a/Source/WebCore/Modules/battery/NavigatorBattery.cpp +++ b/Source/WebCore/Modules/battery/NavigatorBattery.cpp @@ -39,6 +39,9 @@ NavigatorBattery::~NavigatorBattery() BatteryManager* NavigatorBattery::webkitBattery(ScriptExecutionContext* context, Navigator* navigator) { + if (!navigator->frame()) + return 0; + NavigatorBattery* navigatorBattery = NavigatorBattery::from(navigator); if (!navigatorBattery->m_batteryManager) navigatorBattery->m_batteryManager = BatteryManager::create(context, navigator);