Remove ScriptExecutionContext from NavigatorBattery.idl
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Mar 2012 02:57:04 +0000 (02:57 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Mar 2012 02:57:04 +0000 (02:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82556

Reviewed by Adam Barth.

As Bug 73528 comment #71, NavigatorBattery.idl doesn't need to have ScriptExecutionContext.
Document can be used instead of ScriptExecutionContext.

Tests: batterystatus/add-listener-from-callback.html
       batterystatus/basic-all-types-of-events.html
       batterystatus/basic-operation.html
       batterystatus/event-after-navigation.html
       batterystatus/multiple-frames.html
       batterystatus/updates.html
       batterystatus/window-property.html

* Modules/battery/BatteryManager.cpp:
(WebCore::BatteryManager::create):
(WebCore::BatteryManager::BatteryManager):
* Modules/battery/BatteryManager.h:
(BatteryManager):
* Modules/battery/NavigatorBattery.cpp:
(WebCore::NavigatorBattery::webkitBattery):
* Modules/battery/NavigatorBattery.h:
(NavigatorBattery):
* Modules/battery/NavigatorBattery.idl:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112495 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/battery/BatteryManager.cpp
Source/WebCore/Modules/battery/BatteryManager.h
Source/WebCore/Modules/battery/NavigatorBattery.cpp
Source/WebCore/Modules/battery/NavigatorBattery.h
Source/WebCore/Modules/battery/NavigatorBattery.idl

index 02a4493..1f70702 100644 (file)
@@ -1,3 +1,32 @@
+2012-03-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Remove ScriptExecutionContext from NavigatorBattery.idl
+        https://bugs.webkit.org/show_bug.cgi?id=82556
+
+        Reviewed by Adam Barth.
+
+        As Bug 73528 comment #71, NavigatorBattery.idl doesn't need to have ScriptExecutionContext.
+        Document can be used instead of ScriptExecutionContext.
+
+        Tests: batterystatus/add-listener-from-callback.html
+               batterystatus/basic-all-types-of-events.html
+               batterystatus/basic-operation.html
+               batterystatus/event-after-navigation.html
+               batterystatus/multiple-frames.html
+               batterystatus/updates.html
+               batterystatus/window-property.html
+
+        * Modules/battery/BatteryManager.cpp:
+        (WebCore::BatteryManager::create):
+        (WebCore::BatteryManager::BatteryManager):
+        * Modules/battery/BatteryManager.h:
+        (BatteryManager):
+        * Modules/battery/NavigatorBattery.cpp:
+        (WebCore::NavigatorBattery::webkitBattery):
+        * Modules/battery/NavigatorBattery.h:
+        (NavigatorBattery):
+        * Modules/battery/NavigatorBattery.idl:
+
 2012-03-28  Jason Liu  <jason.liu@torchmobile.com.cn>
 
         [BlackBerry]Missing cookies from HTTP response header in Network tab of Web Inspector.
index 7e8d131..1eabb8e 100644 (file)
@@ -31,9 +31,9 @@
 
 namespace WebCore {
 
-PassRefPtr<BatteryManager> BatteryManager::create(ScriptExecutionContext* context, Navigator* navigator)
+PassRefPtr<BatteryManager> BatteryManager::create(Navigator* navigator)
 {
-    RefPtr<BatteryManager> batteryManager(adoptRef(new BatteryManager(context, navigator)));
+    RefPtr<BatteryManager> batteryManager(adoptRef(new BatteryManager(navigator)));
     batteryManager->suspendIfNeeded();
     return batteryManager.release();
 }
@@ -42,8 +42,8 @@ BatteryManager::~BatteryManager()
 {
 }
 
-BatteryManager::BatteryManager(ScriptExecutionContext* context, Navigator* navigator)
-    : ActiveDOMObject(context, this)
+BatteryManager::BatteryManager(Navigator* navigator)
+    : ActiveDOMObject(navigator->frame()->document(), this)
     , m_batteryController(BatteryController::from(navigator->frame()->page()))
     , m_batteryStatus(0)
 {
index 7978ddc..b24939c 100644 (file)
@@ -35,7 +35,7 @@ class ScriptExecutionContext;
 class BatteryManager : public ActiveDOMObject, public RefCounted<BatteryManager>, public EventTarget {
 public:
     virtual ~BatteryManager();
-    static PassRefPtr<BatteryManager> create(ScriptExecutionContext*, Navigator*);
+    static PassRefPtr<BatteryManager> create(Navigator*);
 
     // EventTarget implementation.
     virtual const WTF::AtomicString& interfaceName() const { return eventNames().interfaceForBatteryManager; }
@@ -68,7 +68,7 @@ protected:
     virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
 
 private:
-    BatteryManager(ScriptExecutionContext*, Navigator*);
+    explicit BatteryManager(Navigator*);
 
     // EventTarget implementation.
     virtual void refEventTarget() { ref(); }
index e0d04dc..0790602 100644 (file)
@@ -37,14 +37,14 @@ NavigatorBattery::~NavigatorBattery()
 {
 }
 
-BatteryManager* NavigatorBattery::webkitBattery(ScriptExecutionContext* context, Navigator* navigator)
+BatteryManager* NavigatorBattery::webkitBattery(Navigator* navigator)
 {
     if (!navigator->frame())
         return 0;
 
     NavigatorBattery* navigatorBattery = NavigatorBattery::from(navigator);
     if (!navigatorBattery->m_batteryManager)
-        navigatorBattery->m_batteryManager = BatteryManager::create(context, navigator);
+        navigatorBattery->m_batteryManager = BatteryManager::create(navigator);
     return navigatorBattery->m_batteryManager.get();
 }
 
index 9fae9df..238f354 100644 (file)
@@ -36,7 +36,7 @@ public:
 
     static NavigatorBattery* from(Navigator*);
 
-    static BatteryManager* webkitBattery(ScriptExecutionContext*, Navigator*);
+    static BatteryManager* webkitBattery(Navigator*);
     BatteryManager* batteryManager();
 
  private:
index 6cdb783..5c21472 100644 (file)
@@ -20,7 +20,6 @@
 module window {
 
     interface [
-        CallWith=ScriptExecutionContext,
         Conditional=BATTERY_STATUS,
         Supplemental=Navigator
     ] NavigatorBattery {