Commit a389915e authored by kubo@profusion.mobi's avatar kubo@profusion.mobi

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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@111770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c032a011
2012-03-22 Raphael Kubo da Costa <rakuco@FreeBSD.org>
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 <eae@chromium.org>
Unreviewed, add missing include statement for CSSValueList.h.
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment