зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1168226 - ServiceWorkerRegistrar only use the scope when registering a service worker. r=baku
--HG-- extra : rebase_source : b71689b85faf90d9715cdf21b842f2ab628df6ce
This commit is contained in:
Родитель
b31a33ca20
Коммит
01f058a8e8
|
@ -149,12 +149,26 @@ ServiceWorkerRegistrar::RegisterServiceWorker(
|
|||
MonitorAutoLock lock(mMonitor);
|
||||
MOZ_ASSERT(mDataLoaded);
|
||||
|
||||
const mozilla::ipc::PrincipalInfo& newPrincipalInfo = aData.principal();
|
||||
MOZ_ASSERT(newPrincipalInfo.type() ==
|
||||
mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
|
||||
const mozilla::ipc::ContentPrincipalInfo& newContentPrincipalInfo =
|
||||
newPrincipalInfo.get_ContentPrincipalInfo();
|
||||
|
||||
bool found = false;
|
||||
for (uint32_t i = 0, len = mData.Length(); i < len; ++i) {
|
||||
if (mData[i].scope() == aData.scope()) {
|
||||
mData[i] = aData;
|
||||
found = true;
|
||||
break;
|
||||
const mozilla::ipc::PrincipalInfo& existingPrincipalInfo =
|
||||
mData[i].principal();
|
||||
const mozilla::ipc::ContentPrincipalInfo& existingContentPrincipalInfo =
|
||||
existingPrincipalInfo.get_ContentPrincipalInfo();
|
||||
|
||||
if (newContentPrincipalInfo == existingContentPrincipalInfo) {
|
||||
mData[i] = aData;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче