Changeset 262026 in webkit


Ignore:
Timestamp:
May 21, 2020 1:40:03 PM (4 years ago)
Author:
youenn@apple.com
Message:

Incorrect location.origin in blob workers
https://bugs.webkit.org/show_bug.cgi?id=211876
<rdar://problem/63284717>

Reviewed by Sihui Liu.

Source/WebCore:

Instead of computing the origin from the location URL in worker, get it directly from the WorkerGlobalScope origin.
This ensures we unwrap properly blob URLs.

Test: http/tests/security/contentSecurityPolicy/worker-blob-location.html

  • workers/WorkerGlobalScope.cpp:

(WebCore::WorkerGlobalScope::location const):

  • workers/WorkerLocation.cpp:

(WebCore::WorkerLocation::origin const):

  • workers/WorkerLocation.h:

(WebCore::WorkerLocation::create):
(WebCore::WorkerLocation::url const):
(WebCore::WorkerLocation::WorkerLocation):

LayoutTests:

  • http/tests/security/contentSecurityPolicy/worker-blob-location-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/worker-blob-location.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r262025 r262026  
     12020-05-21  Youenn Fablet  <youenn@apple.com>
     2
     3        Incorrect location.origin in blob workers
     4        https://bugs.webkit.org/show_bug.cgi?id=211876
     5        <rdar://problem/63284717>
     6
     7        Reviewed by Sihui Liu.
     8
     9        * http/tests/security/contentSecurityPolicy/worker-blob-location-expected.txt: Added.
     10        * http/tests/security/contentSecurityPolicy/worker-blob-location.html: Added.
     11
    1122020-05-21  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r262024 r262026  
     12020-05-21  Youenn Fablet  <youenn@apple.com>
     2
     3        Incorrect location.origin in blob workers
     4        https://bugs.webkit.org/show_bug.cgi?id=211876
     5        <rdar://problem/63284717>
     6
     7        Reviewed by Sihui Liu.
     8
     9        Instead of computing the origin from the location URL in worker, get it directly from the WorkerGlobalScope origin.
     10        This ensures we unwrap properly blob URLs.
     11
     12        Test: http/tests/security/contentSecurityPolicy/worker-blob-location.html
     13
     14        * workers/WorkerGlobalScope.cpp:
     15        (WebCore::WorkerGlobalScope::location const):
     16        * workers/WorkerLocation.cpp:
     17        (WebCore::WorkerLocation::origin const):
     18        * workers/WorkerLocation.h:
     19        (WebCore::WorkerLocation::create):
     20        (WebCore::WorkerLocation::url const):
     21        (WebCore::WorkerLocation::WorkerLocation):
     22
    1232020-05-21  John Wilander  <wilander@apple.com>
    224
  • trunk/Source/WebCore/workers/WorkerGlobalScope.cpp

    r259298 r262026  
    240240{
    241241    if (!m_location)
    242         m_location = WorkerLocation::create(m_url);
     242        m_location = WorkerLocation::create(URL { m_url }, origin());
    243243    return *m_location;
    244244}
  • trunk/Source/WebCore/workers/WorkerLocation.cpp

    r260707 r262026  
    7676String WorkerLocation::origin() const
    7777{
    78     return SecurityOriginData::fromURL(m_url).toString();
     78    return m_origin;
    7979}
    8080
  • trunk/Source/WebCore/workers/WorkerLocation.h

    r238771 r262026  
    3434    class WorkerLocation : public RefCounted<WorkerLocation> {
    3535    public:
    36         static Ref<WorkerLocation> create(const URL& url)
    37         {
    38             return adoptRef(*new WorkerLocation(url));
    39         }
     36        static Ref<WorkerLocation> create(URL&& url, String&& origin) { return adoptRef(*new WorkerLocation(WTFMove(url), WTFMove(origin))); }
    4037
    4138        const URL& url() const { return m_url; }
    42 
    4339        String href() const;
    4440
     
    5450
    5551    private:
    56         explicit WorkerLocation(const URL& url) : m_url(url) { }
     52        WorkerLocation(URL&& url, String&& origin)
     53            : m_url(WTFMove(url))
     54            , m_origin(WTFMove(origin))
     55        {
     56        }
    5757
    5858        URL m_url;
     59        String m_origin;
    5960    };
    6061
Note: See TracChangeset for help on using the changeset viewer.