From 6ac6136d17b86c79be227bd6255d42a52d40c959 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sat, 11 Jul 2020 10:57:01 -0400 Subject: Issue #618 - Remove eager instantiation - Debug follow up The added debug assertion did not take into account microtask refactoring done in BZ 1405821. Resulting in error: no member named 'IsInMicroTask' in 'nsContentUtils'. This resolves the error. --- dom/base/nsJSUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dom/base') diff --git a/dom/base/nsJSUtils.cpp b/dom/base/nsJSUtils.cpp index 65965d74b..2601ffd87 100644 --- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -315,7 +315,8 @@ nsJSUtils::ModuleInstantiate(JSContext* aCx, JS::Handle aModule) MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext()); MOZ_ASSERT(NS_IsMainThread()); - MOZ_ASSERT(nsContentUtils::IsInMicroTask()); + MOZ_ASSERT(CycleCollectedJSContext::Get() && + CycleCollectedJSContext::Get()->MicroTaskLevel()); NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK); -- cgit v1.2.3 From 08fb2f306856948ecc71974dd98c0a6d78df25aa Mon Sep 17 00:00:00 2001 From: Moonchild Date: Tue, 28 Jul 2020 15:46:41 +0000 Subject: Issue #1391 - Remove the DOM battery API --- dom/base/Navigator.cpp | 43 ------------------------------------------- dom/base/Navigator.h | 7 ------- dom/base/moz.build | 1 - 3 files changed, 51 deletions(-) (limited to 'dom/base') diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index a544f23c1..53ce2b30f 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -30,7 +30,6 @@ #include "nsUnicharUtils.h" #include "mozilla/Preferences.h" #include "mozilla/Telemetry.h" -#include "BatteryManager.h" #ifdef MOZ_GAMEPAD #include "mozilla/dom/GamepadServiceTest.h" #endif @@ -197,8 +196,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryPromise) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStorageManager) @@ -249,13 +246,6 @@ Navigator::Invalidate() mNotification = nullptr; } - if (mBatteryManager) { - mBatteryManager->Shutdown(); - mBatteryManager = nullptr; - } - - mBatteryPromise = nullptr; - if (mPowerManager) { mPowerManager->Shutdown(); mPowerManager = nullptr; @@ -1321,39 +1311,6 @@ Navigator::GetMozNotification(ErrorResult& aRv) return mNotification; } -//***************************************************************************** -// Navigator::nsINavigatorBattery -//***************************************************************************** - -Promise* -Navigator::GetBattery(ErrorResult& aRv) -{ - if (mBatteryPromise) { - return mBatteryPromise; - } - - if (!mWindow || !mWindow->GetDocShell()) { - aRv.Throw(NS_ERROR_UNEXPECTED); - return nullptr; - } - - nsCOMPtr go = do_QueryInterface(mWindow); - RefPtr batteryPromise = Promise::Create(go, aRv); - if (NS_WARN_IF(aRv.Failed())) { - return nullptr; - } - mBatteryPromise = batteryPromise; - - if (!mBatteryManager) { - mBatteryManager = new battery::BatteryManager(mWindow); - mBatteryManager->Init(); - } - - mBatteryPromise->MaybeResolve(mBatteryManager); - - return mBatteryPromise; -} - PowerManager* Navigator::GetMozPower(ErrorResult& aRv) { diff --git a/dom/base/Navigator.h b/dom/base/Navigator.h index 4ddaaabab..bcc67589e 100644 --- a/dom/base/Navigator.h +++ b/dom/base/Navigator.h @@ -51,10 +51,6 @@ namespace dom { class Permissions; -namespace battery { -class BatteryManager; -} // namespace battery - class Promise; class DesktopNotificationCenter; @@ -136,7 +132,6 @@ public: Permissions* GetPermissions(ErrorResult& aRv); // The XPCOM GetDoNotTrack is ok Geolocation* GetGeolocation(ErrorResult& aRv); - Promise* GetBattery(ErrorResult& aRv); static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue); @@ -269,8 +264,6 @@ private: RefPtr mPermissions; RefPtr mGeolocation; RefPtr mNotification; - RefPtr mBatteryManager; - RefPtr mBatteryPromise; RefPtr mPowerManager; RefPtr mConnection; #ifdef MOZ_AUDIO_CHANNEL_MANAGER diff --git a/dom/base/moz.build b/dom/base/moz.build index ded203c50..fe65453fe 100755 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -419,7 +419,6 @@ EXTRA_JS_MODULES += [ ] LOCAL_INCLUDES += [ - '../battery', '../events', '../media', '../network', -- cgit v1.2.3 From 3b0123aa12675decc11332704997e29a819eb8ff Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 29 Jul 2020 01:21:13 +0000 Subject: [network/dom] Improve sanitization of download filenames. --- dom/base/nsContentUtils.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'dom/base') diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 61d10e022..3568ced90 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -5123,6 +5123,14 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext, fileName.SetIsVoid(true); // No actionable download attribute was found. } + // Sanitize fileNames containing control characters by replacing them with + // underscores. + if (!fileName.IsVoid()) { + for (int i = 0; i < 32; i++) { + fileName.ReplaceChar(char16_t(i), '_'); + } + } + handler->OnLinkClick(aContent, aLinkURI, fileName.IsVoid() ? aTargetSpec.get() : EmptyString().get(), fileName, nullptr, nullptr, aIsTrusted, aContent->NodePrincipal()); -- cgit v1.2.3