зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1208355 - Fix -Wshadow warnings in dom/datastore. r=baku
This commit is contained in:
Родитель
d0d6064a8e
Коммит
4fcea5a44a
|
@ -823,22 +823,20 @@ DataStoreService::GetDataStores(nsIDOMWindow* aWindow,
|
||||||
// window, so we can skip the ipc communication.
|
// window, so we can skip the ipc communication.
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
uint32_t appId;
|
uint32_t appId;
|
||||||
nsresult rv = principal->GetAppId(&appId);
|
rv = principal->GetAppId(&appId);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_WARN_IF(rv.Failed())) {
|
||||||
RejectPromise(window, promise, rv);
|
RejectPromise(window, promise, rv.StealNSResult());
|
||||||
promise.forget(aDataStores);
|
promise.forget(aDataStores);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = GetDataStoreInfos(aName, aOwner, appId, principal, stores);
|
rv = GetDataStoreInfos(aName, aOwner, appId, principal, stores);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_WARN_IF(rv.Failed())) {
|
||||||
RejectPromise(window, promise, rv);
|
RejectPromise(window, promise, rv.StealNSResult());
|
||||||
promise.forget(aDataStores);
|
promise.forget(aDataStores);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
// This method can be called in the child so we need to send a request
|
// This method can be called in the child so we need to send a request
|
||||||
// to the parent and create DataStore object here.
|
// to the parent and create DataStore object here.
|
||||||
ContentChild* contentChild = ContentChild::GetSingleton();
|
ContentChild* contentChild = ContentChild::GetSingleton();
|
||||||
|
@ -971,7 +969,7 @@ DataStoreService::GetDataStoresResolve(nsPIDOMWindow* aWindow,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thie method populates 'aStores' with the list of DataStores with 'aName' as
|
// This method populates 'aStores' with the list of DataStores with 'aName' as
|
||||||
// name and available for this 'aAppId'.
|
// name and available for this 'aAppId'.
|
||||||
nsresult
|
nsresult
|
||||||
DataStoreService::GetDataStoreInfos(const nsAString& aName,
|
DataStoreService::GetDataStoreInfos(const nsAString& aName,
|
||||||
|
@ -1009,12 +1007,12 @@ DataStoreService::GetDataStoreInfos(const nsAString& aName,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataStoreInfo* info = nullptr;
|
DataStoreInfo* appsInfo = nullptr;
|
||||||
if (apps->Get(aAppId, &info) &&
|
if (apps->Get(aAppId, &appsInfo) &&
|
||||||
(aOwner.IsEmpty() || aOwner.Equals(info->mManifestURL))) {
|
(aOwner.IsEmpty() || aOwner.Equals(appsInfo->mManifestURL))) {
|
||||||
DataStoreInfo* owned = aStores.AppendElement();
|
DataStoreInfo* owned = aStores.AppendElement();
|
||||||
owned->Init(info->mName, info->mOriginURL, info->mManifestURL, false,
|
owned->Init(appsInfo->mName, appsInfo->mOriginURL, appsInfo->mManifestURL,
|
||||||
info->mEnabled);
|
false, appsInfo->mEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto iter = apps->ConstIter(); !iter.Done(); iter.Next()) {
|
for (auto iter = apps->ConstIter(); !iter.Done(); iter.Next()) {
|
||||||
|
@ -1022,29 +1020,29 @@ DataStoreService::GetDataStoreInfos(const nsAString& aName,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataStoreInfo* info = iter.UserData();
|
DataStoreInfo* appInfo = iter.UserData();
|
||||||
MOZ_ASSERT(info);
|
MOZ_ASSERT(appInfo);
|
||||||
|
|
||||||
HashApp* app;
|
HashApp* accessApp;
|
||||||
if (!mAccessStores.Get(aName, &app)) {
|
if (!mAccessStores.Get(aName, &accessApp)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aOwner.IsEmpty() &&
|
if (!aOwner.IsEmpty() &&
|
||||||
!aOwner.Equals(info->mManifestURL)) {
|
!aOwner.Equals(appInfo->mManifestURL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataStoreInfo* accessInfo = nullptr;
|
DataStoreInfo* accessInfo = nullptr;
|
||||||
if (!app->Get(aAppId, &accessInfo)) {
|
if (!accessApp->Get(aAppId, &accessInfo)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readOnly = info->mReadOnly || accessInfo->mReadOnly;
|
bool readOnly = appInfo->mReadOnly || accessInfo->mReadOnly;
|
||||||
DataStoreInfo* accessStore = aStores.AppendElement();
|
DataStoreInfo* accessStore = aStores.AppendElement();
|
||||||
accessStore->Init(aName, info->mOriginURL,
|
accessStore->Init(aName, appInfo->mOriginURL,
|
||||||
info->mManifestURL, readOnly,
|
appInfo->mManifestURL, readOnly,
|
||||||
info->mEnabled);
|
appInfo->mEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -45,3 +45,6 @@ MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
|
||||||
include('/ipc/chromium/chromium-config.mozbuild')
|
include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
|
if CONFIG['GNU_CXX']:
|
||||||
|
CXXFLAGS += ['-Wshadow']
|
||||||
|
|
Загрузка…
Ссылка в новой задаче