Changeset 54079 in webkit


Ignore:
Timestamp:
Jan 29, 2010 2:08:05 PM (14 years ago)
Author:
sfalken@apple.com
Message:

2010-01-29 Steve Falkenburg <sfalken@apple.com>

Reviewed by Darin Adler.

Client-based Geolocation starts updating before getting consent from the user
https://bugs.webkit.org/show_bug.cgi?id=34343

  • page/Geolocation.cpp: (WebCore::Geolocation::startRequest): Pass notifier instead of options to startUpdating. (WebCore::Geolocation::setIsAllowed): Add the observer or notify of error for deferred startUpdating. (WebCore::Geolocation::startUpdating): Pass notifier instead of options, since we may need to call it if we fail to get user consent. Defer adding the observer if we don't yet have user consent, since this could kick off server-based wifi Geolocation requests.
  • page/Geolocation.h:
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54078 r54079  
     12010-01-29  Steve Falkenburg  <sfalken@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Client-based Geolocation starts updating before getting consent from the user
     6        https://bugs.webkit.org/show_bug.cgi?id=34343
     7
     8        * page/Geolocation.cpp:
     9        (WebCore::Geolocation::startRequest): Pass notifier instead of options to startUpdating.
     10        (WebCore::Geolocation::setIsAllowed): Add the observer or notify of error for deferred startUpdating.
     11        (WebCore::Geolocation::startUpdating): Pass notifier instead of options, since we may need to call it if we fail to get user consent.
     12        Defer adding the observer if we don't yet have user consent, since this could kick off
     13        server-based wifi Geolocation requests.
     14        * page/Geolocation.h:
     15
    1162010-01-28  Jon Honeycutt  <jhoneycutt@apple.com>
    217
  • trunk/WebCore/page/Geolocation.cpp

    r53708 r54079  
    246246        notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
    247247    else {
    248         if (notifier->hasZeroTimeout() || startUpdating(notifier->m_options.get()))
     248        if (notifier->hasZeroTimeout() || startUpdating(notifier.get()))
    249249            notifier->startTimerIfNeeded();
    250250        else
     
    301301{
    302302    m_allowGeolocation = allowed ? Yes : No;
     303   
     304#if ENABLE(CLIENT_BASED_GEOLOCATION)
     305    if (m_startRequestPermissionNotifier) {
     306        if (isAllowed()) {
     307            // Permission request was made during the startUpdating process
     308            m_startRequestPermissionNotifier = 0;
     309            if (!m_frame)
     310                return;
     311            Page* page = m_frame->page();
     312            if (!page)
     313                return;
     314            page->geolocationController()->addObserver(this);
     315        } else {
     316            m_startRequestPermissionNotifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
     317            m_oneShots.add(m_startRequestPermissionNotifier);
     318            m_startRequestPermissionNotifier = 0;
     319        }
     320        return;
     321    }
     322#endif
    303323   
    304324    if (isAllowed())
     
    480500#endif
    481501
    482 bool Geolocation::startUpdating(PositionOptions* options)
     502bool Geolocation::startUpdating(GeoNotifier* notifier)
    483503{
    484504#if ENABLE(CLIENT_BASED_GEOLOCATION)
    485505    // FIXME: Pass options to client.
    486     UNUSED_PARAM(options);
    487 
     506
     507    if (!isAllowed()) {
     508        m_startRequestPermissionNotifier = notifier;
     509        requestPermission();
     510        return true;
     511    }
     512   
    488513    if (!m_frame)
    489514        return false;
     
    496521    return true;
    497522#else
    498     return m_service->startUpdating(options);
     523    return m_service->startUpdating(notifier->options);
    499524#endif
    500525}
  • trunk/WebCore/page/Geolocation.h

    r53342 r54079  
    139139    void requestPermission();
    140140
    141     bool startUpdating(PositionOptions*);
     141    bool startUpdating(GeoNotifier*);
    142142    void stopUpdating();
    143143
     
    160160#if !ENABLE(CLIENT_BASED_GEOLOCATION)
    161161    OwnPtr<GeolocationService> m_service;
     162#else
     163    RefPtr<GeoNotifier> m_startRequestPermissionNotifier;
    162164#endif
    163165    RefPtr<Geoposition> m_lastPosition;
Note: See TracChangeset for help on using the changeset viewer.