Changeset 111770 in webkit


Ignore:
Timestamp:
Mar 22, 2012 3:03:20 PM (12 years ago)
Author:
kubo@profusion.mobi
Message:

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

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r111768 r111770  
     12012-03-22  Raphael Kubo da Costa  <rakuco@FreeBSD.org>
     2
     3        Crash in fast/dom/navigator-detached-nocrash.html
     4        https://bugs.webkit.org/show_bug.cgi?id=81773
     5
     6        Reviewed by Adam Barth.
     7
     8        BatteryManager::create() blindly assumes the Navigator* it
     9        receives has a valid Frame, which is not always the case, as made
     10        evident by the crashing test.
     11
     12        Follow abarth's suggestion and just stop
     13        NavigatorBattery::webkitBattery() before it reaches the call to
     14        BatteryManager::create() if that's the case.
     15
     16        No new tests, covered by fast/dom/navigator-detached-nocrash.html.
     17
     18        * Modules/battery/NavigatorBattery.cpp:
     19        (WebCore::NavigatorBattery::webkitBattery):
     20
    1212012-03-22  Emil A Eklund  <eae@chromium.org>
    222
  • trunk/Source/WebCore/Modules/battery/NavigatorBattery.cpp

    r110991 r111770  
    4040BatteryManager* NavigatorBattery::webkitBattery(ScriptExecutionContext* context, Navigator* navigator)
    4141{
     42    if (!navigator->frame())
     43        return 0;
     44
    4245    NavigatorBattery* navigatorBattery = NavigatorBattery::from(navigator);
    4346    if (!navigatorBattery->m_batteryManager)
Note: See TracChangeset for help on using the changeset viewer.