Changeset 72396 in webkit


Ignore:
Timestamp:
Nov 19, 2010 7:06:41 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-19 John Knottenbelt <jknotten@chromium.org>

Reviewed by Jeremy Orlow.

Reentrant Geolocation tests crash with an assertion.
https://bugs.webkit.org/show_bug.cgi?id=39908

PositionErrors should not be sent to Geolocation watches or one
shots that are due to receive a valid cached position. Re-enable
fast/dom/Geolocation/maximum-age.html on Mac WebKit.

  • platform/mac/Skipped:

2010-11-19 John Knottenbelt <jknotten@chromium.org>

Reviewed by Jeremy Orlow.

Reentrant Geolocation tests crash with an assertion.
https://bugs.webkit.org/show_bug.cgi?id=39908

PositionErrors should not be sent to Geolocation watches or one shots
that are due to receive a valid cached position.

Test: fast/dom/Geolocation/maximum-age.html

  • page/Geolocation.cpp: (WebCore::Geolocation::sendError): (WebCore::Geolocation::copyCachedNotifiers): (WebCore::Geolocation::handleError):
  • page/Geolocation.h:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72395 r72396  
     12010-11-19  John Knottenbelt  <jknotten@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Reentrant Geolocation tests crash with an assertion.
     6        https://bugs.webkit.org/show_bug.cgi?id=39908
     7
     8        PositionErrors should not be sent to Geolocation watches or one
     9        shots that are due to receive a valid cached position. Re-enable
     10        fast/dom/Geolocation/maximum-age.html on Mac WebKit.
     11
     12        * platform/mac/Skipped:
     13
    1142010-11-19  Anton Muhin  <antonm@chromium.org>
    215
  • trunk/LayoutTests/platform/mac/Skipped

    r72210 r72396  
    182182http/tests/misc/prefetch-purpose.html
    183183
    184 # https://bugs.webkit.org/show_bug.cgi?id=39908
    185 fast/dom/Geolocation/maximum-age.html
    186 
    187184# Filenames aren't filtered out from edit drags yet, see https://bugs.wekit.org/show_bug.cgi?id=38826
    188185editing/pasteboard/file-drag-to-editable.html
  • trunk/WebCore/ChangeLog

    r72394 r72396  
     12010-11-19  John Knottenbelt  <jknotten@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Reentrant Geolocation tests crash with an assertion.
     6        https://bugs.webkit.org/show_bug.cgi?id=39908
     7
     8        PositionErrors should not be sent to Geolocation watches or one shots
     9        that are due to receive a valid cached position.
     10
     11        Test: fast/dom/Geolocation/maximum-age.html
     12
     13        * page/Geolocation.cpp:
     14        (WebCore::Geolocation::sendError):
     15        (WebCore::Geolocation::copyCachedNotifiers):
     16        (WebCore::Geolocation::handleError):
     17        * page/Geolocation.h:
     18
    1192010-11-19  Sam Magnuson  <smagnuso@gmail.com>
    220
  • trunk/WebCore/page/Geolocation.cpp

    r72213 r72396  
    523523}
    524524
     525void Geolocation::extractNotifiersWithCachedPosition(GeoNotifierVector& notifiers, GeoNotifierVector* cached)
     526{
     527    GeoNotifierVector nonCached;
     528    GeoNotifierVector::iterator end = notifiers.end();
     529    for (GeoNotifierVector::const_iterator it = notifiers.begin(); it != end; ++it) {
     530        GeoNotifier* notifier = it->get();
     531        if (notifier->m_useCachedPosition) {
     532            if (cached)
     533                cached->append(notifier);
     534        } else
     535            nonCached.append(notifier);
     536    }
     537    notifiers.swap(nonCached);
     538}
     539
     540void Geolocation::copyToSet(const GeoNotifierVector& src, GeoNotifierSet& dest)
     541{
     542     GeoNotifierVector::const_iterator end = src.end();
     543     for (GeoNotifierVector::const_iterator it = src.begin(); it != end; ++it) {
     544         GeoNotifier* notifier = it->get();
     545         dest.add(notifier);
     546     }
     547}
     548
    525549void Geolocation::handleError(PositionError* error)
    526550{
     
    536560    // added by calls to Geolocation methods from the callbacks, and to prevent
    537561    // further callbacks to these notifiers.
     562    GeoNotifierVector oneShotsWithCachedPosition;
    538563    m_oneShots.clear();
    539564    if (error->isFatal())
    540565        m_watchers.clear();
     566    else {
     567        // Don't send non-fatal errors to notifiers due to receive a cached position.
     568        extractNotifiersWithCachedPosition(oneShotsCopy, &oneShotsWithCachedPosition);
     569        extractNotifiersWithCachedPosition(watchersCopy, 0);
     570    }
    541571
    542572    sendError(oneShotsCopy, error);
    543573    sendError(watchersCopy, error);
    544574
     575    // hasListeners() doesn't distinguish between notifiers due to receive a
     576    // cached position and those requiring a fresh position. Perform the check
     577    // before restoring the notifiers below.
    545578    if (!hasListeners())
    546579        stopUpdating();
     580
     581    // Maintain a reference to the cached notifiers until their timer fires.
     582    copyToSet(oneShotsWithCachedPosition, m_oneShots);
    547583}
    548584
  • trunk/WebCore/page/Geolocation.h

    r72213 r72396  
    134134    void sendPosition(GeoNotifierVector&, Geoposition*);
    135135
     136    static void extractNotifiersWithCachedPosition(GeoNotifierVector& notifiers, GeoNotifierVector* cached);
     137    static void copyToSet(const GeoNotifierVector&, GeoNotifierSet&);
     138
    136139    static void stopTimer(GeoNotifierVector&);
    137140    void stopTimersForOneShots();
Note: See TracChangeset for help on using the changeset viewer.