diff options
-rw-r--r-- | dom/asmjscache/AsmJSCache.cpp | 348 | ||||
-rw-r--r-- | dom/asmjscache/test/test_cachingBasic.html | 2 | ||||
-rw-r--r-- | dom/asmjscache/test/test_cachingMulti.html | 2 | ||||
-rw-r--r-- | dom/asmjscache/test/test_workers.html | 2 | ||||
-rw-r--r-- | dom/indexedDB/ActorsParent.cpp | 96 | ||||
-rw-r--r-- | js/src/jsapi.h | 1 | ||||
-rw-r--r-- | js/src/wasm/AsmJS.cpp | 3 | ||||
-rw-r--r-- | toolkit/components/jsdownloads/src/DownloadIntegration.jsm | 2 | ||||
-rw-r--r-- | toolkit/moz.build | 1 | ||||
-rw-r--r-- | toolkit/obsolete/content/dialogOverlay.js | 107 | ||||
-rw-r--r-- | toolkit/obsolete/content/dialogOverlay.xul | 101 | ||||
-rw-r--r-- | toolkit/obsolete/content/globalOverlay.xul | 38 | ||||
-rw-r--r-- | toolkit/obsolete/content/inlineSpellCheckUI.js | 7 | ||||
-rw-r--r-- | toolkit/obsolete/content/nsClipboard.js | 64 | ||||
-rw-r--r-- | toolkit/obsolete/content/nsUserSettings.js | 108 | ||||
-rw-r--r-- | toolkit/obsolete/content/strres.js | 28 | ||||
-rw-r--r-- | toolkit/obsolete/jar.mn | 12 | ||||
-rw-r--r-- | toolkit/obsolete/moz.build | 7 |
18 files changed, 794 insertions, 135 deletions
diff --git a/dom/asmjscache/AsmJSCache.cpp b/dom/asmjscache/AsmJSCache.cpp index 4afcc6d6b..be54987a1 100644 --- a/dom/asmjscache/AsmJSCache.cpp +++ b/dom/asmjscache/AsmJSCache.cpp @@ -69,13 +69,19 @@ namespace asmjscache { namespace { +class ParentRunnable; + // Anything smaller should compile fast enough that caching will just add // overhead. -// static const size_t sMinCachedModuleLength = 10000; +static const size_t sMinCachedModuleLength = 10000; // The number of characters to hash into the Metadata::Entry::mFastHash. static const unsigned sNumFastHashChars = 4096; +// Track all live parent actors. +typedef nsTArray<const ParentRunnable*> ParentActorArray; +StaticAutoPtr<ParentActorArray> sLiveParentActors; + nsresult WriteMetadataFile(nsIFile* aMetadataFile, const Metadata& aMetadata) { @@ -236,6 +242,94 @@ EvictEntries(nsIFile* aDirectory, const nsACString& aGroup, } } +/******************************************************************************* + * Client + ******************************************************************************/ + +class Client + : public quota::Client +{ + static Client* sInstance; + + bool mShutdownRequested; + +public: + Client(); + + static bool + IsShuttingDownOnBackgroundThread() + { + AssertIsOnBackgroundThread(); + + if (sInstance) { + return sInstance->IsShuttingDown(); + } + + return QuotaManager::IsShuttingDown(); + } + + static bool + IsShuttingDownOnNonBackgroundThread() + { + MOZ_ASSERT(!IsOnBackgroundThread()); + + return QuotaManager::IsShuttingDown(); + } + + bool + IsShuttingDown() const + { + AssertIsOnBackgroundThread(); + + return mShutdownRequested; + } + + NS_INLINE_DECL_REFCOUNTING(Client, override) + + virtual Type + GetType() override; + + virtual nsresult + InitOrigin(PersistenceType aPersistenceType, + const nsACString& aGroup, + const nsACString& aOrigin, + const AtomicBool& aCanceled, + UsageInfo* aUsageInfo) override; + + virtual nsresult + GetUsageForOrigin(PersistenceType aPersistenceType, + const nsACString& aGroup, + const nsACString& aOrigin, + const AtomicBool& aCanceled, + UsageInfo* aUsageInfo) override; + + virtual void + OnOriginClearCompleted(PersistenceType aPersistenceType, + const nsACString& aOrigin) + override; + + virtual void + ReleaseIOThreadObjects() override; + + virtual void + AbortOperations(const nsACString& aOrigin) override; + + virtual void + AbortOperationsForProcess(ContentParentId aContentParentId) override; + + virtual void + StartIdleMaintenance() override; + + virtual void + StopIdleMaintenance() override; + + virtual void + ShutdownWorkThreads() override; + +private: + ~Client(); +}; + // FileDescriptorHolder owns a file descriptor and its memory mapping. // FileDescriptorHolder is derived by two runnable classes (that is, // (Parent|Child)Runnable. @@ -897,6 +991,13 @@ ParentRunnable::FinishOnOwningThread() FileDescriptorHolder::Finish(); mDirectoryLock = nullptr; + + MOZ_ASSERT(sLiveParentActors); + sLiveParentActors->RemoveElement(this); + + if (sLiveParentActors->IsEmpty()) { + sLiveParentActors = nullptr; + } } NS_IMETHODIMP @@ -1140,6 +1241,10 @@ AllocEntryParent(OpenMode aOpenMode, { AssertIsOnBackgroundThread(); + if (NS_WARN_IF(Client::IsShuttingDownOnBackgroundThread())) { + return nullptr; + } + if (NS_WARN_IF(aPrincipalInfo.type() == PrincipalInfo::TNullPrincipalInfo)) { MOZ_ASSERT(false); return nullptr; @@ -1148,6 +1253,12 @@ AllocEntryParent(OpenMode aOpenMode, RefPtr<ParentRunnable> runnable = new ParentRunnable(aPrincipalInfo, aOpenMode, aWriteParams); + if (!sLiveParentActors) { + sLiveParentActors = new ParentActorArray(); + } + + sLiveParentActors->AppendElement(runnable); + nsresult rv = NS_DispatchToMainThread(runnable); NS_ENSURE_SUCCESS(rv, nullptr); @@ -1520,7 +1631,6 @@ DeallocEntryChild(PAsmJSCacheEntryChild* aActor) static_cast<ChildRunnable*>(aActor)->Release(); } -/* namespace { JS::AsmJSCacheResult @@ -1583,7 +1693,6 @@ OpenFile(nsIPrincipal* aPrincipal, } } // namespace -*/ typedef uint32_t AsmJSCookieType; static const uint32_t sAsmJSCookie = 0x600d600d; @@ -1596,9 +1705,6 @@ OpenEntryForRead(nsIPrincipal* aPrincipal, const uint8_t** aMemory, intptr_t* aHandle) { - return false; - -/* if (size_t(aLimit - aBegin) < sMinCachedModuleLength) { return false; } @@ -1638,7 +1744,6 @@ OpenEntryForRead(nsIPrincipal* aPrincipal, // failure) at which point the file will be closed. childRunnable.Forget(reinterpret_cast<ChildRunnable**>(aHandle)); return true; -*/ } void @@ -1663,9 +1768,6 @@ OpenEntryForWrite(nsIPrincipal* aPrincipal, uint8_t** aMemory, intptr_t* aHandle) { - return JS::AsmJSCache_ESR52; - -/* if (size_t(aEnd - aBegin) < sMinCachedModuleLength) { return JS::AsmJSCache_ModuleTooSmall; } @@ -1699,7 +1801,6 @@ OpenEntryForWrite(nsIPrincipal* aPrincipal, // failure) at which point the file will be closed childRunnable.Forget(reinterpret_cast<ChildRunnable**>(aHandle)); return JS::AsmJSCache_Success; -*/ } void @@ -1722,128 +1823,163 @@ CloseEntryForWrite(size_t aSize, } } -class Client : public quota::Client +/******************************************************************************* + * Client + ******************************************************************************/ + +Client* Client::sInstance = nullptr; + +Client::Client() + : mShutdownRequested(false) { - ~Client() {} + AssertIsOnBackgroundThread(); + MOZ_ASSERT(!sInstance, "We expect this to be a singleton!"); -public: - NS_IMETHOD_(MozExternalRefCountType) - AddRef() override; + sInstance = this; +} - NS_IMETHOD_(MozExternalRefCountType) - Release() override; +Client::~Client() +{ + AssertIsOnBackgroundThread(); + MOZ_ASSERT(sInstance == this, "We expect this to be a singleton!"); - virtual Type - GetType() override - { - return ASMJS; - } + sInstance = nullptr; +} - virtual nsresult - InitOrigin(PersistenceType aPersistenceType, - const nsACString& aGroup, - const nsACString& aOrigin, - const AtomicBool& aCanceled, - UsageInfo* aUsageInfo) override - { - if (!aUsageInfo) { - return NS_OK; - } - return GetUsageForOrigin(aPersistenceType, - aGroup, - aOrigin, - aCanceled, - aUsageInfo); - } +Client::Type +Client::GetType() +{ + return ASMJS; +} - virtual nsresult - GetUsageForOrigin(PersistenceType aPersistenceType, - const nsACString& aGroup, - const nsACString& aOrigin, - const AtomicBool& aCanceled, - UsageInfo* aUsageInfo) override - { - QuotaManager* qm = QuotaManager::Get(); - MOZ_ASSERT(qm, "We were being called by the QuotaManager"); +nsresult +Client::InitOrigin(PersistenceType aPersistenceType, + const nsACString& aGroup, + const nsACString& aOrigin, + const AtomicBool& aCanceled, + UsageInfo* aUsageInfo) +{ + if (!aUsageInfo) { + return NS_OK; + } + return GetUsageForOrigin(aPersistenceType, + aGroup, + aOrigin, + aCanceled, + aUsageInfo); +} - nsCOMPtr<nsIFile> directory; - nsresult rv = qm->GetDirectoryForOrigin(aPersistenceType, aOrigin, - getter_AddRefs(directory)); - NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(directory, "We're here because the origin directory exists"); +nsresult +Client::GetUsageForOrigin(PersistenceType aPersistenceType, + const nsACString& aGroup, + const nsACString& aOrigin, + const AtomicBool& aCanceled, + UsageInfo* aUsageInfo) +{ + QuotaManager* qm = QuotaManager::Get(); + MOZ_ASSERT(qm, "We were being called by the QuotaManager"); - rv = directory->Append(NS_LITERAL_STRING(ASMJSCACHE_DIRECTORY_NAME)); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr<nsIFile> directory; + nsresult rv = qm->GetDirectoryForOrigin(aPersistenceType, aOrigin, + getter_AddRefs(directory)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } - DebugOnly<bool> exists; - MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists); + MOZ_ASSERT(directory, "We're here because the origin directory exists"); - nsCOMPtr<nsISimpleEnumerator> entries; - rv = directory->GetDirectoryEntries(getter_AddRefs(entries)); - NS_ENSURE_SUCCESS(rv, rv); + rv = directory->Append(NS_LITERAL_STRING(ASMJSCACHE_DIRECTORY_NAME)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } - bool hasMore; - while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && - hasMore && !aCanceled) { - nsCOMPtr<nsISupports> entry; - rv = entries->GetNext(getter_AddRefs(entry)); - NS_ENSURE_SUCCESS(rv, rv); + DebugOnly<bool> exists; + MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists); - nsCOMPtr<nsIFile> file = do_QueryInterface(entry); - NS_ENSURE_TRUE(file, NS_NOINTERFACE); + nsCOMPtr<nsISimpleEnumerator> entries; + rv = directory->GetDirectoryEntries(getter_AddRefs(entries)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } - int64_t fileSize; - rv = file->GetFileSize(&fileSize); - NS_ENSURE_SUCCESS(rv, rv); + bool hasMore; + while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && + hasMore && !aCanceled) { + nsCOMPtr<nsISupports> entry; + rv = entries->GetNext(getter_AddRefs(entry)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } - MOZ_ASSERT(fileSize >= 0, "Negative size?!"); + nsCOMPtr<nsIFile> file = do_QueryInterface(entry); + if (NS_WARN_IF(!file)) { + return NS_NOINTERFACE; + } - // Since the client is not explicitly storing files, append to database - // usage which represents implicit storage allocation. - aUsageInfo->AppendToDatabaseUsage(uint64_t(fileSize)); + int64_t fileSize; + rv = file->GetFileSize(&fileSize); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; } - NS_ENSURE_SUCCESS(rv, rv); - return NS_OK; + MOZ_ASSERT(fileSize >= 0, "Negative size?!"); + + // Since the client is not explicitly storing files, append to database + // usage which represents implicit storage allocation. + aUsageInfo->AppendToDatabaseUsage(uint64_t(fileSize)); + } + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; } - virtual void - OnOriginClearCompleted(PersistenceType aPersistenceType, - const nsACString& aOrigin) - override - { } + return NS_OK; +} - virtual void - ReleaseIOThreadObjects() override - { } +void +Client::OnOriginClearCompleted(PersistenceType aPersistenceType, + const nsACString& aOrigin) +{ +} - virtual void - AbortOperations(const nsACString& aOrigin) override - { } +void +Client::ReleaseIOThreadObjects() +{ +} - virtual void - AbortOperationsForProcess(ContentParentId aContentParentId) override - { } +void +Client::AbortOperations(const nsACString& aOrigin) +{ +} - virtual void - StartIdleMaintenance() override - { } +void +Client::AbortOperationsForProcess(ContentParentId aContentParentId) +{ +} - virtual void - StopIdleMaintenance() override - { } +void +Client::StartIdleMaintenance() +{ +} - virtual void - ShutdownWorkThreads() override - { } +void +Client::StopIdleMaintenance() +{ +} -private: - nsAutoRefCnt mRefCnt; - NS_DECL_OWNINGTHREAD -}; +void +Client::ShutdownWorkThreads() +{ + AssertIsOnBackgroundThread(); + + if (sLiveParentActors) { + nsIThread* currentThread = NS_GetCurrentThread(); + MOZ_ASSERT(currentThread); -NS_IMPL_ADDREF(asmjscache::Client) -NS_IMPL_RELEASE(asmjscache::Client) + do { + MOZ_ALWAYS_TRUE(NS_ProcessNextEvent(currentThread)); + } while (!sLiveParentActors); + } +} quota::Client* CreateClient() diff --git a/dom/asmjscache/test/test_cachingBasic.html b/dom/asmjscache/test/test_cachingBasic.html index e84fdba8b..f491fe9fa 100644 --- a/dom/asmjscache/test/test_cachingBasic.html +++ b/dom/asmjscache/test/test_cachingBasic.html @@ -44,7 +44,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=929236 evalAsync(code); break; case 1: - ok(!jsFuns.isAsmJSModuleLoadedFromCache(module), 'module not loaded from cache'); + ok(jsFuns.isAsmJSModuleLoadedFromCache(module), 'module loaded from cache'); SimpleTest.finish(); break; default: diff --git a/dom/asmjscache/test/test_cachingMulti.html b/dom/asmjscache/test/test_cachingMulti.html index ca092fda0..ceaf75812 100644 --- a/dom/asmjscache/test/test_cachingMulti.html +++ b/dom/asmjscache/test/test_cachingMulti.html @@ -36,7 +36,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=944821 code2 += "return g" + i + ";\n"; code2 += "}\n"; code2 += "ok(jsFuns.isAsmJSModule(f), 'f is an asm.js module')\n"; - code2 += "if (assertCacheHit) ok(!jsFuns.isAsmJSModuleLoadedFromCache(f), 'cache disabled');\n"; + code2 += "if (assertCacheHit) ok(jsFuns.isAsmJSModuleLoadedFromCache(f), 'cache hit');\n"; code2 += "var gX = f();\n"; code2 += "ok(jsFuns.isAsmJSFunction(gX), 'gX is an asm.js function')\n"; code2 += "ok(gX() === " + i + ", 'gX returns the correct result')\n"; diff --git a/dom/asmjscache/test/test_workers.html b/dom/asmjscache/test/test_workers.html index 992ed785b..6704459f6 100644 --- a/dom/asmjscache/test/test_workers.html +++ b/dom/asmjscache/test/test_workers.html @@ -31,7 +31,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=941830 var workerBlob = new Blob([workerCode], {type:"application/javascript"}); var mainCode = asmjsCode; - mainCode += "ok(!jsFuns.isAsmJSModuleLoadedFromCache(f), 'f is not a cache hit')\n"; + mainCode += "ok(jsFuns.isAsmJSModuleLoadedFromCache(f), 'f is a cache hit')\n"; mainCode += "var g42 = f();\n"; mainCode += "ok(jsFuns.isAsmJSFunction(g42), 'g42 is an asm.js function');\n"; mainCode += "ok(g42() === 42, 'g42 returns the correct result');\n"; diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index c0cb69149..9d4e72f2f 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -18185,11 +18185,25 @@ QuotaClient::ShutdownWorkThreads() mShutdownRequested = true; + // Shutdown maintenance thread pool (this spins the event loop until all + // threads are gone). This should release any maintenance related quota + // objects. if (mMaintenanceThreadPool) { mMaintenanceThreadPool->Shutdown(); mMaintenanceThreadPool = nullptr; } + // Let any runnables dispatched from dying maintenance threads to be + // processed. This should release any maintenance related directory locks. + if (mCurrentMaintenance) { + nsIThread* currentThread = NS_GetCurrentThread(); + MOZ_ASSERT(currentThread); + + do { + MOZ_ALWAYS_TRUE(NS_ProcessNextEvent(currentThread)); + } while (!mCurrentMaintenance); + } + RefPtr<ConnectionPool> connectionPool = gConnectionPool.get(); if (connectionPool) { connectionPool->Shutdown(); @@ -18409,7 +18423,8 @@ Maintenance::Start() AssertIsOnBackgroundThread(); MOZ_ASSERT(mState == State::Initial); - if (IsAborted()) { + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) || + IsAborted()) { return NS_ERROR_ABORT; } @@ -18433,7 +18448,8 @@ Maintenance::CreateIndexedDatabaseManager() MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(mState == State::CreateIndexedDatabaseManager); - if (IsAborted()) { + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + IsAborted()) { return NS_ERROR_ABORT; } @@ -18458,7 +18474,8 @@ Maintenance::OpenDirectory() MOZ_ASSERT(!mDirectoryLock); MOZ_ASSERT(QuotaManager::Get()); - if (IsAborted()) { + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) || + IsAborted()) { return NS_ERROR_ABORT; } @@ -18482,7 +18499,8 @@ Maintenance::DirectoryOpen() MOZ_ASSERT(mState == State::DirectoryOpenPending); MOZ_ASSERT(mDirectoryLock); - if (IsAborted()) { + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) || + IsAborted()) { return NS_ERROR_ABORT; } @@ -18512,7 +18530,8 @@ Maintenance::DirectoryWork() // We have to find all database files that match any persistence type and any // origin. We ignore anything out of the ordinary for now. - if (IsAborted()) { + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + IsAborted()) { return NS_ERROR_ABORT; } @@ -18699,8 +18718,10 @@ Maintenance::DirectoryWork() continue; } + nsCString suffix; nsCString group; nsCString origin; + bool isApp; nsTArray<nsString> databasePaths; while (true) { @@ -18756,19 +18777,18 @@ Maintenance::DirectoryWork() // Found a database. if (databasePaths.IsEmpty()) { + MOZ_ASSERT(suffix.IsEmpty()); MOZ_ASSERT(group.IsEmpty()); MOZ_ASSERT(origin.IsEmpty()); int64_t dummyTimeStamp; - nsCString dummySuffix; - bool dummyIsApp; if (NS_WARN_IF(NS_FAILED( quotaManager->GetDirectoryMetadata2(originDir, &dummyTimeStamp, - dummySuffix, + suffix, group, origin, - &dummyIsApp)))) { + &isApp)))) { // Not much we can do here... continue; } @@ -18784,6 +18804,22 @@ Maintenance::DirectoryWork() group, origin, Move(databasePaths))); + + nsCOMPtr<nsIFile> directory; + + // Idle maintenance may occur before origin is initailized. + // Ensure origin is initialized first. It will initialize all origins + // for temporary storage including IDB origins. + rv = quotaManager->EnsureOriginIsInitialized(persistenceType, + suffix, + group, + origin, + isApp, + getter_AddRefs(directory)); + + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } } } } @@ -18835,6 +18871,11 @@ Maintenance::BeginDatabaseMaintenance() } }; + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnBackgroundThread()) || + IsAborted()) { + return NS_ERROR_ABORT; + } + RefPtr<nsThreadPool> threadPool; for (DirectoryInfo& directoryInfo : mDirectoryInfos) { @@ -19021,6 +19062,11 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase() } }; + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + mMaintenance->IsAborted()) { + return; + } + nsCOMPtr<nsIFile> databaseFile = GetFileForPath(mDatabasePath); MOZ_ASSERT(databaseFile); @@ -19037,10 +19083,6 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase() AutoClose autoClose(connection); - if (mMaintenance->IsAborted()) { - return; - } - AutoProgressHandler progressHandler(mMaintenance); if (NS_WARN_IF(NS_FAILED(progressHandler.Register(connection)))) { return; @@ -19059,20 +19101,12 @@ DatabaseMaintenance::PerformMaintenanceOnDatabase() return; } - if (mMaintenance->IsAborted()) { - return; - } - MaintenanceAction maintenanceAction; rv = DetermineMaintenanceAction(connection, databaseFile, &maintenanceAction); if (NS_WARN_IF(NS_FAILED(rv))) { return; } - if (mMaintenance->IsAborted()) { - return; - } - switch (maintenanceAction) { case MaintenanceAction::Nothing: break; @@ -19099,6 +19133,11 @@ DatabaseMaintenance::CheckIntegrity(mozIStorageConnection* aConnection, MOZ_ASSERT(aConnection); MOZ_ASSERT(aOk); + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + mMaintenance->IsAborted()) { + return NS_ERROR_ABORT; + } + nsresult rv; // First do a full integrity_check. Scope statements tightly here because @@ -19216,6 +19255,11 @@ DatabaseMaintenance::DetermineMaintenanceAction( MOZ_ASSERT(aDatabaseFile); MOZ_ASSERT(aMaintenanceAction); + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + mMaintenance->IsAborted()) { + return NS_ERROR_ABORT; + } + int32_t schemaVersion; nsresult rv = aConnection->GetSchemaVersion(&schemaVersion); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -19425,6 +19469,11 @@ DatabaseMaintenance::IncrementalVacuum(mozIStorageConnection* aConnection) MOZ_ASSERT(!IsOnBackgroundThread()); MOZ_ASSERT(aConnection); + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + mMaintenance->IsAborted()) { + return; + } + nsresult rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( "PRAGMA incremental_vacuum;" )); @@ -19442,6 +19491,11 @@ DatabaseMaintenance::FullVacuum(mozIStorageConnection* aConnection, MOZ_ASSERT(aConnection); MOZ_ASSERT(aDatabaseFile); + if (NS_WARN_IF(QuotaClient::IsShuttingDownOnNonBackgroundThread()) || + mMaintenance->IsAborted()) { + return; + } + nsresult rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING( "VACUUM;" )); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 089e22b09..2d6ff462c 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -5999,7 +5999,6 @@ enum AsmJSCacheResult AsmJSCache_Disabled_JitInspector, AsmJSCache_InternalError, AsmJSCache_Disabled_PrivateBrowsing, - AsmJSCache_ESR52, AsmJSCache_LIMIT }; diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp index 6964c5d62..34f5a8c0d 100644 --- a/js/src/wasm/AsmJS.cpp +++ b/js/src/wasm/AsmJS.cpp @@ -8661,9 +8661,6 @@ BuildConsoleMessage(ExclusiveContext* cx, unsigned time, JS::AsmJSCacheResult ca case JS::AsmJSCache_Disabled_PrivateBrowsing: cacheString = "caching disabled by private browsing mode"; break; - case JS::AsmJSCache_ESR52: - cacheString = "caching disabled in Firefox ESR52"; - break; case JS::AsmJSCache_LIMIT: MOZ_CRASH("bad AsmJSCacheResult"); break; diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 1d289c24d..1c30599f5 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -697,7 +697,7 @@ this.DownloadIntegration = { // to do this check. The second is that the system-level security prompt // would be displayed at launch time in any case. if (file.isExecutable() && !isWindowsExe && - !(await this.confirmLaunchExecutable(file.path))) { + !(yield this.confirmLaunchExecutable(file.path))) { return; } diff --git a/toolkit/moz.build b/toolkit/moz.build index 6c88c1928..8fe5126ca 100644 --- a/toolkit/moz.build +++ b/toolkit/moz.build @@ -15,6 +15,7 @@ DIRS += [ 'mozapps/extensions', 'mozapps/handling', 'mozapps/preferences', + 'obsolete', 'pluginproblem', 'profile', 'themes', diff --git a/toolkit/obsolete/content/dialogOverlay.js b/toolkit/obsolete/content/dialogOverlay.js new file mode 100644 index 000000000..4b03f268f --- /dev/null +++ b/toolkit/obsolete/content/dialogOverlay.js @@ -0,0 +1,107 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var doOKFunction = 0; +var doCancelFunction = 0; +var doButton2Function = 0; +var doButton3Function = 0; + +// call this from dialog onload() to allow ok and cancel to call your code +// functions should return true if they want the dialog to close +function doSetOKCancel(okFunc, cancelFunc, button2Func, button3Func ) +{ + //dump("top.window.navigator.platform: " + top.window.navigator.platform + "\n"); + + doOKFunction = okFunc; + doCancelFunction = cancelFunc; + doButton2Function = button2Func; + doButton3Function = button3Func; +} + +function doOKButton() +{ + var close = true; + + if ( doOKFunction ) + close = doOKFunction(); + + if (close && top) + top.window.close(); +} + +function doCancelButton() +{ + var close = true; + + if ( doCancelFunction ) + close = doCancelFunction(); + + if (close && top) + top.window.close(); +} + +function doButton2() +{ + var close = true; + + if ( doButton2Function ) + close = doButton2Function(); + + if (close && top) + top.window.close(); +} + +function doButton3() +{ + var close = true; + + if ( doButton3Function ) + close = doButton3Function(); + + if (close && top) + top.window.close(); +} + +function moveToAlertPosition() +{ + // hack. we need this so the window has something like its final size + if (window.outerWidth == 1) { + dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n"); + sizeToContent(); + } + + if (opener) { + var xOffset = (opener.outerWidth - window.outerWidth) / 2; + var yOffset = opener.outerHeight / 5; + + var newX = opener.screenX + xOffset; + var newY = opener.screenY + yOffset; + } else { + newX = (screen.availWidth - window.outerWidth) / 2; + newY = (screen.availHeight - window.outerHeight) / 2; + } + + // ensure the window is fully onscreen (if smaller than the screen) + if (newX < screen.availLeft) + newX = screen.availLeft + 20; + if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth)) + newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20; + + if (newY < screen.availTop) + newY = screen.availTop + 20; + if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight)) + newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60; + + window.moveTo( newX, newY ); +} + +function centerWindowOnScreen() +{ + var xOffset = screen.availWidth/2 - window.outerWidth/2; + var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10; + + xOffset = ( xOffset > 0 ) ? xOffset : 0; + yOffset = ( yOffset > 0 ) ? yOffset : 0; + window.moveTo( xOffset, yOffset); +} diff --git a/toolkit/obsolete/content/dialogOverlay.xul b/toolkit/obsolete/content/dialogOverlay.xul new file mode 100644 index 000000000..09e00613e --- /dev/null +++ b/toolkit/obsolete/content/dialogOverlay.xul @@ -0,0 +1,101 @@ +<?xml version="1.0"?> +# -*- Mode: HTML -*- +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# WARNING!!! This file is obsoleted by the dialog.xml widget +# + +<!DOCTYPE overlay SYSTEM "chrome://global/locale/dialogOverlay.dtd"> + +<overlay id="dialogOverlay" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script type="application/javascript" src="chrome://global/content/dialogOverlay.js"/> + +#ifdef XP_MACOSX +# + <hbox id="okCancelButtons"> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> + + <hbox id="okCancelHelpButtons"> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> + + <hbox id="okCancelButtonsRight"> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> + + <hbox id="okCancelHelpButtonsRight"> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> +# +#else +# + <hbox id="okCancelButtons"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <spacer flex="1"/> + </hbox> + + <hbox id="okCancelHelpButtons"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + <spacer flex="1"/> + </hbox> + + <hbox id="okCancelButtonsRight"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + </hbox> + + <hbox id="okCancelHelpButtonsRight"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + </hbox> +#endif + + <keyset id="dialogKeys"> + <key keycode="VK_RETURN" oncommand="if (!document.getElementById('ok').disabled) doOKButton();"/> + <key keycode="VK_ESCAPE" oncommand="doCancelButton();"/> +#ifdef XP_MACOSX + <key key="." modifiers="meta" oncommand="doCancelButton();"/> +# +#endif + </keyset> + +</overlay> diff --git a/toolkit/obsolete/content/globalOverlay.xul b/toolkit/obsolete/content/globalOverlay.xul new file mode 100644 index 000000000..90268a8e4 --- /dev/null +++ b/toolkit/obsolete/content/globalOverlay.xul @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + + +<overlay id="globalOverlay" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> + <script type="application/javascript"><![CDATA[ + + function FillInTooltip ( tipElement ) + { + var retVal = false; + var textNode = document.getElementById("TOOLTIP-tooltipText"); + if (textNode) { + while (textNode.hasChildNodes()) + textNode.removeChild(textNode.firstChild); + var tipText = tipElement.getAttribute("tooltiptext"); + if (tipText) { + var node = document.createTextNode(tipText); + textNode.appendChild(node); + retVal = true; + } + } + return retVal; + } + + ]]></script> + + <popupset id="aTooltipSet"> + <tooltip id="aTooltip" class="tooltip" onpopupshowing="return FillInTooltip(document.tooltipNode);"> + <label id="TOOLTIP-tooltipText" class="tooltip-label" flex="1"/> + </tooltip> + </popupset> + +</overlay> diff --git a/toolkit/obsolete/content/inlineSpellCheckUI.js b/toolkit/obsolete/content/inlineSpellCheckUI.js new file mode 100644 index 000000000..177ce90cd --- /dev/null +++ b/toolkit/obsolete/content/inlineSpellCheckUI.js @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); + +var InlineSpellCheckerUI = new InlineSpellChecker(); diff --git a/toolkit/obsolete/content/nsClipboard.js b/toolkit/obsolete/content/nsClipboard.js new file mode 100644 index 000000000..d9f7c4589 --- /dev/null +++ b/toolkit/obsolete/content/nsClipboard.js @@ -0,0 +1,64 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * nsClipboard - wrapper around nsIClipboard and nsITransferable + * that simplifies access to the clipboard. + **/ +var nsClipboard = { + _CB: null, + get mClipboard() + { + if (!this._CB) + { + const kCBContractID = "@mozilla.org/widget/clipboard;1"; + const kCBIID = Components.interfaces.nsIClipboard; + this._CB = Components.classes[kCBContractID].getService(kCBIID); + } + return this._CB; + }, + + currentClipboard: null, + /** + * Array/Object read (Object aFlavourList, long aClipboard, Bool aAnyFlag) ; + * + * returns the data in the clipboard + * + * @param FlavourSet aFlavourSet + * formatted list of desired flavours + * @param long aClipboard + * the clipboard to read data from (kSelectionClipboard/kGlobalClipboard) + * @param Bool aAnyFlag + * should be false. + **/ + read: function (aFlavourList, aClipboard, aAnyFlag) + { + this.currentClipboard = aClipboard; + var data = nsTransferable.get(aFlavourList, this.getClipboardTransferable, aAnyFlag); + return data.first.first; // only support one item + }, + + /** + * nsISupportsArray getClipboardTransferable (Object aFlavourList) ; + * + * returns a nsISupportsArray of the item on the clipboard + * + * @param Object aFlavourList + * formatted list of desired flavours. + **/ + getClipboardTransferable: function (aFlavourList) + { + const supportsContractID = "@mozilla.org/supports-array;1"; + const supportsIID = Components.interfaces.nsISupportsArray; + var supportsArray = Components.classes[supportsContractID].createInstance(supportsIID); + var trans = nsTransferable.createTransferable(); + for (var flavour in aFlavourList) + trans.addDataFlavor(flavour); + nsClipboard.mClipboard.getData(trans, nsClipboard.currentClipboard) + supportsArray.AppendElement(trans); + return supportsArray; + } +}; + diff --git a/toolkit/obsolete/content/nsUserSettings.js b/toolkit/obsolete/content/nsUserSettings.js new file mode 100644 index 000000000..e0c378caf --- /dev/null +++ b/toolkit/obsolete/content/nsUserSettings.js @@ -0,0 +1,108 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + * nsPreferences - a wrapper around nsIPrefService. Provides built in + * exception handling to make preferences access simpler. + **/ +var nsPreferences = { + get mPrefService() + { + return Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + }, + + setBoolPref: function (aPrefName, aPrefValue) + { + try + { + this.mPrefService.setBoolPref(aPrefName, aPrefValue); + } + catch (e) + { + } + }, + + getBoolPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getBoolPref(aPrefName); + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + }, + + setUnicharPref: function (aPrefName, aPrefValue) + { + try + { + var str = Components.classes["@mozilla.org/supports-string;1"] + .createInstance(Components.interfaces.nsISupportsString); + str.data = aPrefValue; + this.mPrefService.setComplexValue(aPrefName, + Components.interfaces.nsISupportsString, str); + } + catch (e) + { + } + }, + + copyUnicharPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getComplexValue(aPrefName, + Components.interfaces.nsISupportsString).data; + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + }, + + setIntPref: function (aPrefName, aPrefValue) + { + try + { + this.mPrefService.setIntPref(aPrefName, aPrefValue); + } + catch (e) + { + } + }, + + getIntPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getIntPref(aPrefName); + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + }, + + getLocalizedUnicharPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getComplexValue(aPrefName, + Components.interfaces.nsIPrefLocalizedString).data; + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + } +}; + diff --git a/toolkit/obsolete/content/strres.js b/toolkit/obsolete/content/strres.js new file mode 100644 index 000000000..928c8f75f --- /dev/null +++ b/toolkit/obsolete/content/strres.js @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +var strBundleService = null; + +function srGetStrBundle(path) +{ + var strBundle = null; + + if (!strBundleService) { + try { + strBundleService = + Components.classes["@mozilla.org/intl/stringbundle;1"].getService(); + strBundleService = + strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService); + } catch (ex) { + dump("\n--** strBundleService failed: " + ex + "\n"); + return null; + } + } + + strBundle = strBundleService.createBundle(path); + if (!strBundle) { + dump("\n--** strBundle createInstance failed **--\n"); + } + return strBundle; +} diff --git a/toolkit/obsolete/jar.mn b/toolkit/obsolete/jar.mn new file mode 100644 index 000000000..95d86da2f --- /dev/null +++ b/toolkit/obsolete/jar.mn @@ -0,0 +1,12 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +toolkit.jar: + content/global/globalOverlay.xul (content/globalOverlay.xul) +* content/global/dialogOverlay.xul (content/dialogOverlay.xul) + content/global/dialogOverlay.js (content/dialogOverlay.js) + content/global/inlineSpellCheckUI.js (content/inlineSpellCheckUI.js) + content/global/nsClipboard.js (content/nsClipboard.js) + content/global/nsUserSettings.js (content/nsUserSettings.js) + content/global/strres.js (content/strres.js) diff --git a/toolkit/obsolete/moz.build b/toolkit/obsolete/moz.build new file mode 100644 index 000000000..eb4454d28 --- /dev/null +++ b/toolkit/obsolete/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file |