зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1028187) for mochitest-oth orange
Backed out changeset 01cba8ff52dd (bug 1028187) Backed out changeset caf43baf3306 (bug 1028187)
This commit is contained in:
Родитель
ea77abec71
Коммит
e62864656c
|
@ -9,7 +9,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsDOMString.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
@ -20,7 +19,6 @@ struct RedirEntry {
|
|||
const char* id;
|
||||
const char* url;
|
||||
uint32_t flags;
|
||||
const char* idbOriginPostfix;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -80,9 +78,7 @@ static RedirEntry kRedirMap[] = {
|
|||
#endif
|
||||
{ "home", "chrome://browser/content/abouthome/aboutHome.xhtml",
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||
nsIAboutModule::ALLOW_SCRIPT |
|
||||
nsIAboutModule::ENABLE_INDEXED_DB,
|
||||
"home" },
|
||||
nsIAboutModule::ALLOW_SCRIPT },
|
||||
{ "newtab", "chrome://browser/content/newtab/newTab.xul",
|
||||
nsIAboutModule::ALLOW_SCRIPT },
|
||||
{ "permissions", "chrome://browser/content/preferences/aboutPermissions.xul",
|
||||
|
@ -105,15 +101,11 @@ static RedirEntry kRedirMap[] = {
|
|||
{ "loopconversation", "chrome://browser/content/loop/conversation.html",
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||
nsIAboutModule::ALLOW_SCRIPT |
|
||||
nsIAboutModule::HIDE_FROM_ABOUTABOUT |
|
||||
nsIAboutModule::ENABLE_INDEXED_DB },
|
||||
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
|
||||
{ "looppanel", "chrome://browser/content/loop/panel.html",
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||
nsIAboutModule::ALLOW_SCRIPT |
|
||||
nsIAboutModule::HIDE_FROM_ABOUTABOUT |
|
||||
nsIAboutModule::ENABLE_INDEXED_DB,
|
||||
// Shares an IndexedDB origin with about:loopconversation.
|
||||
"loopconversation" },
|
||||
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
|
||||
#endif
|
||||
};
|
||||
static const int kRedirTotal = ArrayLength(kRedirMap);
|
||||
|
@ -182,29 +174,6 @@ AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
|||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
nsAutoCString name = GetAboutModuleName(aURI);
|
||||
|
||||
for (int i = 0; i < kRedirTotal; i++) {
|
||||
if (name.Equals(kRedirMap[i].id)) {
|
||||
const char* postfix = kRedirMap[i].idbOriginPostfix;
|
||||
if (!postfix) {
|
||||
break;
|
||||
}
|
||||
|
||||
result.AssignASCII(postfix);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsNetUtil.h"
|
||||
#include "nsAboutProtocolUtils.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "nsDOMString.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule)
|
||||
|
||||
|
@ -137,13 +136,6 @@ nsAboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
|||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
#include "mozilla/MouseEvents.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "MessageEvent.h"
|
||||
#include "nsAboutProtocolUtils.h"
|
||||
|
||||
// Interfaces Needed
|
||||
#include "nsIFrame.h"
|
||||
|
@ -10512,39 +10511,6 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
|
|||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
static nsAutoCString
|
||||
GetIndexedDBOriginPostfixForAboutURI(nsIURI *aURI)
|
||||
{
|
||||
nsAutoCString result;
|
||||
|
||||
nsCOMPtr<nsIAboutModule> module;
|
||||
nsresult rv = NS_GetAboutModule(aURI, getter_AddRefs(module));
|
||||
NS_ENSURE_SUCCESS(rv, result);
|
||||
|
||||
uint32_t flags;
|
||||
rv = module->GetURIFlags(aURI, &flags);
|
||||
if (NS_FAILED(rv) || !(flags & nsIAboutModule::ENABLE_INDEXED_DB)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsAutoString postfix;
|
||||
rv = module->GetIndexedDBOriginPostfix(aURI, postfix);
|
||||
if (NS_FAILED(rv) || DOMStringIsNull(postfix)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> origin = NS_GetInnermostURI(aURI);
|
||||
NS_ENSURE_TRUE(origin, result);
|
||||
|
||||
nsAutoCString scheme;
|
||||
rv = origin->GetScheme(scheme);
|
||||
NS_ENSURE_SUCCESS(rv, result);
|
||||
|
||||
result = scheme + NS_LITERAL_CSTRING(":") + NS_ConvertUTF16toUTF8(postfix);
|
||||
ToLowerCase(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
indexedDB::IDBFactory*
|
||||
nsGlobalWindow::GetIndexedDB(ErrorResult& aError)
|
||||
{
|
||||
|
@ -10556,8 +10522,6 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsCString origin;
|
||||
|
||||
if (!IsChromeWindow()) {
|
||||
// Whitelist about:home, since it doesn't have a base domain it would not
|
||||
// pass the thirdPartyUtil check, though it should be able to use
|
||||
|
@ -10567,15 +10531,11 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError)
|
|||
if (principal) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
principal->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (uri) {
|
||||
bool isAbout = false;
|
||||
nsresult rv = uri->SchemeIs("about", &isAbout);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && isAbout) {
|
||||
origin = GetIndexedDBOriginPostfixForAboutURI(uri);
|
||||
skipThirdPartyCheck = !origin.IsEmpty();
|
||||
}
|
||||
bool isAbout = false;
|
||||
if (uri && NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)) && isAbout) {
|
||||
nsAutoCString path;
|
||||
skipThirdPartyCheck = NS_SUCCEEDED(uri->GetPath(path)) &&
|
||||
path.EqualsLiteral("home");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10599,7 +10559,7 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError)
|
|||
}
|
||||
|
||||
// This may be null if being created from a file.
|
||||
aError = indexedDB::IDBFactory::Create(this, origin, origin, nullptr,
|
||||
aError = indexedDB::IDBFactory::Create(this, nullptr,
|
||||
getter_AddRefs(mIndexedDB));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "nsAboutBlank.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAboutBlank, nsIAboutModule)
|
||||
|
@ -37,13 +36,6 @@ nsAboutBlank::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutBlank::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAboutBlank::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
#include "nsAboutBloat.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -125,13 +124,6 @@ nsAboutBloat::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutBloat::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAboutBloat::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsAboutProtocolUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsDOMString.h"
|
||||
|
||||
#include "nsICacheStorageService.h"
|
||||
#include "nsICacheStorage.h"
|
||||
|
@ -486,13 +485,6 @@ nsAboutCache::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutCache::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsAboutCache::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "nsAboutCache.h"
|
||||
#include "nsICacheStorage.h"
|
||||
#include "CacheObserver.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "prprf.h"
|
||||
#include "nsEscape.h"
|
||||
|
@ -109,13 +108,6 @@ nsAboutCacheEntry::GetURIFlags(nsIURI *aURI, uint32_t *result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutCacheEntry::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
|
||||
{
|
||||
SetDOMStringToNull(result);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsAboutCacheEntry
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
interface nsIURI;
|
||||
interface nsIChannel;
|
||||
|
||||
[scriptable, uuid(1d5992c3-28b0-4ec1-9dbb-f5fde7f72199)]
|
||||
[scriptable, uuid(9575693c-60d9-4332-b6b8-6c29289339cb)]
|
||||
interface nsIAboutModule : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -41,24 +41,12 @@ interface nsIAboutModule : nsISupports
|
|||
*/
|
||||
const unsigned long HIDE_FROM_ABOUTABOUT = (1 << 2);
|
||||
|
||||
/**
|
||||
* A flag that indicates whether this about: URI wants Indexed DB enabled.
|
||||
*/
|
||||
const unsigned long ENABLE_INDEXED_DB = (1 << 3);
|
||||
|
||||
/**
|
||||
* A method to get the flags that apply to a given about: URI. The URI
|
||||
* passed in is guaranteed to be one of the URIs that this module
|
||||
* registered to deal with.
|
||||
*/
|
||||
unsigned long getURIFlags(in nsIURI aURI);
|
||||
|
||||
/**
|
||||
* Returns the Indexed DB origin's postfix used for the given about: URI.
|
||||
* If the postfix returned is null then the URI's path (e.g. "home" for
|
||||
* about:home) will be used to construct the origin.
|
||||
*/
|
||||
DOMString getIndexedDBOriginPostfix(in nsIURI aURI);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
|
Загрузка…
Ссылка в новой задаче