Josh Matthews於 2013年10月9日星期三UTC+8下午6時18分49秒寫道:
> nsPIDOMWindow is one of the classes that nsGlobalWindow inherits from. 
> 
> They're mostly interchangeable in practice.
> 
> 
> 
> On 10/08/2013 08:59 PM, [email protected] wrote:
> 
> > Hi,
> 
> >
> 
> > In Gaia, we can add an eventlistener for some specific sensors, let's say 
> > "devicelight".
> 
> >
> 
> > By tracing the call, this will call nsEventListenerManager.cpp in gecko,
> 
> >
> 
> > however, in gecko, i assume this will then go to nsGlobalWindow.cpp but 
> > there is one code confuses me.
> 
> >
> 
> > nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
> 
> >
> 
> > The context is:
> 
> >
> 
> > nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
> 
> >    if (!window) {
> 
> >      return;
> 
> >    }
> 
> >
> 
> >    switch (aType) {
> 
> >      case NS_DEVICE_LIGHT:
> 
> >        window->EnableDeviceSensor(SENSOR_LIGHT);
> 
> >        break;
> 
> >      }
> 
> >
> 
> >
> 
> > I dont understand the role of "nsCOMPtr<nsPIDOMWindow> window = 
> > GetTargetAsInnerWindow();" here since I expect to see nsGlobalWindow.
> 
> >
> 
> >
> 
> > Can anyone explain a bit here?  Thanks
> 
> >

I see. Thanks!
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to