Changeset 239659 in webkit


Ignore:
Timestamp:
Jan 5, 2019 12:51:14 PM (5 years ago)
Author:
youenn@apple.com
Message:

Service Worker fetch should obey its referrer policy
https://bugs.webkit.org/show_bug.cgi?id=193152

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

  • web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt:
  • web-platform-tests/service-workers/service-worker/referrer-policy-header.https-expected.txt:

Source/WebCore:

Pass referrer policy retrieved when fetching the service worker script to the SWServer.
The SWServer then stores it persistently and sends it to the manager creating service workers.
This manager will then set the referrer policy on the dummy Document of the corresponding service worker.

Covered by rebased test.

  • workers/WorkerScriptLoader.cpp:

(WebCore::WorkerScriptLoader::didReceiveResponse):

  • workers/WorkerScriptLoader.h:

(WebCore::WorkerScriptLoader::referrerPolicy const):

  • workers/service/SWClientConnection.cpp:

(WebCore::SWClientConnection::failedFetchingScript):

  • workers/service/ServiceWorkerContainer.cpp:

(WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):

  • workers/service/ServiceWorkerContainer.h:
  • workers/service/ServiceWorkerContextData.cpp:

(WebCore::ServiceWorkerContextData::isolatedCopy const):

  • workers/service/ServiceWorkerContextData.h:

(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):

  • workers/service/ServiceWorkerFetchResult.h:

(WebCore::ServiceWorkerFetchResult::encode const):
(WebCore::ServiceWorkerFetchResult::decode):

  • workers/service/ServiceWorkerJob.cpp:

(WebCore::ServiceWorkerJob::notifyFinished):

  • workers/service/ServiceWorkerJobClient.h:
  • workers/service/context/ServiceWorkerThreadProxy.cpp:

(WebCore::createPageForServiceWorker):

  • workers/service/server/RegistrationDatabase.cpp:

(WebCore::recordsTableSchema):
(WebCore::RegistrationDatabase::doPushChanges):
(WebCore::RegistrationDatabase::importRecords):

  • workers/service/server/SWServer.cpp:

(WebCore::SWServer::addRegistrationFromStore):
(WebCore::SWServer::updateWorker):
(WebCore::SWServer::installContextData):

  • workers/service/server/SWServer.h:
  • workers/service/server/SWServerJobQueue.cpp:

(WebCore::SWServerJobQueue::scriptFetchFinished):

  • workers/service/server/SWServerWorker.cpp:

(WebCore::SWServerWorker::SWServerWorker):
(WebCore::SWServerWorker::contextData const):

  • workers/service/server/SWServerWorker.h:
