Bug 1168226 - ServiceWorkerRegistrar only use the scope when registering a service worker. r=baku

--HG--
extra : rebase_source : b71689b85faf90d9715cdf21b842f2ab628df6ce
This commit is contained in:
Jose Antonio Olivera Ortega 2015-06-10 10:17:00 +02:00
Родитель b31a33ca20
Коммит 01f058a8e8
1 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -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;
}
}
}