⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 195400 in webkit


Ignore:
Timestamp:
Jan 20, 2016, 11:13:45 PM (11 years ago)
Author:
bshafiei@apple.com
Message:

Merged r195075. rdar://problem/24001776

Location:
branches/safari-601.1.46-branch
Files:
5 edited
15 copied

Legend:

Unmodified
Added
Removed
  • branches/safari-601.1.46-branch/LayoutTests/ChangeLog

    r195399 r195400  
     12016-01-20  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r195075.
     4
     5    2016-01-14  Daniel Bates  <dabates@apple.com>
     6
     7            Disallow use of Geolocation service from unique origins
     8            https://bugs.webkit.org/show_bug.cgi?id=153102
     9            <rdar://problem/23055645>
     10
     11            Reviewed by Alexey Proskuryakov.
     12
     13            * fast/dom/Geolocation/dataURL-getCurrentPosition-expected.txt: Added.
     14            * fast/dom/Geolocation/dataURL-getCurrentPosition.html: Added.
     15            * fast/dom/Geolocation/dataURL-watchPosition-expected.txt: Added.
     16            * fast/dom/Geolocation/dataURL-watchPosition.html: Added.
     17            * fast/dom/Geolocation/srcdoc-getCurrentPosition-expected.txt: Added.
     18            * fast/dom/Geolocation/srcdoc-getCurrentPosition.html: Added.
     19            * fast/dom/Geolocation/srcdoc-watchPosition-expected.txt: Added.
     20            * fast/dom/Geolocation/srcdoc-watchPosition.html: Added.
     21            * http/tests/security/resources/checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod.js: Added.
     22            (done):
     23            (logMessage):
     24            (didReceivePosition):
     25            (didReceiveError):
     26            (checkThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod):
     27            (markupToCheckThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod):
     28            (dataURLToCheckThatPositionErrorCallbackIsCalledWithPositionUnavailableForGeolocationMethod):
     29            * http/tests/security/resources/sandboxed-iframe-geolocation-getCurrentPosition.html: Added.
     30            * http/tests/security/resources/sandboxed-iframe-geolocation-watchPosition.html: Added.
     31            * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition-expected.txt: Added.
     32            * http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html: Added.
     33            * http/tests/security/sandboxed-iframe-geolocation-watchPosition-expected.txt: Added.
     34            * http/tests/security/sandboxed-iframe-geolocation-watchPosition.html: Added.
     35
    1362016-01-20  Babak Shafiei  <bshafiei@apple.com>
    237
  • branches/safari-601.1.46-branch/Source/WebCore/ChangeLog

    r195399 r195400  
     12016-01-20  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r195075.
     4
     5    2016-01-14  Daniel Bates  <dabates@apple.com>
     6
     7            Disallow use of Geolocation service from unique origins
     8            https://bugs.webkit.org/show_bug.cgi?id=153102
     9            <rdar://problem/23055645>
     10
     11            Reviewed by Alexey Proskuryakov.
     12
     13            Tests: fast/dom/Geolocation/dataURL-getCurrentPosition.html
     14                   fast/dom/Geolocation/dataURL-watchPosition.html
     15                   fast/dom/Geolocation/srcdoc-getCurrentPosition.html
     16                   fast/dom/Geolocation/srcdoc-watchPosition.html
     17                   http/tests/security/sandboxed-iframe-geolocation-getCurrentPosition.html
     18                   http/tests/security/sandboxed-iframe-geolocation-watchPosition.html
     19
     20            * Modules/geolocation/Geolocation.cpp:
     21            (WebCore::Geolocation::securityOrigin): Convenience function to get the SecurityOrigin object
     22            associated with this script execution context.
     23            (WebCore::Geolocation::startRequest): Notify requester POSITION_UNAVAILABLE when requested
     24            from a document with a unique origin.
     25            * Modules/geolocation/Geolocation.h:
     26            * page/SecurityOrigin.h:
     27            (WebCore::SecurityOrigin::canRequestGeolocation): Added.
     28
    1292016-01-20  Babak Shafiei  <bshafiei@apple.com>
    230
  • branches/safari-601.1.46-branch/Source/WebCore/Modules/geolocation/Geolocation.cpp

    r185101 r195400  
    4141#include "Page.h"
    4242#include "PositionError.h"
     43#include "SecurityOrigin.h"
    4344#include <wtf/CurrentTime.h>
    4445#include <wtf/Ref.h>
     
    4950static const char failedToStartServiceErrorMessage[] = "Failed to start Geolocation service";
    5051static const char framelessDocumentErrorMessage[] = "Geolocation cannot be used in frameless documents";
     52static const char originCannotRequestGeolocationErrorMessage[] = "Origin does not have permission to use Geolocation service";
    5153
    5254static PassRefPtr<Geoposition> createGeoposition(GeolocationPosition* position)
     
    151153{
    152154    return downcast<Document>(scriptExecutionContext());
     155}
     156
     157SecurityOrigin* Geolocation::securityOrigin() const
     158{
     159    return scriptExecutionContext()->securityOrigin();
    153160}
    154161
     
    337344void Geolocation::startRequest(GeoNotifier *notifier)
    338345{
     346    if (!securityOrigin()->canRequestGeolocation()) {
     347        notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, ASCIILiteral(originCannotRequestGeolocationErrorMessage)));
     348        return;
     349    }
     350
    339351    // Check whether permissions have already been denied. Note that if this is the case,
    340352    // the permission state can not change again in the lifetime of this page.
  • branches/safari-601.1.46-branch/Source/WebCore/Modules/geolocation/Geolocation.h

    r185860 r195400  
    4949class Page;
    5050class ScriptExecutionContext;
     51class SecurityOrigin;
    5152
    5253class Geolocation : public ScriptWrappable, public RefCounted<Geolocation>, public ActiveDOMObject
     
    8889
    8990    Page* page() const;
     91    SecurityOrigin* securityOrigin() const;
    9092
    9193    typedef Vector<RefPtr<GeoNotifier>> GeoNotifierVector;
  • branches/safari-601.1.46-branch/Source/WebCore/page/SecurityOrigin.h

    r185231 r195400  
    157157    bool canAccessApplicationCache(const SecurityOrigin* topOrigin) const { return canAccessStorage(topOrigin); }
    158158    bool canAccessCookies() const { return !isUnique(); }
     159    bool canRequestGeolocation() const { return !isUnique(); }
    159160    Policy canShowNotifications() const;
    160161
Note: See TracChangeset for help on using the changeset viewer.