Changeset 51338 in webkit


Ignore:
Timestamp:
Nov 24, 2009 8:15:54 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-11-24 Adam Barth <abarth@webkit.org>

Reviewed by Dimitri Glazkov.

[Chromium] Fix DOM storage layout tests
https://bugs.webkit.org/show_bug.cgi?id=31833

The issue is, essentially, that this code assumes that
SecurityOrigin::createString can re-create a SecurityOrigin given
the string produced from SecurityOrigin::toString. This is a bogus
assumption in a number of corner cases (e.g., document.domain,
@sandbox). A recent patch (http://trac.webkit.org/changeset/51294)
make this assumption further invalid in the case of of file:// URLs.

The correct fix is for this code to use WebSecurityOrigin objects
(and not strings) to represent SecurityOrigin objects. However, the
expert on this code is on vacation, and I don't want to do major
surgery here without his involvement. This patch is a temporary fix
to get these tests passing again. We'll do the right fix once
jorlow gets back from vacation.

Tests: Covered by a number of existing DOM storage tests.

  • src/WebStorageNamespaceImpl.cpp: (WebKit::WebStorageNamespaceImpl::createStorageArea):
Location:
trunk/WebKit/chromium
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/chromium/ChangeLog

    r51335 r51338  
     12009-11-24  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [Chromium] Fix DOM storage layout tests
     6        https://bugs.webkit.org/show_bug.cgi?id=31833
     7
     8        The issue is, essentially, that this code assumes that
     9        SecurityOrigin::createString can re-create a SecurityOrigin given
     10        the string produced from SecurityOrigin::toString.  This is a bogus
     11        assumption in a number of corner cases (e.g., document.domain,
     12        @sandbox).  A recent patch (http://trac.webkit.org/changeset/51294)
     13        make this assumption further invalid in the case of of file:// URLs.
     14
     15        The correct fix is for this code to use WebSecurityOrigin objects
     16        (and not strings) to represent SecurityOrigin objects.  However, the
     17        expert on this code is on vacation, and I don't want to do major
     18        surgery here without his involvement.  This patch is a temporary fix
     19        to get these tests passing again.  We'll do the right fix once
     20        jorlow gets back from vacation.
     21
     22        Tests: Covered by a number of existing DOM storage tests.
     23
     24        * src/WebStorageNamespaceImpl.cpp:
     25        (WebKit::WebStorageNamespaceImpl::createStorageArea):
     26
    1272009-11-23  Jian Li  <jianli@chromium.org>
    228
  • trunk/WebKit/chromium/src/WebStorageNamespaceImpl.cpp

    r50723 r51338  
    6262WebStorageArea* WebStorageNamespaceImpl::createStorageArea(const WebString& originString)
    6363{
    64     RefPtr<WebCore::SecurityOrigin> origin = WebCore::SecurityOrigin::createFromString(originString);
     64    WebCore::String originWebCoreString = originString;
     65    if (originWebCoreString == "file://") {
     66        // FIXME: We should really be passing around WebSecurityOrigin objects
     67        //        to represent security origins instead of strings.  One issue
     68        //        with using strings is that createFromString(toString) does
     69        //        not round-trip for file URLs because file:// looks like a
     70        //        directory (which is sandboxed).
     71        //
     72        // For the time being, we work around this issue by using "file:///a",
     73        // which does not look like a directory.  We should fix this when
     74        // jorlow gets back from vactation.
     75        originWebCoreString = "file:///a";
     76    }
     77    RefPtr<WebCore::SecurityOrigin> origin = WebCore::SecurityOrigin::createFromString(originWebCoreString);
    6578    return new WebStorageAreaImpl(m_storageNamespace->storageArea(origin.release()));
    6679}
Note: See TracChangeset for help on using the changeset viewer.