Location:
trunk
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r239644 r239659  
     12019-01-05  Youenn Fablet  <youenn@apple.com>
     2
     3        Service Worker fetch should obey its referrer policy
     4        https://bugs.webkit.org/show_bug.cgi?id=193152
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt:
     9        * web-platform-tests/service-workers/service-worker/referrer-policy-header.https-expected.txt:
     10
    1112019-01-04  Youenn Fablet  <youenn@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/policies/referrer-origin-service-worker.https-expected.txt

    r235025 r239659  
    11
    22PASS Fetch in service worker: referrer with no-referrer policy
    3 FAIL Request's referrer is origin assert_equals: request's referrer is https://localhost:9443/ expected "https://localhost:9443/" but got "https://localhost:9443/fetch/api/policies/referrer-origin.js?pipe=sub"
    4 FAIL Cross-origin referrer is overridden by client origin assert_equals: request's referrer is https://localhost:9443/ expected "https://localhost:9443/" but got "https://localhost:9443/fetch/api/policies/referrer-origin.js?pipe=sub"
     3PASS Request's referrer is origin
     4PASS Cross-origin referrer is overridden by client origin
    55
  • trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/referrer-policy-header.https-expected.txt

    r238592 r239659  
    33PASS Initialize global state (service worker registration)
    44FAIL Referrer for a main resource redirected with referrer-policy (origin) should only have origin. assert_equals: expected "https://localhost:9443/" but got "https://localhost:9443/service-workers/service-worker/referrer-policy-header.https.html"
    5 FAIL Referrer for fetch requests initiated from a service worker with referrer-policy (origin) should only have origin. assert_equals: expected "finish" but got "failure:Referer for request-headers.py?url=request-headers.py must be https://localhost:9443/ but got https://localhost:9443/service-workers/service-worker/resources/fetch-rewrite-worker-referrer-policy.js"
     5PASS Referrer for fetch requests initiated from a service worker with referrer-policy (origin) should only have origin.
    66PASS Remove registration as a cleanup
    77
  • trunk/Source/WebCore/ChangeLog

    r239658 r239659  
     12019-01-05  Youenn Fablet  <youenn@apple.com>
     2
     3        Service Worker fetch should obey its referrer policy
     4        https://bugs.webkit.org/show_bug.cgi?id=193152
     5
     6        Reviewed by Chris Dumez.
     7
     8        Pass referrer policy retrieved when fetching the service worker script to the SWServer.
     9        The SWServer then stores it persistently and sends it to the manager creating service workers.
     10        This manager will then set the referrer policy on the dummy Document of the corresponding service worker.
     11
     12        Covered by rebased test.
     13
     14        * workers/WorkerScriptLoader.cpp:
     15        (WebCore::WorkerScriptLoader::didReceiveResponse):
     16        * workers/WorkerScriptLoader.h:
     17        (WebCore::WorkerScriptLoader::referrerPolicy const):
     18        * workers/service/SWClientConnection.cpp:
     19        (WebCore::SWClientConnection::failedFetchingScript):
     20        * workers/service/ServiceWorkerContainer.cpp:
     21        (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
     22        * workers/service/ServiceWorkerContainer.h:
     23        * workers/service/ServiceWorkerContextData.cpp:
     24        (WebCore::ServiceWorkerContextData::isolatedCopy const):
     25        * workers/service/ServiceWorkerContextData.h:
     26        (WebCore::ServiceWorkerContextData::encode const):
     27        (WebCore::ServiceWorkerContextData::decode):
     28        * workers/service/ServiceWorkerFetchResult.h:
     29        (WebCore::ServiceWorkerFetchResult::encode const):
     30        (WebCore::ServiceWorkerFetchResult::decode):
     31        * workers/service/ServiceWorkerJob.cpp:
     32        (WebCore::ServiceWorkerJob::notifyFinished):
     33        * workers/service/ServiceWorkerJobClient.h:
     34        * workers/service/context/ServiceWorkerThreadProxy.cpp:
     35        (WebCore::createPageForServiceWorker):
     36        * workers/service/server/RegistrationDatabase.cpp:
     37        (WebCore::recordsTableSchema):
     38        (WebCore::RegistrationDatabase::doPushChanges):
     39        (WebCore::RegistrationDatabase::importRecords):
     40        * workers/service/server/SWServer.cpp:
     41        (WebCore::SWServer::addRegistrationFromStore):
     42        (WebCore::SWServer::updateWorker):
     43        (WebCore::SWServer::installContextData):
     44        * workers/service/server/SWServer.h:
     45        * workers/service/server/SWServerJobQueue.cpp:
     46        (WebCore::SWServerJobQueue::scriptFetchFinished):
     47        * workers/service/server/SWServerWorker.cpp:
     48        (WebCore::SWServerWorker::SWServerWorker):
     49        (WebCore::SWServerWorker::contextData const):
     50        * workers/service/server/SWServerWorker.h:
     51
    1522019-01-04  Simon Fraser  <simon.fraser@apple.com>
    253
  • trunk/Source/WebCore/workers/WorkerScriptLoader.cpp

    r239427 r239659  
    178178    m_responseEncoding = response.textEncodingName();
    179179    m_contentSecurityPolicy = ContentSecurityPolicyResponseHeaders { response };
     180    m_referrerPolicy = response.httpHeaderField(HTTPHeaderName::ReferrerPolicy);
    180181    if (m_client)
    181182        m_client->didReceiveResponse(identifier, response);
  • trunk/Source/WebCore/workers/WorkerScriptLoader.h

    r239427 r239659  
    6262    String script();
    6363    const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy() const { return m_contentSecurityPolicy; }
     64    const String& referrerPolicy() const { return m_referrerPolicy; }
    6465    const URL& url() const { return m_url; }
    6566    const URL& responseURL() const;
     
    9596    FetchOptions::Destination m_destination;
    9697    ContentSecurityPolicyResponseHeaders m_contentSecurityPolicy;
     98    String m_referrerPolicy;
    9799    unsigned long m_identifier { 0 };
    98100    bool m_failed { false };
  • trunk/Source/WebCore/workers/service/SWClientConnection.cpp

    r239427 r239659  
    6060    ASSERT(isMainThread());
    6161
    62     finishFetchingScriptInServer({ { serverConnectionIdentifier(), jobIdentifier }, registrationKey, { }, { }, error });
     62    finishFetchingScriptInServer({ { serverConnectionIdentifier(), jobIdentifier }, registrationKey, { }, { }, { },  error });
    6363}
    6464
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp

    r239427 r239659  
    520520}
    521521
    522 void ServiceWorkerContainer::jobFinishedLoadingScript(ServiceWorkerJob& job, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy)
     522void ServiceWorkerContainer::jobFinishedLoadingScript(ServiceWorkerJob& job, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, const String& referrerPolicy)
    523523{
    524524#ifndef NDEBUG
     
    528528    CONTAINER_RELEASE_LOG_IF_ALLOWED("jobFinishedLoadingScript: Successfuly finished fetching script for job %" PRIu64, job.identifier().toUInt64());
    529529
    530     callOnMainThread([connection = m_swConnection, jobDataIdentifier = job.data().identifier(), registrationKey = job.data().registrationKey().isolatedCopy(), script = script.isolatedCopy(), contentSecurityPolicy = contentSecurityPolicy.isolatedCopy()] {
    531         connection->finishFetchingScriptInServer({ jobDataIdentifier, registrationKey, script, contentSecurityPolicy, { } });
     530    callOnMainThread([connection = m_swConnection, jobDataIdentifier = job.data().identifier(), registrationKey = job.data().registrationKey().isolatedCopy(), script = script.isolatedCopy(), contentSecurityPolicy = contentSecurityPolicy.isolatedCopy(), referrerPolicy = referrerPolicy.isolatedCopy()] {
     531        connection->finishFetchingScriptInServer({ jobDataIdentifier, registrationKey, script, contentSecurityPolicy, referrerPolicy, { } });
    532532    });
    533533}
  • trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h

    r239427 r239659  
    9696    void jobResolvedWithUnregistrationResult(ServiceWorkerJob&, bool unregistrationResult) final;
    9797    void startScriptFetchForJob(ServiceWorkerJob&, FetchOptions::Cache) final;
    98     void jobFinishedLoadingScript(ServiceWorkerJob&, const String& script, const ContentSecurityPolicyResponseHeaders&) final;
     98    void jobFinishedLoadingScript(ServiceWorkerJob&, const String& script, const ContentSecurityPolicyResponseHeaders&, const String& referrerPolicy) final;
    9999    void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&, Optional<Exception>&&) final;
    100100
  • trunk/Source/WebCore/workers/service/ServiceWorkerContextData.cpp

    r232516 r239659  
    3434ServiceWorkerContextData ServiceWorkerContextData::isolatedCopy() const
    3535{
    36     return { jobDataIdentifier, registration.isolatedCopy(), serviceWorkerIdentifier, script.isolatedCopy(), contentSecurityPolicy.isolatedCopy(), scriptURL.isolatedCopy(), workerType, sessionID, loadedFromDisk, crossThreadCopy(scriptResourceMap) };
     36    return { jobDataIdentifier, registration.isolatedCopy(), serviceWorkerIdentifier, script.isolatedCopy(), contentSecurityPolicy.isolatedCopy(), referrerPolicy.isolatedCopy(), scriptURL.isolatedCopy(), workerType, sessionID, loadedFromDisk, crossThreadCopy(scriptResourceMap) };
    3737}
    3838
  • trunk/Source/WebCore/workers/service/ServiceWorkerContextData.h

    r239427 r239659  
    7676    String script;
    7777    ContentSecurityPolicyResponseHeaders contentSecurityPolicy;
     78    String referrerPolicy;
    7879    URL scriptURL;
    7980    WorkerType workerType;
     
    9192void ServiceWorkerContextData::encode(Encoder& encoder) const
    9293{
    93     encoder << jobDataIdentifier << registration << serviceWorkerIdentifier << script << contentSecurityPolicy << scriptURL << workerType << sessionID << loadedFromDisk;
     94    encoder << jobDataIdentifier << registration << serviceWorkerIdentifier << script << contentSecurityPolicy << referrerPolicy << scriptURL << workerType << sessionID << loadedFromDisk;
    9495    encoder << scriptResourceMap;
    9596}
     
    120121        return WTF::nullopt;
    121122
     123    String referrerPolicy;
     124    if (!decoder.decode(referrerPolicy))
     125        return WTF::nullopt;
     126
    122127    URL scriptURL;
    123128    if (!decoder.decode(scriptURL))
     
    140145        return WTF::nullopt;
    141146
    142     return {{ WTFMove(*jobDataIdentifier), WTFMove(*registration), WTFMove(*serviceWorkerIdentifier), WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(scriptURL), workerType, sessionID, loadedFromDisk, WTFMove(scriptResourceMap) }};
     147    return {{ WTFMove(*jobDataIdentifier), WTFMove(*registration), WTFMove(*serviceWorkerIdentifier), WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(referrerPolicy), WTFMove(scriptURL), workerType, sessionID, loadedFromDisk, WTFMove(scriptResourceMap) }};
    143148}
    144149
  • trunk/Source/WebCore/workers/service/ServiceWorkerFetchResult.h

    r239427 r239659  
    4040    String script;
    4141    ContentSecurityPolicyResponseHeaders contentSecurityPolicy;
     42    String referrerPolicy;
    4243    ResourceError scriptError;
    4344
     
    4950void ServiceWorkerFetchResult::encode(Encoder& encoder) const
    5051{
    51     encoder << jobDataIdentifier << registrationKey << script << contentSecurityPolicy << scriptError;
     52    encoder << jobDataIdentifier << registrationKey << script << contentSecurityPolicy << referrerPolicy << scriptError;
    5253}
    5354
     
    7071    if (!decoder.decode(result.contentSecurityPolicy))
    7172        return false;
     73    if (!decoder.decode(result.referrerPolicy))
     74        return false;
    7275    if (!decoder.decode(result.scriptError))
    7376        return false;
  • trunk/Source/WebCore/workers/service/ServiceWorkerJob.cpp

    r239427 r239659  
    147147   
    148148    if (!m_scriptLoader->failed())
    149         m_client->jobFinishedLoadingScript(*this, m_scriptLoader->script(), m_scriptLoader->contentSecurityPolicy());
     149        m_client->jobFinishedLoadingScript(*this, m_scriptLoader->script(), m_scriptLoader->contentSecurityPolicy(), m_scriptLoader->referrerPolicy());
    150150    else {
    151151        auto& error =  m_scriptLoader->error();
  • trunk/Source/WebCore/workers/service/ServiceWorkerJobClient.h

    r239427 r239659  
    5050    virtual void jobResolvedWithUnregistrationResult(ServiceWorkerJob&, bool unregistrationResult) = 0;
    5151    virtual void startScriptFetchForJob(ServiceWorkerJob&, FetchOptions::Cache) = 0;
    52     virtual void jobFinishedLoadingScript(ServiceWorkerJob&, const String& script, const ContentSecurityPolicyResponseHeaders&) = 0;
     52    virtual void jobFinishedLoadingScript(ServiceWorkerJob&, const String& script, const ContentSecurityPolicyResponseHeaders&, const String& referrerPolicy) = 0;
    5353    virtual void jobFailedLoadingScript(ServiceWorkerJob&, const ResourceError&, Optional<Exception>&&) = 0;
    5454
  • trunk/Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp

    r239427 r239659  
    7070    document->setFirstPartyForCookies(data.scriptURL);
    7171    document->setDomainForCachePartition(origin->domainForCachePartition());
     72
     73    if (auto policy = parseReferrerPolicy(data.referrerPolicy, ReferrerPolicySource::HTTPHeader))
     74        document->setReferrerPolicy(*policy);
     75
    7276    mainFrame.setDocument(WTFMove(document));
    7377    return page;
  • trunk/Source/WebCore/workers/service/server/RegistrationDatabase.cpp

    r239427 r239659  
    4949namespace WebCore {
    5050
    51 static const uint64_t schemaVersion = 3;
     51static const uint64_t schemaVersion = 4;
    5252
    5353static const String recordsTableSchema(const String& tableName)
    5454{
    55     return makeString("CREATE TABLE ", tableName, " (key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, origin TEXT NOT NULL ON CONFLICT FAIL, scopeURL TEXT NOT NULL ON CONFLICT FAIL, topOrigin TEXT NOT NULL ON CONFLICT FAIL, lastUpdateCheckTime DOUBLE NOT NULL ON CONFLICT FAIL, updateViaCache TEXT NOT NULL ON CONFLICT FAIL, scriptURL TEXT NOT NULL ON CONFLICT FAIL, script TEXT NOT NULL ON CONFLICT FAIL, workerType TEXT NOT NULL ON CONFLICT FAIL, contentSecurityPolicy BLOB NOT NULL ON CONFLICT FAIL, scriptResourceMap BLOB NOT NULL ON CONFLICT FAIL)");
     55    return makeString("CREATE TABLE ", tableName, " (key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, origin TEXT NOT NULL ON CONFLICT FAIL, scopeURL TEXT NOT NULL ON CONFLICT FAIL, topOrigin TEXT NOT NULL ON CONFLICT FAIL, lastUpdateCheckTime DOUBLE NOT NULL ON CONFLICT FAIL, updateViaCache TEXT NOT NULL ON CONFLICT FAIL, scriptURL TEXT NOT NULL ON CONFLICT FAIL, script TEXT NOT NULL ON CONFLICT FAIL, workerType TEXT NOT NULL ON CONFLICT FAIL, contentSecurityPolicy BLOB NOT NULL ON CONFLICT FAIL, referrerPolicy TEXT NOT NULL ON CONFLICT FAIL, scriptResourceMap BLOB NOT NULL ON CONFLICT FAIL)");
    5656}
    5757
     
    306306    transaction.begin();
    307307
    308     SQLiteStatement sql(*m_database, "INSERT INTO Records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"_s);
     308    SQLiteStatement sql(*m_database, "INSERT INTO Records VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"_s);
    309309    if (sql.prepare() != SQLITE_OK) {
    310310        RELEASE_LOG_ERROR(ServiceWorker, "Failed to prepare statement to store registration data into records table (%i) - %s", m_database->lastError(), m_database->lastErrorMsg());
     
    341341            || sql.bindText(9, workerTypeToString(data.workerType)) != SQLITE_OK
    342342            || sql.bindBlob(10, cspEncoder.buffer(), cspEncoder.bufferSize()) != SQLITE_OK
    343             || sql.bindBlob(11, scriptResourceMapEncoder.buffer(), scriptResourceMapEncoder.bufferSize()) != SQLITE_OK
     343            || sql.bindText(11, data.referrerPolicy) != SQLITE_OK
     344            || sql.bindBlob(12, scriptResourceMapEncoder.buffer(), scriptResourceMapEncoder.bufferSize()) != SQLITE_OK
    344345            || sql.step() != SQLITE_DONE) {
    345346            RELEASE_LOG_ERROR(ServiceWorker, "Failed to store registration data into records table (%i) - %s", m_database->lastError(), m_database->lastErrorMsg());
     
    381382            continue;
    382383
     384        auto referrerPolicy = sql.getColumnText(10);
     385
    383386        Vector<uint8_t> scriptResourceMapData;
    384         sql.getColumnBlobAsVector(10, scriptResourceMapData);
     387        sql.getColumnBlobAsVector(11, scriptResourceMapData);
    385388        HashMap<URL, ServiceWorkerContextData::ImportedScript> scriptResourceMap;
    386389
     
    401404        auto serviceWorkerData = ServiceWorkerData { workerIdentifier, scriptURL, ServiceWorkerState::Activated, *workerType, registrationIdentifier };
    402405        auto registration = ServiceWorkerRegistrationData { WTFMove(*key), registrationIdentifier, URL(originURL, scopePath), *updateViaCache, lastUpdateCheckTime, WTF::nullopt, WTF::nullopt, WTFMove(serviceWorkerData) };
    403         auto contextData = ServiceWorkerContextData { WTF::nullopt, WTFMove(registration), workerIdentifier, WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(scriptURL), *workerType, m_sessionID, true, WTFMove(scriptResourceMap) };
     406        auto contextData = ServiceWorkerContextData { WTF::nullopt, WTFMove(registration), workerIdentifier, WTFMove(script), WTFMove(contentSecurityPolicy), WTFMove(referrerPolicy), WTFMove(scriptURL), *workerType, m_sessionID, true, WTFMove(scriptResourceMap) };
    404407
    405408        callOnMainThread([protectedThis = makeRef(*this), contextData = contextData.isolatedCopy()]() mutable {
  • trunk/Source/WebCore/workers/service/server/SWServer.cpp

    r239534 r239659  
    141141    addRegistration(WTFMove(registration));
    142142
    143     auto worker = SWServerWorker::create(*this, *registrationPtr, data.scriptURL, data.script, data.contentSecurityPolicy, data.workerType, data.serviceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript> { data.scriptResourceMap });
     143    auto worker = SWServerWorker::create(*this, *registrationPtr, data.scriptURL, data.script, data.contentSecurityPolicy, WTFMove(data.referrerPolicy), data.workerType, data.serviceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript> { data.scriptResourceMap });
    144144    registrationPtr->updateRegistrationState(ServiceWorkerRegistrationState::Active, worker.ptr());
    145145    worker->setState(ServiceWorkerState::Activated);
     
    503503}
    504504
    505 void SWServer::updateWorker(Connection&, const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerRegistration& registration, const URL& url, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, WorkerType type, HashMap<URL, ServiceWorkerContextData::ImportedScript>&& scriptResourceMap)
    506 {
    507     tryInstallContextData({ jobDataIdentifier, registration.data(), generateObjectIdentifier<ServiceWorkerIdentifierType>(), script, contentSecurityPolicy, url, type, sessionID(), false, WTFMove(scriptResourceMap) });
     505void SWServer::updateWorker(Connection&, const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerRegistration& registration, const URL& url, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, const String& referrerPolicy, WorkerType type, HashMap<URL, ServiceWorkerContextData::ImportedScript>&& scriptResourceMap)
     506{
     507    tryInstallContextData({ jobDataIdentifier, registration.data(), generateObjectIdentifier<ServiceWorkerIdentifierType>(), script, contentSecurityPolicy, referrerPolicy, url, type, sessionID(), false, WTFMove(scriptResourceMap) });
    508508}
    509509
     
    550550    RELEASE_ASSERT(registration);
    551551
    552     auto worker = SWServerWorker::create(*this, *registration, data.scriptURL, data.script, data.contentSecurityPolicy, data.workerType, data.serviceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript> { data.scriptResourceMap });
     552    auto worker = SWServerWorker::create(*this, *registration, data.scriptURL, data.script, data.contentSecurityPolicy, String { data.referrerPolicy }, data.workerType, data.serviceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript> { data.scriptResourceMap });
    553553
    554554    auto* connection = worker->contextConnection();
  • trunk/Source/WebCore/workers/service/server/SWServer.h

    r239534 r239659  
    134134    void startScriptFetch(const ServiceWorkerJobData&, FetchOptions::Cache);
    135135
    136     void updateWorker(Connection&, const ServiceWorkerJobDataIdentifier&, SWServerRegistration&, const URL&, const String& script, const ContentSecurityPolicyResponseHeaders&, WorkerType, HashMap<URL, ServiceWorkerContextData::ImportedScript>&&);
     136    void updateWorker(Connection&, const ServiceWorkerJobDataIdentifier&, SWServerRegistration&, const URL&, const String& script, const ContentSecurityPolicyResponseHeaders&, const String& referrerPolicy, WorkerType, HashMap<URL, ServiceWorkerContextData::ImportedScript>&&);
    137137    void terminateWorker(SWServerWorker&);
    138138    void syncTerminateWorker(SWServerWorker&);
  • trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp

    r233122 r239659  
    101101
    102102    // FIXME: Support the proper worker type (classic vs module)
    103     m_server.updateWorker(connection, job.identifier(), *registration, job.scriptURL, result.script, result.contentSecurityPolicy, WorkerType::Classic, { });
     103    m_server.updateWorker(connection, job.identifier(), *registration, job.scriptURL, result.script, result.contentSecurityPolicy, result.referrerPolicy, WorkerType::Classic, { });
    104104}
    105105
  • trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp

    r239534 r239659  
    4646
    4747// FIXME: Use r-value references for script and contentSecurityPolicy
    48 SWServerWorker::SWServerWorker(SWServer& server, SWServerRegistration& registration, const URL& scriptURL, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, WorkerType type, ServiceWorkerIdentifier identifier, HashMap<URL, ServiceWorkerContextData::ImportedScript>&& scriptResourceMap)
     48SWServerWorker::SWServerWorker(SWServer& server, SWServerRegistration& registration, const URL& scriptURL, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, String&& referrerPolicy, WorkerType type, ServiceWorkerIdentifier identifier, HashMap<URL, ServiceWorkerContextData::ImportedScript>&& scriptResourceMap)
    4949    : m_server(server)
    5050    , m_registrationKey(registration.key())
     
    5252    , m_script(script)
    5353    , m_contentSecurityPolicy(contentSecurityPolicy)
     54    , m_referrerPolicy(WTFMove(referrerPolicy))
    5455    , m_scriptResourceMap(WTFMove(scriptResourceMap))
    5556{
     
    7576    ASSERT(registration);
    7677
    77     return { WTF::nullopt, registration->data(), m_data.identifier, m_script, m_contentSecurityPolicy, m_data.scriptURL, m_data.type, m_server.sessionID(), false, m_scriptResourceMap };
     78    return { WTF::nullopt, registration->data(), m_data.identifier, m_script, m_contentSecurityPolicy, m_referrerPolicy, m_data.scriptURL, m_data.type, m_server.sessionID(), false, m_scriptResourceMap };
    7879}
    7980
  • trunk/Source/WebCore/workers/service/server/SWServerWorker.h

    r239534 r239659  
    113113
    114114private:
    115     SWServerWorker(SWServer&, SWServerRegistration&, const URL&, const String& script, const ContentSecurityPolicyResponseHeaders&, WorkerType, ServiceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript>&&);
     115    SWServerWorker(SWServer&, SWServerRegistration&, const URL&, const String& script, const ContentSecurityPolicyResponseHeaders&, String&& referrerPolicy, WorkerType, ServiceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript>&&);
    116116
    117117    void callWhenActivatedHandler(bool success);
     
    122122    String m_script;
    123123    ContentSecurityPolicyResponseHeaders m_contentSecurityPolicy;
     124    String m_referrerPolicy;
    124125    bool m_hasPendingEvents { false };
    125126    State m_state { State::NotRunning };
Note: See TracChangeset for help on using the changeset viewer.