mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1229795 - P1. Remove scriptSpec from registration data. r=baku, bkelly
This commit is contained in:
parent
288ccaaaf4
commit
1d3ddbb93d
@ -328,8 +328,6 @@ PopulateRegistrationData(nsIPrincipal* aPrincipal,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aData.scriptSpec() = newest->ScriptSpec();
|
||||
|
||||
if (aRegistration->mActiveWorker) {
|
||||
aData.currentWorkerURL() = aRegistration->mActiveWorker->ScriptSpec();
|
||||
aData.activeCacheName() = aRegistration->mActiveWorker->CacheName();
|
||||
@ -2919,11 +2917,10 @@ ServiceWorkerManager::LoadRegistration(
|
||||
if (!registration) {
|
||||
registration = CreateNewRegistration(aRegistration.scope(), principal);
|
||||
} else {
|
||||
RefPtr<ServiceWorkerInfo> newest = registration->Newest();
|
||||
// If the script spec matches and our active worker state matches our
|
||||
// expectations for a "current worker", then we are done.
|
||||
if (newest && newest->ScriptSpec() == aRegistration.scriptSpec() &&
|
||||
!registration->mActiveWorker == aRegistration.currentWorkerURL().IsEmpty()) {
|
||||
// If active worker script matches our expectations for a "current worker",
|
||||
// then we are done.
|
||||
if (registration->mActiveWorker &&
|
||||
registration->mActiveWorker->ScriptSpec() == aRegistration.currentWorkerURL()) {
|
||||
// No needs for updates.
|
||||
return;
|
||||
}
|
||||
|
@ -181,7 +181,6 @@ ServiceWorkerManagerParent::RecvRegister(
|
||||
|
||||
// Basic validation.
|
||||
if (aData.scope().IsEmpty() ||
|
||||
aData.scriptSpec().IsEmpty() ||
|
||||
aData.principal().type() == PrincipalInfo::TNullPrincipalInfo ||
|
||||
aData.principal().type() == PrincipalInfo::TSystemPrincipalInfo) {
|
||||
return false;
|
||||
|
@ -336,7 +336,6 @@ ServiceWorkerRegistrar::ReadData()
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, line);
|
||||
|
||||
GET_LINE(entry->scope());
|
||||
GET_LINE(entry->scriptSpec());
|
||||
GET_LINE(entry->currentWorkerURL());
|
||||
|
||||
nsAutoCString cacheName;
|
||||
@ -561,9 +560,6 @@ ServiceWorkerRegistrar::WriteData()
|
||||
buffer.Append(data[i].scope());
|
||||
buffer.Append('\n');
|
||||
|
||||
buffer.Append(data[i].scriptSpec());
|
||||
buffer.Append('\n');
|
||||
|
||||
buffer.Append(data[i].currentWorkerURL());
|
||||
buffer.Append('\n');
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "nsTArray.h"
|
||||
|
||||
#define SERVICEWORKERREGISTRAR_FILE "serviceworker.txt"
|
||||
#define SERVICEWORKERREGISTRAR_VERSION "2"
|
||||
#define SERVICEWORKERREGISTRAR_VERSION "3"
|
||||
#define SERVICEWORKERREGISTRAR_TERMINATOR "#"
|
||||
#define SERVICEWORKERREGISTRAR_TRUE "true"
|
||||
#define SERVICEWORKERREGISTRAR_FALSE "false"
|
||||
|
@ -12,7 +12,6 @@ namespace dom {
|
||||
struct ServiceWorkerRegistrationData
|
||||
{
|
||||
nsCString scope;
|
||||
nsCString scriptSpec;
|
||||
nsCString currentWorkerURL;
|
||||
|
||||
nsString activeCacheName;
|
||||
|
@ -142,11 +142,11 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
||||
nsAutoCString buffer(SERVICEWORKERREGISTRAR_VERSION "\n");
|
||||
|
||||
buffer.Append("^appId=123&inBrowser=1\n");
|
||||
buffer.Append("spec 0\nscope 0\nscriptSpec 0\ncurrentWorkerURL 0\nactiveCache 0\nwaitingCache 0\n");
|
||||
buffer.Append("spec 0\nscope 0\ncurrentWorkerURL 0\nactiveCache 0\nwaitingCache 0\n");
|
||||
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
|
||||
|
||||
buffer.Append("\n");
|
||||
buffer.Append("spec 1\nscope 1\nscriptSpec 1\ncurrentWorkerURL 1\nactiveCache 1\nwaitingCache 1\n");
|
||||
buffer.Append("spec 1\nscope 1\ncurrentWorkerURL 1\nactiveCache 1\nwaitingCache 1\n");
|
||||
buffer.Append(SERVICEWORKERREGISTRAR_TERMINATOR "\n");
|
||||
|
||||
ASSERT_TRUE(CreateFile(buffer)) << "CreateFile should not fail";
|
||||
@ -169,7 +169,6 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
||||
ASSERT_STREQ("^appId=123&inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("spec 0", cInfo0.spec().get());
|
||||
ASSERT_STREQ("scope 0", data[0].scope().get());
|
||||
ASSERT_STREQ("scriptSpec 0", data[0].scriptSpec().get());
|
||||
ASSERT_STREQ("currentWorkerURL 0", data[0].currentWorkerURL().get());
|
||||
ASSERT_STREQ("activeCache 0", NS_ConvertUTF16toUTF8(data[0].activeCacheName()).get());
|
||||
ASSERT_STREQ("waitingCache 0", NS_ConvertUTF16toUTF8(data[0].waitingCacheName()).get());
|
||||
@ -184,7 +183,6 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
||||
ASSERT_STREQ("", suffix1.get());
|
||||
ASSERT_STREQ("spec 1", cInfo1.spec().get());
|
||||
ASSERT_STREQ("scope 1", data[1].scope().get());
|
||||
ASSERT_STREQ("scriptSpec 1", data[1].scriptSpec().get());
|
||||
ASSERT_STREQ("currentWorkerURL 1", data[1].currentWorkerURL().get());
|
||||
ASSERT_STREQ("activeCache 1", NS_ConvertUTF16toUTF8(data[1].activeCacheName()).get());
|
||||
ASSERT_STREQ("waitingCache 1", NS_ConvertUTF16toUTF8(data[1].waitingCacheName()).get());
|
||||
@ -221,7 +219,6 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
||||
spec.AppendPrintf("spec write %d", i);
|
||||
d->principal() = mozilla::ipc::ContentPrincipalInfo(mozilla::PrincipalOriginAttributes(i, i % 2), spec);
|
||||
d->scope().AppendPrintf("scope write %d", i);
|
||||
d->scriptSpec().AppendPrintf("scriptSpec write %d", i);
|
||||
d->currentWorkerURL().AppendPrintf("currentWorkerURL write %d", i);
|
||||
d->activeCacheName().AppendPrintf("activeCacheName write %d", i);
|
||||
d->waitingCacheName().AppendPrintf("waitingCacheName write %d", i);
|
||||
@ -259,10 +256,6 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
||||
test.AppendPrintf("scope write %d", i);
|
||||
ASSERT_STREQ(test.get(), data[i].scope().get());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("scriptSpec write %d", i);
|
||||
ASSERT_STREQ(test.get(), data[i].scriptSpec().get());
|
||||
|
||||
test.Truncate();
|
||||
test.AppendPrintf("currentWorkerURL write %d", i);
|
||||
ASSERT_STREQ(test.get(), data[i].currentWorkerURL().get());
|
||||
|
Loading…
Reference in New Issue
Block a user