Changeset 75455 in webkit


Ignore:
Timestamp:
Jan 10, 2011 5:02:01 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-01-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

Introduce the notion of a "display-isolated" URL scheme for use by
Chrome-internal URLs
https://bugs.webkit.org/show_bug.cgi?id=50182

This patch adds a Chromium API for registering schemes as
display-isolated. In a subsequent patch, I'll change the "chrome"
scheme in Chrome to be display isolated instead of local. That will
prevent file URLs from linking to chrome URLs.

  • public/WebSecurityPolicy.h:
  • src/WebSecurityPolicy.cpp: (WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated):

2011-01-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

Introduce the notion of a "display-isolated" URL scheme for use by
Chrome-internal URLs
https://bugs.webkit.org/show_bug.cgi?id=50182

Update to new function name.

  • Api/qwebsecurityorigin.cpp: (QWebSecurityOrigin::localSchemes):

2011-01-10 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

Introduce the notion of a "display-isolated" URL scheme for use by
Chrome-internal URLs
https://bugs.webkit.org/show_bug.cgi?id=50182

This patch adds the basic plumbing for display-isolated URL schemes.
Originally, this patch also had the functional change, but I've split
that off into a separate patch because the original patch caused a
performance regression.

  • page/SecurityOrigin.cpp: (WebCore::SecurityOrigin::canDisplay):
  • platform/SchemeRegistry.cpp: (WebCore::displayIsolatedURLSchemes): (WebCore::SchemeRegistry::registerURLSchemeAsLocal): (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal): (WebCore::SchemeRegistry::localSchemes): (WebCore::SchemeRegistry::deprecatedShouldTreatURLAsLocal): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal): (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated): (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
  • platform/SchemeRegistry.h:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r75450 r75455  
     12011-01-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Introduce the notion of a "display-isolated" URL scheme for use by
     6        Chrome-internal URLs
     7        https://bugs.webkit.org/show_bug.cgi?id=50182
     8
     9        This patch adds the basic plumbing for display-isolated URL schemes.
     10        Originally, this patch also had the functional change, but I've split
     11        that off into a separate patch because the original patch caused a
     12        performance regression.
     13
     14        * page/SecurityOrigin.cpp:
     15        (WebCore::SecurityOrigin::canDisplay):
     16        * platform/SchemeRegistry.cpp:
     17        (WebCore::displayIsolatedURLSchemes):
     18        (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
     19        (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
     20        (WebCore::SchemeRegistry::localSchemes):
     21        (WebCore::SchemeRegistry::deprecatedShouldTreatURLAsLocal):
     22        (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
     23        (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated):
     24        (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
     25        * platform/SchemeRegistry.h:
     26
    1272011-01-10  Jer Noble  <jer.noble@apple.com>
    228
  • trunk/Source/WebCore/page/SecurityOrigin.cpp

    r74597 r75455  
    304304{
    305305#if ENABLE(BLOB)
     306    // FIXME: We should generalize this check.
    306307    if (url.protocolIs(BlobURL::blobProtocol()))
    307308        return canRequest(url);
     
    311312        return true;
    312313
    313     if (!SchemeRegistry::shouldTreatURLAsLocal(url.string()))
     314    // FIXME: I suspect this check is incorrect because url has not necessarily
     315    //        been canonicalized.
     316    if (!SchemeRegistry::deprecatedShouldTreatURLAsLocal(url.string()))
    314317        return true;
    315318
  • trunk/Source/WebCore/platform/SchemeRegistry.cpp

    r73002 r75455  
    4646}
    4747
     48static URLSchemesMap& displayIsolatedURLSchemes()
     49{
     50    DEFINE_STATIC_LOCAL(URLSchemesMap, displayIsolatedSchemes, ());
     51    return displayIsolatedSchemes;
     52}
     53
    4854static URLSchemesMap& secureSchemes()
    4955{
     
    8389void SchemeRegistry::registerURLSchemeAsLocal(const String& scheme)
    8490{
    85     WebCore::localURLSchemes().add(scheme);
     91    localURLSchemes().add(scheme);
    8692}
    8793
     
    94100        return;
    95101#endif
    96     WebCore::localURLSchemes().remove(scheme);
     102    localURLSchemes().remove(scheme);
    97103}
    98104
    99 const URLSchemesMap& SchemeRegistry::localURLSchemes()
     105const URLSchemesMap& SchemeRegistry::localSchemes()
    100106{
    101     return WebCore::localURLSchemes();
     107    return localURLSchemes();
    102108}
    103109
    104 bool SchemeRegistry::shouldTreatURLAsLocal(const String& url)
     110bool SchemeRegistry::deprecatedShouldTreatURLAsLocal(const String& url)
    105111{
    106112    // This avoids an allocation of another String and the HashSet contains()
     
    119125
    120126    String scheme = url.left(loc);
    121     return WebCore::localURLSchemes().contains(scheme);
     127    return localURLSchemes().contains(scheme);
    122128}
    123129
     
    137143        return false;
    138144
    139     return WebCore::localURLSchemes().contains(scheme);
     145    return localURLSchemes().contains(scheme);
    140146}
    141147
     
    148154{
    149155    return schemesWithUniqueOrigins().contains(scheme);
     156}
     157
     158void SchemeRegistry::registerURLSchemeAsDisplayIsolated(const String& scheme)
     159{
     160    displayIsolatedURLSchemes().add(scheme);
     161}
     162
     163bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(const String& scheme)
     164{
     165    return displayIsolatedURLSchemes().contains(scheme);
    150166}
    151167
  • trunk/Source/WebCore/platform/SchemeRegistry.h

    r73002 r75455  
    3939    static void registerURLSchemeAsLocal(const String&);
    4040    static void removeURLSchemeRegisteredAsLocal(const String&);
    41     static const URLSchemesMap& localURLSchemes();
     41    static const URLSchemesMap& localSchemes();
    4242
    43     static bool shouldTreatURLAsLocal(const String&);
    4443    static bool shouldTreatURLSchemeAsLocal(const String&);
     44    static bool deprecatedShouldTreatURLAsLocal(const String&);
    4545
    4646    // Secure schemes do not trigger mixed content warnings. For example,
     
    5252    static void registerURLSchemeAsNoAccess(const String&);
    5353    static bool shouldTreatURLSchemeAsNoAccess(const String&);
    54    
     54
     55    // Display-isolated schemes can only be displayed (in the sense of
     56    // SecurityOrigin::canDisplay) by documents from the same scheme.
     57    static void registerURLSchemeAsDisplayIsolated(const String&);
     58    static bool shouldTreatURLSchemeAsDisplayIsolated(const String&);
     59
    5560    static void registerURLSchemeAsEmptyDocument(const String&);
    5661    static bool shouldLoadURLSchemeAsEmptyDocument(const String&);
  • trunk/WebKit/chromium/ChangeLog

    r75448 r75455  
     12011-01-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Introduce the notion of a "display-isolated" URL scheme for use by
     6        Chrome-internal URLs
     7        https://bugs.webkit.org/show_bug.cgi?id=50182
     8
     9        This patch adds a Chromium API for registering schemes as
     10        display-isolated.  In a subsequent patch, I'll change the "chrome"
     11        scheme in Chrome to be display isolated instead of local.  That will
     12        prevent file URLs from linking to chrome URLs.
     13
     14        * public/WebSecurityPolicy.h:
     15        * src/WebSecurityPolicy.cpp:
     16        (WebKit::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated):
     17
    1182011-01-10  John Abd-El-Malek  <jam@chromium.org>
    219
  • trunk/WebKit/chromium/public/WebSecurityPolicy.h

    r73002 r75455  
    4242public:
    4343    // Registers a URL scheme to be treated as a local scheme (i.e., with the
    44     // same security rules as those applied to "file" URLs).  This means that
     44    // same security rules as those applied to "file" URLs). This means that
    4545    // normal pages cannot link to or access URLs of this scheme.
    4646    WEBKIT_API static void registerURLSchemeAsLocal(const WebString&);
    4747
    48     // Registers a URL scheme to be treated as a noAccess scheme.  This means
     48    // Registers a URL scheme to be treated as a noAccess scheme. This means
    4949    // that pages loaded with this URL scheme cannot access pages loaded with
    5050    // any other URL scheme.
    5151    WEBKIT_API static void registerURLSchemeAsNoAccess(const WebString&);
     52
     53    // Registers a URL scheme to be treated as display-isolated. This means
     54    // that pages cannot display these URLs unless they are from the same
     55    // scheme. For example, pages in other origin cannot create iframes or
     56    // hyperlinks to URLs with the scheme.
     57    WEBKIT_API static void registerURLSchemeAsDisplayIsolated(const WebString&);
    5258
    5359    // Registers a URL scheme to not generate mixed content warnings when
     
    6369        const WebString& destinationHost, bool allowDestinationSubdomains);
    6470    WEBKIT_API static void resetOriginAccessWhitelists();
    65    
     71
    6672    // Returns whether the url should be allowed to see the referrer
    6773    // based on their respective protocols.
  • trunk/WebKit/chromium/src/WebSecurityPolicy.cpp

    r73002 r75455  
    5353}
    5454
     55void WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(const WebString& scheme)
     56{
     57    SchemeRegistry::registerURLSchemeAsDisplayIsolated(scheme);
     58}
     59
    5560void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme)
    5661{
  • trunk/WebKit/qt/Api/qwebsecurityorigin.cpp

    r73789 r75455  
    260260{
    261261    QStringList list;
    262     const URLSchemesMap& map = SchemeRegistry::localURLSchemes();
     262    const URLSchemesMap& map = SchemeRegistry::localSchemes();
    263263    URLSchemesMap::const_iterator end = map.end();
    264264    for (URLSchemesMap::const_iterator i = map.begin(); i != end; ++i) {
  • trunk/WebKit/qt/ChangeLog

    r75411 r75455  
     12011-01-10  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Introduce the notion of a "display-isolated" URL scheme for use by
     6        Chrome-internal URLs
     7        https://bugs.webkit.org/show_bug.cgi?id=50182
     8
     9        Update to new function name.
     10
     11        * Api/qwebsecurityorigin.cpp:
     12        (QWebSecurityOrigin::localSchemes):
     13
    1142011-01-10  Benjamin Poulain  <benjamin.poulain@nokia.com>
    215
Note: See TracChangeset for help on using the changeset viewer.