diff options
Diffstat (limited to 'dom')
64 files changed, 44 insertions, 2101 deletions
diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index bd318f79e..f4d29376c 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -589,8 +589,10 @@ Animation::Tick() // during the *previous* tick of the refresh driver, it can still be // ahead of the *current* timeline time when we are using the // vsync timer so we need to clamp it to the timeline time. - mPendingReadyTime.SetValue(std::min(mTimeline->GetCurrentTime().Value(), - mPendingReadyTime.Value())); + TimeDuration currentTime = mTimeline->GetCurrentTime().Value(); + if (currentTime < mPendingReadyTime.Value()) { + mPendingReadyTime.SetValue(currentTime); + } FinishPendingAt(mPendingReadyTime.Value()); mPendingReadyTime.SetNull(); } diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 1e0c9562e..7a73fae71 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -18,11 +18,11 @@ #include "nsINode.h" // for base class #include "nsIScriptGlobalObject.h" // for member (in nsCOMPtr) #include "nsIServiceManager.h" +#include "nsIURI.h" // for use in inline functions #include "nsIUUIDGenerator.h" #include "nsPIDOMWindow.h" // for use in inline functions #include "nsPropertyTable.h" // for member -#include "nsDataHashtable.h" // for member -#include "nsURIHashKey.h" // for member +#include "nsTHashtable.h" // for member #include "mozilla/net/ReferrerPolicy.h" // for member #include "nsWeakReference.h" #include "mozilla/UseCounter.h" @@ -182,13 +182,6 @@ enum DocumentFlavor { DocumentFlavorPlain, // Just a Document }; -// Enum for HSTS priming states -enum class HSTSPrimingState { - eNO_HSTS_PRIMING = 0, // don't do HSTS Priming - eHSTS_PRIMING_ALLOW = 1, // if HSTS priming fails, allow the load to proceed - eHSTS_PRIMING_BLOCK = 2 // if HSTS priming fails, block the load -}; - // Document states // RTL locale: specific to the XUL localedir attribute @@ -406,34 +399,6 @@ public: } /** - * Check to see if a subresource we want to load requires HSTS priming - * to be done. - */ - HSTSPrimingState GetHSTSPrimingStateForLocation(nsIURI* aContentLocation) const - { - HSTSPrimingState state; - if (mHSTSPrimingURIList.Get(aContentLocation, &state)) { - return state; - } - return HSTSPrimingState::eNO_HSTS_PRIMING; - } - - /** - * Add a subresource to the HSTS priming list. If this URI is - * not in the HSTS cache, it will trigger an HSTS priming request - * when we try to load it. - */ - void AddHSTSPrimingLocation(nsIURI* aContentLocation, HSTSPrimingState aState) - { - mHSTSPrimingURIList.Put(aContentLocation, aState); - } - - void ClearHSTSPrimingLocation(nsIURI* aContentLocation) - { - mHSTSPrimingURIList.Remove(aContentLocation); - } - - /** * Set the principal responsible for this document. */ virtual void SetPrincipal(nsIPrincipal *aPrincipal) = 0; @@ -2987,11 +2952,6 @@ protected: bool mUpgradeInsecureRequests; bool mUpgradeInsecurePreloads; - // if nsMixedContentBlocker requires sending an HSTS priming request, - // temporarily store that in the document so that it can be propogated to the - // LoadInfo and eventually the HTTP Channel - nsDataHashtable<nsURIHashKey, HSTSPrimingState> mHSTSPrimingURIList; - mozilla::WeakPtr<nsDocShell> mDocumentContainer; nsCString mCharacterSet; diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 576f3052a..3be1a6d2f 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1006,110 +1006,6 @@ nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv) return NS_OK; } -#ifdef MOZ_JPROF - -#include <signal.h> - -inline bool -IsJProfAction(struct sigaction *action) -{ - return (action->sa_sigaction && - (action->sa_flags & (SA_RESTART | SA_SIGINFO)) == (SA_RESTART | SA_SIGINFO)); -} - -void NS_JProfStartProfiling(); -void NS_JProfStopProfiling(); -void NS_JProfClearCircular(); - -static bool -JProfStartProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - NS_JProfStartProfiling(); - return true; -} - -void NS_JProfStartProfiling() -{ - // Figure out whether we're dealing with SIGPROF, SIGALRM, or - // SIGPOLL profiling (SIGALRM for JP_REALTIME, SIGPOLL for - // JP_RTC_HZ) - struct sigaction action; - - // Must check ALRM before PROF since both are enabled for real-time - sigaction(SIGALRM, nullptr, &action); - //printf("SIGALRM: %p, flags = %x\n",action.sa_sigaction,action.sa_flags); - if (IsJProfAction(&action)) { - //printf("Beginning real-time jprof profiling.\n"); - raise(SIGALRM); - return; - } - - sigaction(SIGPROF, nullptr, &action); - //printf("SIGPROF: %p, flags = %x\n",action.sa_sigaction,action.sa_flags); - if (IsJProfAction(&action)) { - //printf("Beginning process-time jprof profiling.\n"); - raise(SIGPROF); - return; - } - - sigaction(SIGPOLL, nullptr, &action); - //printf("SIGPOLL: %p, flags = %x\n",action.sa_sigaction,action.sa_flags); - if (IsJProfAction(&action)) { - //printf("Beginning rtc-based jprof profiling.\n"); - raise(SIGPOLL); - return; - } - - printf("Could not start jprof-profiling since JPROF_FLAGS was not set.\n"); -} - -static bool -JProfStopProfilingJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - NS_JProfStopProfiling(); - return true; -} - -void -NS_JProfStopProfiling() -{ - raise(SIGUSR1); - //printf("Stopped jprof profiling.\n"); -} - -static bool -JProfClearCircularJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - NS_JProfClearCircular(); - return true; -} - -void -NS_JProfClearCircular() -{ - raise(SIGUSR2); - //printf("cleared jprof buffer\n"); -} - -static bool -JProfSaveCircularJS(JSContext *cx, unsigned argc, JS::Value *vp) -{ - // Not ideal... - NS_JProfStopProfiling(); - NS_JProfStartProfiling(); - return true; -} - -static const JSFunctionSpec JProfFunctions[] = { - JS_FS("JProfStartProfiling", JProfStartProfilingJS, 0, 0), - JS_FS("JProfStopProfiling", JProfStopProfilingJS, 0, 0), - JS_FS("JProfClearCircular", JProfClearCircularJS, 0, 0), - JS_FS("JProfSaveCircular", JProfSaveCircularJS, 0, 0), - JS_FS_END -}; - -#endif /* defined(MOZ_JPROF) */ - nsresult nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj) { @@ -1121,11 +1017,6 @@ nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj) // Attempt to initialize profiling functions ::JS_DefineProfilingFunctions(cx, aGlobalObj); -#ifdef MOZ_JPROF - // Attempt to initialize JProf functions - ::JS_DefineFunctions(cx, aGlobalObj, JProfFunctions); -#endif - return NS_OK; } diff --git a/dom/base/test/bug704320.sjs b/dom/base/test/bug704320.sjs index dff77f4b3..e0f549533 100644 --- a/dom/base/test/bug704320.sjs +++ b/dom/base/test/bug704320.sjs @@ -194,12 +194,6 @@ function createPolicyTest(policy, optionalEarlierPolicy) { } function handleRequest(request, response) { - if (request.method == 'HEAD') { - // respond to a HEAD request with a 418 so that we can easily distinguish - // HSTS priming responses and ignore them - response.setStatusLine('1.1', 418, "I'm a teapot"); - return; - } var sharedKey = 'bug704320.sjs'; var params = request.queryString.split('&'); var action = params[0].split('=')[1]; diff --git a/dom/base/test/referrerHelper.js b/dom/base/test/referrerHelper.js index 207bf5f15..01a22829c 100644 --- a/dom/base/test/referrerHelper.js +++ b/dom/base/test/referrerHelper.js @@ -25,9 +25,6 @@ function doXHR(url, onSuccess, onFail) { xhr.onload = function () { if (xhr.status == 200) { onSuccess(xhr); - } else if (xhr.status == 418) { - // Ignore HSTS priming responses - return; } else { onFail(xhr); } diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 2a92084b4..32eed6354 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -9,7 +9,6 @@ #include "AccessCheck.h" #include "gfxContext.h" -#include "gfxCrashReporterUtils.h" #include "gfxPattern.h" #include "gfxPrefs.h" #include "gfxUtils.h" @@ -956,7 +955,6 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight) // Alright, now let's start trying. bool forceEnabled = gfxPrefs::WebGLForceEnabled(); - ScopedGfxFeatureReporter reporter("WebGL", forceEnabled); MOZ_ASSERT(!gl); std::vector<FailureReason> failReasons; @@ -1087,8 +1085,6 @@ WebGLContext::SetDimensions(int32_t signedWidth, int32_t signedHeight) ////// - reporter.SetSuccessful(); - failureId = NS_LITERAL_CSTRING("SUCCESS"); return NS_OK; } diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp index bc17afae3..c119a503e 100644 --- a/dom/fetch/Request.cpp +++ b/dom/fetch/Request.cpp @@ -327,7 +327,7 @@ Request::Constructor(const GlobalObject& aGlobal, RequestCache fallbackCache = RequestCache::EndGuard_; if (aInput.IsUSVString()) { fallbackMode = RequestMode::Cors; - fallbackCredentials = RequestCredentials::Omit; + fallbackCredentials = RequestCredentials::Same_origin; fallbackCache = RequestCache::Default; } diff --git a/dom/html/test/test_anchor_ping.html b/dom/html/test/test_anchor_ping.html index 4a39bcefe..6a1832ad1 100644 --- a/dom/html/test/test_anchor_ping.html +++ b/dom/html/test/test_anchor_ping.html @@ -40,15 +40,10 @@ let tests = [ function* setup() { Services.prefs.setBoolPref("browser.send_pings", true); Services.prefs.setIntPref("browser.send_pings.max_per_link", -1); - Services.prefs.setBoolPref("security.mixed_content.block_active_content", false); - // The server we create can't handle the priming HEAD requests - Services.prefs.setBoolPref("security.mixed_content.send_hsts_priming", false); SimpleTest.registerCleanupFunction(() => { Services.prefs.clearUserPref("browser.send_pings"); Services.prefs.clearUserPref("browser.send_pings.max_per_link"); - Services.prefs.clearUserPref("security.mixed_content.block_active_content"); - Services.prefs.clearUserPref("security.mixed_content.send_hsts_priming"); }); }, @@ -151,7 +146,7 @@ let tests = [ // The referrer will be loaded using a secure channel. navigate("https://example.com/chrome/dom/html/test/" + - "file_anchor_ping.html?" + "http://localhost:" + + "file_anchor_ping.html?" + "http://127.0.0.1:" + server.identity.primaryPort + ping); // Wait until the ping has been sent. diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 9678fb49f..4e1b9f7af 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -13470,10 +13470,6 @@ nsresult ConnectionPool:: ThreadRunnable::Run() { -#ifdef MOZ_ENABLE_PROFILER_SPS - char stackTopGuess; -#endif // MOZ_ENABLE_PROFILER_SPS - MOZ_ASSERT(!IsOnBackgroundThread()); MOZ_ASSERT(mContinueRunning); @@ -13490,10 +13486,6 @@ ThreadRunnable::Run() const nsPrintfCString threadName("IndexedDB #%lu", mSerialNumber); PR_SetCurrentThreadName(threadName.get()); - -#ifdef MOZ_ENABLE_PROFILER_SPS - profiler_register_thread(threadName.get(), &stackTopGuess); -#endif // MOZ_ENABLE_PROFILER_SPS } { @@ -13537,10 +13529,6 @@ ThreadRunnable::Run() } } -#ifdef MOZ_ENABLE_PROFILER_SPS - profiler_unregister_thread(); -#endif // MOZ_ENABLE_PROFILER_SPS - return NS_OK; } diff --git a/dom/indexedDB/IndexedDatabaseManager.cpp b/dom/indexedDB/IndexedDatabaseManager.cpp index f65381fe8..62ba51c08 100644 --- a/dom/indexedDB/IndexedDatabaseManager.cpp +++ b/dom/indexedDB/IndexedDatabaseManager.cpp @@ -153,7 +153,7 @@ const char kPrefMaxSerilizedMsgSize[] = IDB_PREF_BRANCH_ROOT "maxSerializedMsgSi const char kPrefLoggingEnabled[] = IDB_PREF_LOGGING_BRANCH_ROOT "enabled"; const char kPrefLoggingDetails[] = IDB_PREF_LOGGING_BRANCH_ROOT "details"; -#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS) +#if defined(DEBUG) const char kPrefLoggingProfiler[] = IDB_PREF_LOGGING_BRANCH_ROOT "profiler-marks"; #endif @@ -415,10 +415,7 @@ IndexedDatabaseManager::Init() Preferences::RegisterCallback(LoggingModePrefChangedCallback, kPrefLoggingDetails); -#ifdef MOZ_ENABLE_PROFILER_SPS - Preferences::RegisterCallback(LoggingModePrefChangedCallback, - kPrefLoggingProfiler); -#endif + Preferences::RegisterCallbackAndCall(LoggingModePrefChangedCallback, kPrefLoggingEnabled); @@ -479,10 +476,6 @@ IndexedDatabaseManager::Destroy() Preferences::UnregisterCallback(LoggingModePrefChangedCallback, kPrefLoggingDetails); -#ifdef MOZ_ENABLE_PROFILER_SPS - Preferences::UnregisterCallback(LoggingModePrefChangedCallback, - kPrefLoggingProfiler); -#endif Preferences::UnregisterCallback(LoggingModePrefChangedCallback, kPrefLoggingEnabled); @@ -1060,15 +1053,13 @@ IndexedDatabaseManager::LoggingModePrefChangedCallback( } bool useProfiler = -#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS) +#if defined(DEBUG) Preferences::GetBool(kPrefLoggingProfiler); -#if !defined(MOZ_ENABLE_PROFILER_SPS) if (useProfiler) { NS_WARNING("IndexedDB cannot create profiler marks because this build does " "not have profiler extensions enabled!"); useProfiler = false; } -#endif #else false; #endif diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 9e1c7e8cb..fc288e2c5 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -11,7 +11,6 @@ #include "ContentChild.h" #include "BlobChild.h" -#include "CrashReporterChild.h" #include "GeckoProfiler.h" #include "TabChild.h" #include "HandlerServiceChild.h" @@ -32,7 +31,6 @@ #include "mozilla/dom/ExternalHelperAppChild.h" #include "mozilla/dom/FlyWebPublishedServerIPC.h" #include "mozilla/dom/GetFilesHelper.h" -#include "mozilla/dom/PCrashReporterChild.h" #include "mozilla/dom/ProcessGlobal.h" #include "mozilla/dom/PushNotifier.h" #include "mozilla/dom/workers/ServiceWorkerManager.h" @@ -535,8 +533,7 @@ ContentChild::Init(MessageLoop* aIOLoop, NS_ASSERTION(!sSingleton, "only one ContentChild per child"); // Once we start sending IPC messages, we need the thread manager to be - // initialized so we can deal with the responses. Do that here before we - // try to construct the crash reporter. + // initialized so we can deal with the responses. Do that here. nsresult rv = nsThreadManager::get().Init(); if (NS_WARN_IF(NS_FAILED(rv))) { return false; @@ -1497,19 +1494,6 @@ ContentChild::RecvNotifyEmptyHTTPCache() return true; } -PCrashReporterChild* -ContentChild::AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id, - const uint32_t& processType) -{ - return nullptr; -} - -bool -ContentChild::DeallocPCrashReporterChild(PCrashReporterChild* crashreporter) -{ - delete crashreporter; - return true; -} PHalChild* ContentChild::AllocPHalChild() @@ -2420,61 +2404,6 @@ ContentChild::DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* actor) } bool -ContentChild::RecvStartProfiler(const ProfilerInitParams& params) -{ - nsTArray<const char*> featureArray; - for (size_t i = 0; i < params.features().Length(); ++i) { - featureArray.AppendElement(params.features()[i].get()); - } - - nsTArray<const char*> threadNameFilterArray; - for (size_t i = 0; i < params.threadFilters().Length(); ++i) { - threadNameFilterArray.AppendElement(params.threadFilters()[i].get()); - } - - profiler_start(params.entries(), params.interval(), - featureArray.Elements(), featureArray.Length(), - threadNameFilterArray.Elements(), - threadNameFilterArray.Length()); - - return true; -} - -bool -ContentChild::RecvStopProfiler() -{ - profiler_stop(); - return true; -} - -bool -ContentChild::RecvPauseProfiler(const bool& aPause) -{ - if (aPause) { - profiler_pause(); - } else { - profiler_resume(); - } - - return true; -} - -bool -ContentChild::RecvGatherProfile() -{ - nsCString profileCString; - UniquePtr<char[]> profile = profiler_get_profile(); - if (profile) { - profileCString = nsCString(profile.get(), strlen(profile.get())); - } else { - profileCString = EmptyCString(); - } - - Unused << SendProfile(profileCString); - return true; -} - -bool ContentChild::RecvLoadPluginResult(const uint32_t& aPluginId, const bool& aResult) { @@ -2628,15 +2557,6 @@ ContentChild::RecvShutdown() GetIPCChannel()->SetAbortOnError(false); -#ifdef MOZ_ENABLE_PROFILER_SPS - if (profiler_is_active()) { - // We're shutting down while we were profiling. Send the - // profile up to the parent so that we don't lose this - // information. - Unused << RecvGatherProfile(); - } -#endif - // Start a timer that will insure we quickly exit after a reasonable // period of time. Prevents shutdown hangs after our connection to the // parent closes. diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index c78f951f0..ba590b58e 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -186,13 +186,6 @@ public: virtual bool DeallocPBlobChild(PBlobChild* aActor) override; - virtual PCrashReporterChild* - AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id, - const uint32_t& processType) override; - - virtual bool - DeallocPCrashReporterChild(PCrashReporterChild*) override; - virtual PHalChild* AllocPHalChild() override; virtual bool DeallocPHalChild(PHalChild*) override; @@ -461,14 +454,6 @@ public: virtual bool RecvUpdateWindow(const uintptr_t& aChildId) override; - virtual bool RecvStartProfiler(const ProfilerInitParams& params) override; - - virtual bool RecvPauseProfiler(const bool& aPause) override; - - virtual bool RecvStopProfiler() override; - - virtual bool RecvGatherProfile() override; - virtual bool RecvDomainSetChanged(const uint32_t& aSetType, const uint32_t& aChangeType, const OptionalURIParams& aDomain) override; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 8b9ab4442..3488e26bd 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -22,7 +22,6 @@ #include "AppProcessChecker.h" #include "AudioChannelService.h" #include "BlobParent.h" -#include "CrashReporterParent.h" #include "GMPServiceParent.h" #include "HandlerServiceParent.h" #include "IHistory.h" @@ -82,9 +81,6 @@ #include "mozilla/Preferences.h" #include "mozilla/ProcessHangMonitor.h" #include "mozilla/ProcessHangMonitorIPC.h" -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "mozilla/ProfileGatherer.h" -#endif #include "mozilla/ScopeExit.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" @@ -221,11 +217,6 @@ #include "nsIBrowserSearchService.h" #endif -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "nsIProfiler.h" -#include "nsIProfileSaveEvent.h" -#endif - #ifdef XP_WIN #include "mozilla/widget/AudioSession.h" #endif @@ -246,9 +237,6 @@ extern const char* kForceEnableE10sPref; using base::ChildPrivileges; using base::KillProcess; -#ifdef MOZ_ENABLE_PROFILER_SPS -using mozilla::ProfileGatherer; -#endif using namespace mozilla::dom::power; using namespace mozilla::media; @@ -516,14 +504,6 @@ static const char* sObserverTopics[] = { #ifdef ACCESSIBILITY "a11y-init-or-shutdown", #endif -#ifdef MOZ_ENABLE_PROFILER_SPS - "profiler-started", - "profiler-stopped", - "profiler-paused", - "profiler-resumed", - "profiler-subprocess-gather", - "profiler-subprocess", -#endif "cacheservice:empty-cache", }; @@ -1306,26 +1286,6 @@ ContentParent::Init() } #endif -#ifdef MOZ_ENABLE_PROFILER_SPS - nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1")); - bool profilerActive = false; - DebugOnly<nsresult> rv = profiler->IsActive(&profilerActive); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - if (profilerActive) { - nsCOMPtr<nsIProfilerStartParams> currentProfilerParams; - rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - nsCOMPtr<nsISupports> gatherer; - rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - mGatherer = static_cast<ProfileGatherer*>(gatherer.get()); - - StartProfiler(currentProfilerParams); - } -#endif - RefPtr<GeckoMediaPluginServiceParent> gmps(GeckoMediaPluginServiceParent::GetSingleton()); gmps->UpdateContentProcessGMPCapabilities(); } @@ -1752,12 +1712,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why) mConsoleService = nullptr; -#ifdef MOZ_ENABLE_PROFILER_SPS - if (mGatherer && !mProfile.IsEmpty()) { - mGatherer->OOPExitProfile(mProfile); - } -#endif - if (obs) { RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag(); @@ -2557,27 +2511,6 @@ ContentParent::Observe(nsISupports* aSubject, NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess"); } -#ifdef MOZ_ENABLE_PROFILER_SPS - // Need to do this before the mIsAlive check to avoid missing profiles. - if (!strcmp(aTopic, "profiler-subprocess-gather")) { - if (mGatherer) { - mGatherer->WillGatherOOPProfile(); - if (mIsAlive && mSubprocess) { - Unused << SendGatherProfile(); - } - } - } - else if (!strcmp(aTopic, "profiler-subprocess")) { - nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject); - if (pse) { - if (!mProfile.IsEmpty()) { - pse->AddSubProfile(mProfile.get()); - mProfile.Truncate(); - } - } - } -#endif - if (!mIsAlive || !mSubprocess) return NS_OK; @@ -2664,22 +2597,6 @@ ContentParent::Observe(nsISupports* aSubject, } } #endif -#ifdef MOZ_ENABLE_PROFILER_SPS - else if (!strcmp(aTopic, "profiler-started")) { - nsCOMPtr<nsIProfilerStartParams> params(do_QueryInterface(aSubject)); - StartProfiler(params); - } - else if (!strcmp(aTopic, "profiler-stopped")) { - mGatherer = nullptr; - Unused << SendStopProfiler(); - } - else if (!strcmp(aTopic, "profiler-paused")) { - Unused << SendPauseProfiler(true); - } - else if (!strcmp(aTopic, "profiler-resumed")) { - Unused << SendPauseProfiler(false); - } -#endif else if (!strcmp(aTopic, "cacheservice:empty-cache")) { Unused << SendNotifyEmptyHTTPCache(); } @@ -2953,29 +2870,6 @@ ContentParent::FriendlyName(nsAString& aName, bool aAnonymize) } } -PCrashReporterParent* -ContentParent::AllocPCrashReporterParent(const NativeThreadId& tid, - const uint32_t& processType) -{ - return nullptr; -} - -bool -ContentParent::RecvPCrashReporterConstructor(PCrashReporterParent* actor, - const NativeThreadId& tid, - const uint32_t& processType) -{ - static_cast<CrashReporterParent*>(actor)->SetChildData(tid, processType); - return true; -} - -bool -ContentParent::DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) -{ - delete crashreporter; - return true; -} - hal_sandbox::PHalParent* ContentParent::AllocPHalParent() { @@ -3479,13 +3373,13 @@ ContentParent::RecvIsSecureURI(const uint32_t& type, } bool -ContentParent::RecvAccumulateMixedContentHSTS(const URIParams& aURI, const bool& aActive, const bool& aHSTSPriming) +ContentParent::RecvAccumulateMixedContentHSTS(const URIParams& aURI, const bool& aActive) { nsCOMPtr<nsIURI> ourURI = DeserializeURI(aURI); if (!ourURI) { return false; } - nsMixedContentBlocker::AccumulateMixedContentHSTS(ourURI, aActive, aHSTSPriming); + nsMixedContentBlocker::AccumulateMixedContentHSTS(ourURI, aActive); return true; } @@ -4581,19 +4475,6 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab, } bool -ContentParent::RecvProfile(const nsCString& aProfile) -{ -#ifdef MOZ_ENABLE_PROFILER_SPS - if (NS_WARN_IF(!mGatherer)) { - return true; - } - mProfile = aProfile; - mGatherer->GatheredOOPProfile(); -#endif - return true; -} - -bool ContentParent::RecvGetGraphicsDeviceInitData(ContentDeviceData* aOut) { gfxPlatform::GetPlatform()->BuildContentDeviceData(aOut); @@ -4679,34 +4560,6 @@ ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName, return true; } -void -ContentParent::StartProfiler(nsIProfilerStartParams* aParams) -{ -#ifdef MOZ_ENABLE_PROFILER_SPS - if (NS_WARN_IF(!aParams)) { - return; - } - - ProfilerInitParams ipcParams; - - ipcParams.enabled() = true; - aParams->GetEntries(&ipcParams.entries()); - aParams->GetInterval(&ipcParams.interval()); - ipcParams.features() = aParams->GetFeatures(); - ipcParams.threadFilters() = aParams->GetThreadFilterNames(); - - Unused << SendStartProfiler(ipcParams); - - nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1")); - if (NS_WARN_IF(!profiler)) { - return; - } - nsCOMPtr<nsISupports> gatherer; - profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - mGatherer = static_cast<ProfileGatherer*>(gatherer.get()); -#endif -} - bool ContentParent::RecvNotifyPushObservers(const nsCString& aScope, const IPC::Principal& aPrincipal, diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 3f74b10e1..abcea0b65 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -42,9 +42,6 @@ class nsIWidget; namespace mozilla { class PRemoteSpellcheckEngineParent; -#ifdef MOZ_ENABLE_PROFILER_SPS -class ProfileGatherer; -#endif namespace embedding { class PrintingParent; @@ -372,15 +369,6 @@ public: virtual void OnChannelError() override; - virtual PCrashReporterParent* - AllocPCrashReporterParent(const NativeThreadId& tid, - const uint32_t& processType) override; - - virtual bool - RecvPCrashReporterConstructor(PCrashReporterParent* actor, - const NativeThreadId& tid, - const uint32_t& processType) override; - virtual PNeckoParent* AllocPNeckoParent() override; virtual bool RecvPNeckoConstructor(PNeckoParent* aActor) override @@ -735,9 +723,6 @@ private: RecvPBlobConstructor(PBlobParent* aActor, const BlobConstructorParams& params) override; - virtual bool - DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) override; - virtual bool RecvNSSU2FTokenIsCompatibleVersion(const nsString& aVersion, bool* aIsCompatible) override; @@ -757,8 +742,7 @@ private: const uint32_t& aFlags, bool* aIsSecureURI) override; virtual bool RecvAccumulateMixedContentHSTS(const URIParams& aURI, - const bool& aActive, - const bool& aHSTSPriming) override; + const bool& aActive) override; virtual bool DeallocPHalParent(PHalParent*) override; @@ -1030,12 +1014,8 @@ private: virtual bool RecvUpdateDropEffect(const uint32_t& aDragAction, const uint32_t& aDropEffect) override; - virtual bool RecvProfile(const nsCString& aProfile) override; - virtual bool RecvGetGraphicsDeviceInitData(ContentDeviceData* aOut) override; - void StartProfiler(nsIProfilerStartParams* aParams); - virtual bool RecvGetAndroidSystemInfo(AndroidSystemInfo* aInfo) override; virtual bool RecvNotifyBenchmarkResult(const nsString& aCodecName, @@ -1140,9 +1120,6 @@ private: PProcessHangMonitorParent* mHangMonitorActor; -#ifdef MOZ_ENABLE_PROFILER_SPS - RefPtr<mozilla::ProfileGatherer> mGatherer; -#endif nsCString mProfile; UniquePtr<gfx::DriverCrashGuard> mDriverCrashGuard; diff --git a/dom/ipc/CrashReporterChild.cpp b/dom/ipc/CrashReporterChild.cpp deleted file mode 100644 index 8174452e7..000000000 --- a/dom/ipc/CrashReporterChild.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ -#include "mozilla/plugins/PluginModuleChild.h" -#include "ContentChild.h" -#include "CrashReporterChild.h" -#include "nsXULAppAPI.h" - -using mozilla::plugins::PluginModuleChild; - -namespace mozilla { -namespace dom { - -/*static*/ -PCrashReporterChild* -CrashReporterChild::GetCrashReporter() -{ - const ManagedContainer<PCrashReporterChild>* reporters = nullptr; - switch (XRE_GetProcessType()) { - case GeckoProcessType_Content: { - ContentChild* child = ContentChild::GetSingleton(); - reporters = &child->ManagedPCrashReporterChild(); - break; - } - case GeckoProcessType_Plugin: { - PluginModuleChild* child = PluginModuleChild::GetChrome(); - reporters = &child->ManagedPCrashReporterChild(); - break; - } - default: - break; - } - if (!reporters) { - return nullptr; - } - return LoneManagedOrNullAsserts(*reporters); -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/ipc/CrashReporterChild.h b/dom/ipc/CrashReporterChild.h deleted file mode 100644 index 96355ca11..000000000 --- a/dom/ipc/CrashReporterChild.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_dom_CrashReporterChild_h -#define mozilla_dom_CrashReporterChild_h - -#include "mozilla/dom/PCrashReporterChild.h" - -namespace mozilla { -namespace dom { - -class CrashReporterChild : - public PCrashReporterChild -{ -public: - CrashReporterChild() { - MOZ_COUNT_CTOR(CrashReporterChild); - } - ~CrashReporterChild() { - MOZ_COUNT_DTOR(CrashReporterChild); - } - - static PCrashReporterChild* GetCrashReporter(); -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_CrashReporterChild_h diff --git a/dom/ipc/CrashReporterParent.cpp b/dom/ipc/CrashReporterParent.cpp deleted file mode 100644 index 677b29670..000000000 --- a/dom/ipc/CrashReporterParent.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ -#include "CrashReporterParent.h" -#include "mozilla/Sprintf.h" -#include "mozilla/dom/ContentParent.h" -#include "mozilla/ipc/CrashReporterHost.h" -#include "nsAutoPtr.h" -#include "nsXULAppAPI.h" -#include <time.h> - -#include "mozilla/Telemetry.h" - -namespace mozilla { -namespace dom { - -using namespace mozilla::ipc; - -void -CrashReporterParent::AnnotateCrashReport(const nsCString& key, - const nsCString& data) -{ -} - -void -CrashReporterParent::ActorDestroy(ActorDestroyReason aWhy) -{ - // Implement me! Bug 1005155 -} - -bool -CrashReporterParent::RecvAppendAppNotes(const nsCString& data) -{ - mAppNotes.Append(data); - return true; -} - -CrashReporterParent::CrashReporterParent() - : - mStartTime(::time(nullptr)) - , mInitialized(false) -{ - MOZ_COUNT_CTOR(CrashReporterParent); -} - -CrashReporterParent::~CrashReporterParent() -{ - MOZ_COUNT_DTOR(CrashReporterParent); -} - -void -CrashReporterParent::SetChildData(const NativeThreadId& tid, - const uint32_t& processType) -{ - mInitialized = true; - mMainThread = tid; - mProcessType = GeckoProcessType(processType); -} - -} // namespace dom -} // namespace mozilla diff --git a/dom/ipc/CrashReporterParent.h b/dom/ipc/CrashReporterParent.h deleted file mode 100644 index 71896c5c1..000000000 --- a/dom/ipc/CrashReporterParent.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_dom_CrashReporterParent_h -#define mozilla_dom_CrashReporterParent_h - -#include "mozilla/dom/PCrashReporterParent.h" -#include "mozilla/dom/TabMessageUtils.h" -#include "nsIFile.h" - -namespace mozilla { -namespace dom { - -class CrashReporterParent : public PCrashReporterParent -{ -public: - CrashReporterParent(); - virtual ~CrashReporterParent(); - - /* - * Initialize this reporter with data from the child process. - */ - void - SetChildData(const NativeThreadId& id, const uint32_t& processType); - - /* - * Returns the ID of the child minidump. - * GeneratePairedMinidump or GenerateCrashReport must be called first. - */ - const nsString& ChildDumpID() const { - return mChildDumpID; - } - - /* - * Add an annotation to our internally tracked list of annotations. - * Callers must apply these notes using GenerateChildData otherwise - * the notes will get dropped. - */ - void - AnnotateCrashReport(const nsCString& aKey, const nsCString& aData); - - protected: - virtual void ActorDestroy(ActorDestroyReason aWhy) override; - - virtual bool RecvAnnotateCrashReport(const nsCString& aKey, - const nsCString& aData) override - { - AnnotateCrashReport(aKey, aData); - return true; - } - - virtual bool RecvAppendAppNotes(const nsCString& aData) override; - - nsCString mAppNotes; - nsString mChildDumpID; - // stores the child main thread id - NativeThreadId mMainThread; - time_t mStartTime; - // stores the child process type - GeckoProcessType mProcessType; - bool mInitialized; -}; - -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_CrashReporterParent_h diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index d436c19fe..c01ad59c1 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -11,7 +11,6 @@ include protocol PCompositorBridge; include protocol PContentBridge; include protocol PContentPermissionRequest; include protocol PCycleCollectWithLogs; -include protocol PCrashReporter; include protocol PPSMContentDownloader; include protocol PExternalHelperApp; include protocol PHandlerService; @@ -243,7 +242,6 @@ nested(upto inside_cpow) sync protocol PContent manages PBlob; manages PBrowser; manages PContentPermissionRequest; - manages PCrashReporter; manages PCycleCollectWithLogs; manages PPSMContentDownloader; manages PExternalHelperApp; @@ -466,15 +464,6 @@ child: */ async LoadPluginResult(uint32_t aPluginId, bool aResult); - /** - * Control the Gecko Profiler in the child process. - */ - async StartProfiler(ProfilerInitParams params); - async StopProfiler(); - async PauseProfiler(bool aPause); - - async GatherProfile(); - async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action); async EndDragSession(bool aDoneDrag, bool aUserCancelled, @@ -625,8 +614,6 @@ parent: async PRemoteSpellcheckEngine(); - sync PCrashReporter(NativeThreadId tid, uint32_t processType); - /** * Is this token compatible with the provided version? * @@ -674,7 +661,7 @@ parent: sync IsSecureURI(uint32_t type, URIParams uri, uint32_t flags) returns (bool isSecureURI); - async AccumulateMixedContentHSTS(URIParams uri, bool active, bool hasHSTSPriming); + async AccumulateMixedContentHSTS(URIParams uri, bool active); sync GetLookAndFeelCache() returns (LookAndFeelInt[] lookAndFeelIntCache); @@ -962,8 +949,6 @@ parent: async PContentPermissionRequest(PermissionRequest[] aRequests, Principal aPrincipal, TabId tabId); - async Profile(nsCString aProfile); - /** * Request graphics initialization information from the parent. */ diff --git a/dom/ipc/PCrashReporter.ipdl b/dom/ipc/PCrashReporter.ipdl deleted file mode 100644 index 8f965f2ee..000000000 --- a/dom/ipc/PCrashReporter.ipdl +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * vim: set sw=4 ts=8 et tw=80 : - * 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/. */ - -include protocol PContent; -include protocol PPluginModule; -include protocol PGMP; - -namespace mozilla { -namespace dom { - -struct Mapping { - nsCString library_name; - nsCString file_id; - uintptr_t start_address; - size_t mapping_length; - size_t file_offset; -}; - -async protocol PCrashReporter { - manager PContent or PPluginModule or PGMP; -parent: - async AnnotateCrashReport(nsCString key, nsCString data); - async AppendAppNotes(nsCString data); - async __delete__(); -}; - -} -} diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index c34ac5d48..5629ab2c6 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -26,8 +26,6 @@ EXPORTS.mozilla.dom += [ 'ContentProcess.h', 'ContentProcessManager.h', 'CPOWManagerGetter.h', - 'CrashReporterChild.h', - 'CrashReporterParent.h', 'FilePickerParent.h', 'nsIContentChild.h', 'nsIContentParent.h', @@ -54,7 +52,6 @@ UNIFIED_SOURCES += [ 'ContentParent.cpp', 'ContentProcess.cpp', 'ContentProcessManager.cpp', - 'CrashReporterParent.cpp', 'FilePickerParent.cpp', 'nsIContentChild.cpp', 'nsIContentParent.cpp', @@ -70,13 +67,10 @@ UNIFIED_SOURCES += [ ] # Blob.cpp cannot be compiled in unified mode because it triggers a fatal gcc warning. -# CrashReporterChild.cpp cannot be compiled in unified mode because of name clashes -# in OS X headers. # ContentChild.cpp cannot be compiled in unified mode on linux due to Time conflict SOURCES += [ 'Blob.cpp', 'ContentChild.cpp', - 'CrashReporterChild.cpp', 'ProcessHangMonitor.cpp', ] @@ -92,7 +86,6 @@ IPDL_SOURCES += [ 'PContentBridge.ipdl', 'PContentPermission.ipdlh', 'PContentPermissionRequest.ipdl', - 'PCrashReporter.ipdl', 'PCycleCollectWithLogs.ipdl', 'PFilePicker.ipdl', 'PMemoryReportRequest.ipdl', @@ -132,7 +125,6 @@ LOCAL_INCLUDES += [ '/layout/base', '/media/webrtc', '/netwerk/base', - '/toolkit/crashreporter', '/toolkit/xre', '/uriloader/exthandler', '/widget', diff --git a/dom/media/android/AndroidMediaPluginHost.cpp b/dom/media/android/AndroidMediaPluginHost.cpp index cc3adbbd3..d4c4fc59e 100644 --- a/dom/media/android/AndroidMediaPluginHost.cpp +++ b/dom/media/android/AndroidMediaPluginHost.cpp @@ -12,7 +12,6 @@ #include "nsXPCOMStrings.h" #include "nsISeekableStream.h" #include "nsIGfxInfo.h" -#include "gfxCrashReporterUtils.h" #include "prmem.h" #include "prlink.h" #include "AndroidMediaResourceServer.h" @@ -109,8 +108,6 @@ static bool IsOmxSupported() return false; } - ScopedGfxFeatureReporter reporter("Stagefright", forceEnabled); - if (!forceEnabled) { nsCOMPtr<nsIGfxInfo> gfxInfo = services::GetGfxInfo(); if (gfxInfo) { @@ -125,7 +122,6 @@ static bool IsOmxSupported() } } - reporter.SetSuccessful(); return true; } diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index f83a927ca..14b06cc72 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -18,7 +18,6 @@ #include "gmp-video-decode.h" #include "gmp-video-encode.h" #include "GMPPlatform.h" -#include "mozilla/dom/CrashReporterChild.h" #include "mozilla/ipc/ProcessChild.h" #include "GMPUtils.h" #include "prio.h" @@ -26,7 +25,6 @@ #include "widevine-adapter/WidevineAdapter.h" using namespace mozilla::ipc; -using mozilla::dom::CrashReporterChild; static const int MAX_VOUCHER_LENGTH = 500000; @@ -331,19 +329,6 @@ GMPChild::ProcessingError(Result aCode, const char* aReason) } } -mozilla::dom::PCrashReporterChild* -GMPChild::AllocPCrashReporterChild(const NativeThreadId& aThread) -{ - return new CrashReporterChild(); -} - -bool -GMPChild::DeallocPCrashReporterChild(PCrashReporterChild* aCrashReporter) -{ - delete aCrashReporter; - return true; -} - PGMPTimerChild* GMPChild::AllocPGMPTimerChild() { diff --git a/dom/media/gmp/GMPChild.h b/dom/media/gmp/GMPChild.h index a4f688901..722e4c7a9 100644 --- a/dom/media/gmp/GMPChild.h +++ b/dom/media/gmp/GMPChild.h @@ -52,9 +52,6 @@ private: bool AnswerStartPlugin(const nsString& aAdapter) override; bool RecvPreloadLibs(const nsCString& aLibs) override; - PCrashReporterChild* AllocPCrashReporterChild(const NativeThreadId& aThread) override; - bool DeallocPCrashReporterChild(PCrashReporterChild*) override; - PGMPTimerChild* AllocPGMPTimerChild() override; bool DeallocPGMPTimerChild(PGMPTimerChild* aActor) override; diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 851634ce7..40c3e5141 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -22,8 +22,6 @@ #include "MediaPrefs.h" #include "VideoUtils.h" -#include "mozilla/dom/CrashReporterParent.h" -using mozilla::dom::CrashReporterParent; using mozilla::ipc::GeckoChildProcessHost; #include "mozilla/Telemetry.h" @@ -580,22 +578,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy) } } -mozilla::dom::PCrashReporterParent* -GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread) -{ - MOZ_ASSERT(false, "Should only be sent if crash reporting is enabled."); - CrashReporterParent* cr = new CrashReporterParent(); - cr->SetChildData(aThread, GeckoProcessType_GMPlugin); - return cr; -} - -bool -GMPParent::DeallocPCrashReporterParent(PCrashReporterParent* aCrashReporter) -{ - delete aCrashReporter; - return true; -} - PGMPStorageParent* GMPParent::AllocPGMPStorageParent() { diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h index 4f91ec5ba..dacd6feeb 100644 --- a/dom/media/gmp/GMPParent.h +++ b/dom/media/gmp/GMPParent.h @@ -168,9 +168,6 @@ private: RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread. void ActorDestroy(ActorDestroyReason aWhy) override; - PCrashReporterParent* AllocPCrashReporterParent(const NativeThreadId& aThread) override; - bool DeallocPCrashReporterParent(PCrashReporterParent* aCrashReporter) override; - bool RecvPGMPStorageConstructor(PGMPStorageParent* actor) override; PGMPStorageParent* AllocPGMPStorageParent() override; bool DeallocPGMPStorageParent(PGMPStorageParent* aActor) override; diff --git a/dom/media/gmp/PGMP.ipdl b/dom/media/gmp/PGMP.ipdl index b421f0280..e1738d010 100644 --- a/dom/media/gmp/PGMP.ipdl +++ b/dom/media/gmp/PGMP.ipdl @@ -3,7 +3,6 @@ * 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/. */ -include protocol PCrashReporter; include protocol PGMPContent; include protocol PGMPTimer; include protocol PGMPStorage; @@ -17,12 +16,10 @@ intr protocol PGMP { parent opens PGMPContent; - manages PCrashReporter; manages PGMPTimer; manages PGMPStorage; parent: - async PCrashReporter(NativeThreadId tid); async PGMPTimer(); async PGMPStorage(); diff --git a/dom/media/ipc/VideoDecoderChild.cpp b/dom/media/ipc/VideoDecoderChild.cpp index d1b1d23fc..f01d3c659 100644 --- a/dom/media/ipc/VideoDecoderChild.cpp +++ b/dom/media/ipc/VideoDecoderChild.cpp @@ -238,6 +238,7 @@ VideoDecoderChild::Shutdown() SendShutdown(); } mInitialized = false; + mCallback = nullptr; } bool diff --git a/dom/media/ipc/VideoDecoderManagerParent.cpp b/dom/media/ipc/VideoDecoderManagerParent.cpp index a111b5e53..4ff9acf19 100644 --- a/dom/media/ipc/VideoDecoderManagerParent.cpp +++ b/dom/media/ipc/VideoDecoderManagerParent.cpp @@ -194,7 +194,7 @@ VideoDecoderManagerParent::RecvReadback(const SurfaceDescriptorGPUVideo& aSD, Su } RefPtr<SourceSurface> source = image->GetAsSourceSurface(); - if (!image) { + if (!source) { *aResult = null_t(); return true; } diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index 5267e9315..4ae37d7e9 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -390,7 +390,7 @@ private: "ftyp", "moov", // init segment "pdin", "free", "sidx", // optional prior moov box "styp", "moof", "mdat", // media segment - "mfra", "skip", "meta", "meco", "ssix", "prft" // others. + "mfra", "skip", "meta", "meco", "ssix", "prft", // others. "pssh", // optional with encrypted EME, though ignored. "emsg", // ISO23009-1:2014 Section 5.10.3.3 "bloc", "uuid" // boxes accepted by chrome. @@ -588,8 +588,8 @@ public: return false; } size_t header_length = have_crc ? 9 : 7; - size_t data_length = (((*aData)[3] & 0x03) << 11) || - (((*aData)[4] & 0xff) << 3) || + size_t data_length = (((*aData)[3] & 0x03) << 11) | + (((*aData)[4] & 0xff) << 3) | (((*aData)[5] & 0xe0) >> 5); uint8_t frames = ((*aData)[6] & 0x03) + 1; MOZ_ASSERT(frames > 0); diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index e7e1ca4a3..d03508411 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -1229,12 +1229,13 @@ already_AddRefed<MediaRawData> OpusState::PacketOutAsMediaRawData() { ogg_packet* packet = PacketPeek(); - uint32_t frames = 0; - const int64_t endFrame = packet->granulepos; - if (!packet) { return nullptr; } + + uint32_t frames = 0; + const int64_t endFrame = packet->granulepos; + if (packet->e_o_s) { frames = GetOpusDeltaGP(packet); } diff --git a/dom/media/platforms/wmf/DXVA2Manager.cpp b/dom/media/platforms/wmf/DXVA2Manager.cpp index 9fdb0fa20..0c1734c54 100644 --- a/dom/media/platforms/wmf/DXVA2Manager.cpp +++ b/dom/media/platforms/wmf/DXVA2Manager.cpp @@ -21,7 +21,6 @@ #include "MFTDecoder.h" #include "DriverCrashGuard.h" #include "nsPrintfCString.h" -#include "gfxCrashReporterUtils.h" #include "VideoUtils.h" const CLSID CLSID_VideoProcessorMFT = @@ -271,8 +270,6 @@ D3D9DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor, { MOZ_ASSERT(NS_IsMainThread()); - ScopedGfxFeatureReporter reporter("DXVA2D3D9"); - gfx::D3D9VideoCrashGuard crashGuard; if (crashGuard.Crashed()) { NS_WARNING("DXVA2D3D9 crash detected"); @@ -448,8 +445,6 @@ D3D9DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor, Telemetry::Accumulate(Telemetry::MEDIA_DECODER_BACKEND_USED, uint32_t(media::MediaDecoderBackend::WMFDXVA2D3D9)); - reporter.SetSuccessful(); - return S_OK; } @@ -645,8 +640,6 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor, { HRESULT hr; - ScopedGfxFeatureReporter reporter("DXVA2D3D11"); - gfx::D3D11VideoCrashGuard crashGuard; if (crashGuard.Crashed()) { NS_WARNING("DXVA2D3D11 crash detected"); @@ -785,8 +778,6 @@ D3D11DXVA2Manager::Init(layers::KnowsCompositor* aKnowsCompositor, Telemetry::Accumulate(Telemetry::MEDIA_DECODER_BACKEND_USED, uint32_t(media::MediaDecoderBackend::WMFDXVA2D3D11)); - reporter.SetSuccessful(); - return S_OK; } diff --git a/dom/performance/PerformanceResourceTiming.cpp b/dom/performance/PerformanceResourceTiming.cpp index 2eaa4eb9a..9c5475041 100644 --- a/dom/performance/PerformanceResourceTiming.cpp +++ b/dom/performance/PerformanceResourceTiming.cpp @@ -6,6 +6,7 @@ #include "PerformanceResourceTiming.h" #include "mozilla/dom/PerformanceResourceTimingBinding.h" +#include "mozilla/Unused.h" using namespace mozilla::dom; diff --git a/dom/plugins/ipc/PPluginModule.ipdl b/dom/plugins/ipc/PPluginModule.ipdl index ecde41b63..6797b49a7 100644 --- a/dom/plugins/ipc/PPluginModule.ipdl +++ b/dom/plugins/ipc/PPluginModule.ipdl @@ -5,7 +5,6 @@ include protocol PPluginInstance; include protocol PPluginScriptableObject; -include protocol PCrashReporter; include protocol PContent; include ProfilerTypes; @@ -39,7 +38,6 @@ intr protocol PPluginModule bridges PContent, PPluginModule; manages PPluginInstance; - manages PCrashReporter; both: // Window-specific message which instructs the interrupt mechanism to enter @@ -94,17 +92,6 @@ child: async SetParentHangTimeout(uint32_t seconds); - intr PCrashReporter() - returns (NativeThreadId tid, uint32_t processType); - - /** - * Control the Gecko Profiler in the plugin process. - */ - async StartProfiler(ProfilerInitParams params); - async StopProfiler(); - - async GatherProfile(); - async SettingChanged(PluginSettings settings); async NPP_SetValue_NPNVaudioDeviceChangeDetails(NPAudioDeviceChangeDetailsIPC changeDetails); @@ -153,8 +140,6 @@ parent: // down the plugin process in response. async NotifyContentModuleDestroyed(); - async Profile(nsCString aProfile); - // Answers to request about site data async ReturnClearSiteData(NPError aRv, uint64_t aCallbackId); diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 7350a7fa7..cbf6e509f 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -32,7 +32,6 @@ #include "mozilla/plugins/StreamNotifyChild.h" #include "mozilla/plugins/BrowserStreamChild.h" #include "mozilla/plugins/PluginStreamChild.h" -#include "mozilla/dom/CrashReporterChild.h" #include "mozilla/Sprintf.h" #include "mozilla/Unused.h" @@ -56,8 +55,6 @@ using namespace mozilla; using namespace mozilla::ipc; using namespace mozilla::plugins; using namespace mozilla::widget; -using mozilla::dom::CrashReporterChild; -using mozilla::dom::PCrashReporterChild; #if defined(XP_WIN) const wchar_t * kFlashFullscreenClass = L"ShockwaveFlashFullScreen"; @@ -733,29 +730,6 @@ PluginModuleChild::AllocPPluginModuleChild(mozilla::ipc::Transport* aTransport, return PluginModuleChild::CreateForContentProcess(aTransport, aOtherPid); } -PCrashReporterChild* -PluginModuleChild::AllocPCrashReporterChild(mozilla::dom::NativeThreadId* id, - uint32_t* processType) -{ - return new CrashReporterChild(); -} - -bool -PluginModuleChild::DeallocPCrashReporterChild(PCrashReporterChild* actor) -{ - delete actor; - return true; -} - -bool -PluginModuleChild::AnswerPCrashReporterConstructor( - PCrashReporterChild* actor, - mozilla::dom::NativeThreadId* id, - uint32_t* processType) -{ - return true; -} - void PluginModuleChild::ActorDestroy(ActorDestroyReason why) { @@ -2575,48 +2549,6 @@ PluginModuleChild::ProcessNativeEvents() { } #endif -bool -PluginModuleChild::RecvStartProfiler(const ProfilerInitParams& params) -{ - nsTArray<const char*> featureArray; - for (size_t i = 0; i < params.features().Length(); ++i) { - featureArray.AppendElement(params.features()[i].get()); - } - - nsTArray<const char*> threadNameFilterArray; - for (size_t i = 0; i < params.threadFilters().Length(); ++i) { - threadNameFilterArray.AppendElement(params.threadFilters()[i].get()); - } - - profiler_start(params.entries(), params.interval(), - featureArray.Elements(), featureArray.Length(), - threadNameFilterArray.Elements(), threadNameFilterArray.Length()); - - return true; -} - -bool -PluginModuleChild::RecvStopProfiler() -{ - profiler_stop(); - return true; -} - -bool -PluginModuleChild::RecvGatherProfile() -{ - nsCString profileCString; - UniquePtr<char[]> profile = profiler_get_profile(); - if (profile != nullptr) { - profileCString = nsCString(profile.get(), strlen(profile.get())); - } else { - profileCString = nsCString("", 0); - } - - Unused << SendProfile(profileCString); - return true; -} - NPError PluginModuleChild::PluginRequiresAudioDeviceChanges( PluginInstanceChild* aInstance, diff --git a/dom/plugins/ipc/PluginModuleChild.h b/dom/plugins/ipc/PluginModuleChild.h index 233a95369..681743582 100644 --- a/dom/plugins/ipc/PluginModuleChild.h +++ b/dom/plugins/ipc/PluginModuleChild.h @@ -46,17 +46,12 @@ typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINUNIXINIT) (const NPNetscapeFun typedef NS_NPAPIPLUGIN_CALLBACK(NPError, NP_PLUGINSHUTDOWN) (void); namespace mozilla { -namespace dom { -class PCrashReporterChild; -} // namespace dom - namespace plugins { class PluginInstanceChild; class PluginModuleChild : public PPluginModuleChild { - typedef mozilla::dom::PCrashReporterChild PCrashReporterChild; protected: virtual mozilla::ipc::RacyInterruptPolicy MediateInterruptRace(const MessageInfo& parent, @@ -124,26 +119,12 @@ protected: virtual bool RecvSetParentHangTimeout(const uint32_t& aSeconds) override; - virtual PCrashReporterChild* - AllocPCrashReporterChild(mozilla::dom::NativeThreadId* id, - uint32_t* processType) override; - virtual bool - DeallocPCrashReporterChild(PCrashReporterChild* actor) override; - virtual bool - AnswerPCrashReporterConstructor(PCrashReporterChild* actor, - mozilla::dom::NativeThreadId* id, - uint32_t* processType) override; - virtual void ActorDestroy(ActorDestroyReason why) override; virtual bool RecvProcessNativeEventsInInterruptCall() override; - virtual bool RecvStartProfiler(const ProfilerInitParams& params) override; - virtual bool RecvStopProfiler() override; - virtual bool RecvGatherProfile() override; - virtual bool AnswerModuleSupportsAsyncRender(bool* aResult) override; public: diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index ae6da8787..2489baf16 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -10,7 +10,6 @@ #include "mozilla/Attributes.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/ContentChild.h" -#include "mozilla/dom/PCrashReporterParent.h" #include "mozilla/ipc/GeckoChildProcessHost.h" #include "mozilla/ipc/MessageChannel.h" #include "mozilla/ipc/ProtocolUtils.h" @@ -19,9 +18,6 @@ #include "mozilla/plugins/PluginBridge.h" #include "mozilla/plugins/PluginInstanceParent.h" #include "mozilla/Preferences.h" -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "mozilla/ProfileGatherer.h" -#endif #include "mozilla/ProcessHangMonitor.h" #include "mozilla/Services.h" #include "mozilla/Telemetry.h" @@ -47,11 +43,6 @@ #include "PluginUtilsWin.h" #endif -#ifdef MOZ_ENABLE_PROFILER_SPS -#include "nsIProfiler.h" -#include "nsIProfileSaveEvent.h" -#endif - #ifdef MOZ_WIDGET_GTK #include <glib.h> #elif XP_MACOSX @@ -62,13 +53,8 @@ using base::KillProcess; using mozilla::PluginLibrary; -#ifdef MOZ_ENABLE_PROFILER_SPS -using mozilla::ProfileGatherer; -#endif using mozilla::ipc::MessageChannel; using mozilla::ipc::GeckoChildProcessHost; -using mozilla::dom::PCrashReporterParent; -using mozilla::dom::CrashReporterParent; using namespace mozilla; using namespace mozilla::plugins; @@ -546,25 +532,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded) } #endif } - -#ifdef MOZ_ENABLE_PROFILER_SPS - nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1")); - bool profilerActive = false; - DebugOnly<nsresult> rv = profiler->IsActive(&profilerActive); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - if (profilerActive) { - nsCOMPtr<nsIProfilerStartParams> currentProfilerParams; - rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - - nsCOMPtr<nsISupports> gatherer; - rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - MOZ_ASSERT(NS_SUCCEEDED(rv)); - mGatherer = static_cast<ProfileGatherer*>(gatherer.get()); - - StartProfiler(currentProfilerParams); - } -#endif } bool @@ -650,10 +617,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath, mSandboxLevel = aSandboxLevel; mRunID = GeckoChildProcessHost::GetUniqueID(); -#ifdef MOZ_ENABLE_PROFILER_SPS - InitPluginProfiling(); -#endif - mozilla::HangMonitor::RegisterAnnotator(*this); } @@ -663,10 +626,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent() NS_RUNTIMEABORT("unsafe destruction"); } -#ifdef MOZ_ENABLE_PROFILER_SPS - ShutdownPluginProfiling(); -#endif - #ifdef XP_WIN // If we registered for audio notifications, stop. mozilla::plugins::PluginUtilsWin::RegisterForAudioDeviceChanges(this, @@ -2525,33 +2484,6 @@ PluginModuleParent::RecvPluginHideWindow(const uint32_t& aWindowId) #endif } -PCrashReporterParent* -PluginModuleParent::AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id, - uint32_t* processType) -{ - MOZ_CRASH("unreachable"); -} - -bool -PluginModuleParent::DeallocPCrashReporterParent(PCrashReporterParent* actor) -{ - MOZ_CRASH("unreachable"); -} - -PCrashReporterParent* -PluginModuleChromeParent::AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id, - uint32_t* processType) -{ - return nullptr; -} - -bool -PluginModuleChromeParent::DeallocPCrashReporterParent(PCrashReporterParent* actor) -{ - delete actor; - return true; -} - bool PluginModuleParent::RecvSetCursor(const NSCursorInfo& aCursorInfo) { @@ -2709,136 +2641,6 @@ PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges( return true; } -#ifdef MOZ_ENABLE_PROFILER_SPS -class PluginProfilerObserver final : public nsIObserver, - public nsSupportsWeakReference -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSIOBSERVER - - explicit PluginProfilerObserver(PluginModuleChromeParent* pmp) - : mPmp(pmp) - {} - -private: - ~PluginProfilerObserver() {} - PluginModuleChromeParent* mPmp; -}; - -NS_IMPL_ISUPPORTS(PluginProfilerObserver, nsIObserver, nsISupportsWeakReference) - -NS_IMETHODIMP -PluginProfilerObserver::Observe(nsISupports *aSubject, - const char *aTopic, - const char16_t *aData) -{ - if (!strcmp(aTopic, "profiler-started")) { - nsCOMPtr<nsIProfilerStartParams> params(do_QueryInterface(aSubject)); - mPmp->StartProfiler(params); - } else if (!strcmp(aTopic, "profiler-stopped")) { - mPmp->StopProfiler(); - } else if (!strcmp(aTopic, "profiler-subprocess-gather")) { - mPmp->GatherAsyncProfile(); - } else if (!strcmp(aTopic, "profiler-subprocess")) { - nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject); - mPmp->GatheredAsyncProfile(pse); - } - return NS_OK; -} - -void -PluginModuleChromeParent::InitPluginProfiling() -{ - nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); - if (observerService) { - mProfilerObserver = new PluginProfilerObserver(this); - observerService->AddObserver(mProfilerObserver, "profiler-started", false); - observerService->AddObserver(mProfilerObserver, "profiler-stopped", false); - observerService->AddObserver(mProfilerObserver, "profiler-subprocess-gather", false); - observerService->AddObserver(mProfilerObserver, "profiler-subprocess", false); - } -} - -void -PluginModuleChromeParent::ShutdownPluginProfiling() -{ - nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); - if (observerService) { - observerService->RemoveObserver(mProfilerObserver, "profiler-started"); - observerService->RemoveObserver(mProfilerObserver, "profiler-stopped"); - observerService->RemoveObserver(mProfilerObserver, "profiler-subprocess-gather"); - observerService->RemoveObserver(mProfilerObserver, "profiler-subprocess"); - } -} - -void -PluginModuleChromeParent::StartProfiler(nsIProfilerStartParams* aParams) -{ - if (NS_WARN_IF(!aParams)) { - return; - } - - ProfilerInitParams ipcParams; - - ipcParams.enabled() = true; - aParams->GetEntries(&ipcParams.entries()); - aParams->GetInterval(&ipcParams.interval()); - ipcParams.features() = aParams->GetFeatures(); - ipcParams.threadFilters() = aParams->GetThreadFilterNames(); - - Unused << SendStartProfiler(ipcParams); - - nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1")); - if (NS_WARN_IF(!profiler)) { - return; - } - nsCOMPtr<nsISupports> gatherer; - profiler->GetProfileGatherer(getter_AddRefs(gatherer)); - mGatherer = static_cast<ProfileGatherer*>(gatherer.get()); -} - -void -PluginModuleChromeParent::StopProfiler() -{ - mGatherer = nullptr; - Unused << SendStopProfiler(); -} - -void -PluginModuleChromeParent::GatherAsyncProfile() -{ - if (NS_WARN_IF(!mGatherer)) { - return; - } - mGatherer->WillGatherOOPProfile(); - Unused << SendGatherProfile(); -} - -void -PluginModuleChromeParent::GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent) -{ - if (aSaveEvent && !mProfile.IsEmpty()) { - aSaveEvent->AddSubProfile(mProfile.get()); - mProfile.Truncate(); - } -} -#endif // MOZ_ENABLE_PROFILER_SPS - -bool -PluginModuleChromeParent::RecvProfile(const nsCString& aProfile) -{ -#ifdef MOZ_ENABLE_PROFILER_SPS - if (NS_WARN_IF(!mGatherer)) { - return true; - } - - mProfile = aProfile; - mGatherer->GatheredOOPProfile(); -#endif - return true; -} - bool PluginModuleParent::AnswerGetKeyState(const int32_t& aVirtKey, int16_t* aRet) { diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h index d00a01401..0ceed6efd 100644 --- a/dom/plugins/ipc/PluginModuleParent.h +++ b/dom/plugins/ipc/PluginModuleParent.h @@ -30,14 +30,6 @@ class nsIProfileSaveEvent; class nsPluginTag; namespace mozilla { -#ifdef MOZ_ENABLE_PROFILER_SPS -class ProfileGatherer; -#endif -namespace dom { -class PCrashReporterParent; -class CrashReporterParent; -} // namespace dom - namespace layers { class TextureClientRecycleAllocator; } // namespace layers @@ -76,8 +68,6 @@ class PluginModuleParent { protected: typedef mozilla::PluginLibrary PluginLibrary; - typedef mozilla::dom::PCrashReporterParent PCrashReporterParent; - typedef mozilla::dom::CrashReporterParent CrashReporterParent; PPluginInstanceParent* AllocPPluginInstanceParent(const nsCString& aMimeType, @@ -158,12 +148,6 @@ protected: virtual bool RecvPluginHideWindow(const uint32_t& aWindowId) override; - virtual PCrashReporterParent* - AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id, - uint32_t* processType) override; - virtual bool - DeallocPCrashReporterParent(PCrashReporterParent* actor) override; - virtual bool RecvSetCursor(const NSCursorInfo& aCursorInfo) override; @@ -201,8 +185,6 @@ protected: virtual bool RecvNotifyContentModuleDestroyed() override { return true; } - virtual bool RecvProfile(const nsCString& aProfile) override { return true; } - virtual bool AnswerGetKeyState(const int32_t& aVirtKey, int16_t* aRet) override; virtual bool RecvReturnClearSiteData(const NPError& aRv, @@ -348,7 +330,6 @@ protected: bool GetPluginDetails(); - friend class mozilla::dom::CrashReporterParent; friend class mozilla::plugins::PluginAsyncSurrogate; bool mIsStartingAsync; @@ -480,16 +461,6 @@ class PluginModuleChromeParent void CachedSettingChanged(); -#ifdef MOZ_ENABLE_PROFILER_SPS - void GatherAsyncProfile(); - void GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent); - void StartProfiler(nsIProfilerStartParams* aParams); - void StopProfiler(); -#endif - - virtual bool - RecvProfile(const nsCString& aProfile) override; - virtual bool AnswerGetKeyState(const int32_t& aVirtKey, int16_t* aRet) override; @@ -508,12 +479,6 @@ private: virtual bool ShouldContinueFromReplyTimeout() override; - virtual PCrashReporterParent* - AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id, - uint32_t* processType) override; - virtual bool - DeallocPCrashReporterParent(PCrashReporterParent* actor) override; - PluginProcessParent* Process() const { return mSubprocess; } base::ProcessHandle ChildProcessHandle() { return mSubprocess->GetChildProcessHandle(); } @@ -534,17 +499,10 @@ private: int32_t aSandboxLevel, bool aAllowAsyncInit); - CrashReporterParent* CrashReporter(); - void CleanupFromTimeout(const bool aByHangUI); virtual void UpdatePluginTimeout() override; -#ifdef MOZ_ENABLE_PROFILER_SPS - void InitPluginProfiling(); - void ShutdownPluginProfiling(); -#endif - void RegisterSettingsCallbacks(); void UnregisterSettingsCallbacks(); @@ -593,7 +551,6 @@ private: FinishHangUI(); #endif - friend class mozilla::dom::CrashReporterParent; friend class mozilla::plugins::PluginAsyncSurrogate; void OnProcessLaunched(const bool aSucceeded); @@ -628,9 +585,6 @@ private: // processes in existence! dom::ContentParent* mContentParent; nsCOMPtr<nsIObserver> mPluginOfflineObserver; -#ifdef MOZ_ENABLE_PROFILER_SPS - RefPtr<mozilla::ProfileGatherer> mGatherer; -#endif nsCString mProfile; bool mIsBlocklisted; static bool sInstantiated; diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp index c6558fc93..f329aa723 100644 --- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -8,8 +8,6 @@ #include "nsContentUtils.h" #include "nsCORSListenerProxy.h" #include "nsIStreamListener.h" -#include "nsIDocument.h" -#include "nsMixedContentBlocker.h" #include "nsCDefaultURIFixup.h" #include "nsIURIFixup.h" @@ -507,13 +505,6 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo) return NS_ERROR_CONTENT_BLOCKED; } - if (nsMixedContentBlocker::sSendHSTSPriming) { - rv = nsMixedContentBlocker::MarkLoadInfoForPriming(uri, - requestingContext, - aLoadInfo); - return rv; - } - return NS_OK; } diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index 4e80dce3f..7d50a43a3 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -54,13 +54,6 @@ bool nsMixedContentBlocker::sBlockMixedScript = false; // Is mixed display content blocking (images, audio, video, <a ping>) enabled? bool nsMixedContentBlocker::sBlockMixedDisplay = false; -// Do we move HSTS before mixed-content -bool nsMixedContentBlocker::sUseHSTS = false; -// Do we send an HSTS priming request -bool nsMixedContentBlocker::sSendHSTSPriming = false; -// Default HSTS Priming failure timeout to 7 days, in seconds -uint32_t nsMixedContentBlocker::sHSTSPrimingCacheTimeout = (60 * 24 * 7); - // Fired at the document that attempted to load mixed content. The UI could // handle this event, for example, by displaying an info bar that offers the // choice to reload the page with mixed content permitted. @@ -202,18 +195,6 @@ nsMixedContentBlocker::nsMixedContentBlocker() // Cache the pref for mixed display blocking Preferences::AddBoolVarCache(&sBlockMixedDisplay, "security.mixed_content.block_display_content"); - - // Cache the pref for HSTS - Preferences::AddBoolVarCache(&sUseHSTS, - "security.mixed_content.use_hsts"); - - // Cache the pref for sending HSTS priming - Preferences::AddBoolVarCache(&sSendHSTSPriming, - "security.mixed_content.send_hsts_priming"); - - // Cache the pref for HSTS priming failure cache time - Preferences::AddUintVarCache(&sHSTSPrimingCacheTimeout, - "security.mixed_content.hsts_priming_cache_timeout"); } nsMixedContentBlocker::~nsMixedContentBlocker() @@ -343,22 +324,6 @@ nsMixedContentBlocker::AsyncOnChannelRedirect(nsIChannel* aOldChannel, return NS_BINDING_FAILED; } - if (nsMixedContentBlocker::sSendHSTSPriming) { - // The LoadInfo passed in is for the original channel, HSTS priming needs to - // be set on the new channel, if required. If the redirect changes - // http->https, or vice-versa, the need for priming may change. - nsCOMPtr<nsILoadInfo> newLoadInfo; - rv = aNewChannel->GetLoadInfo(getter_AddRefs(newLoadInfo)); - NS_ENSURE_SUCCESS(rv, rv); - rv = nsMixedContentBlocker::MarkLoadInfoForPriming(newUri, - requestingContext, - newLoadInfo); - if (NS_FAILED(rv)) { - decision = REJECT_REQUEST; - newLoadInfo->ClearHSTSPriming(); - } - } - // If the channel is about to load mixed content, abort the channel if (!NS_CP_ACCEPTED(decision)) { autoCallback.DontCallback(); @@ -691,12 +656,6 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, // the parent is https, and the protocol associated with innerContentLocation // doesn't map to the secure URI flags checked above. Assert this for // sanity's sake -#ifdef DEBUG - bool isHttpsScheme = false; - rv = innerContentLocation->SchemeIs("https", &isHttpsScheme); - NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(!isHttpsScheme); -#endif *aDecision = REJECT_REQUEST; return NS_OK; } @@ -836,34 +795,6 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, } nsresult stateRV = securityUI->GetState(&state); - bool doHSTSPriming = false; - if (isHttpScheme) { - bool hsts = false; - bool cached = false; - nsCOMPtr<nsISiteSecurityService> sss = - do_GetService(NS_SSSERVICE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - rv = sss->IsSecureURI(nsISiteSecurityService::HEADER_HSTS, aContentLocation, - 0, &cached, &hsts); - NS_ENSURE_SUCCESS(rv, rv); - - if (hsts && sUseHSTS) { - // assume we will be upgraded later - *aDecision = ACCEPT; - return NS_OK; - } - - // Send a priming request if the result is not already cached and priming - // requests are allowed - if (!cached && sSendHSTSPriming) { - // add this URI as a priming location - doHSTSPriming = true; - document->AddHSTSPrimingLocation(innerContentLocation, - HSTSPrimingState::eHSTS_PRIMING_ALLOW); - *aDecision = ACCEPT; - } - } - // At this point we know that the request is mixed content, and the only // question is whether we block it. Record telemetry at this point as to // whether HSTS would have fixed things by making the content location @@ -879,14 +810,14 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, bool active = (classification == eMixedScript); if (!aHadInsecureImageRedirect) { if (XRE_IsParentProcess()) { - AccumulateMixedContentHSTS(innerContentLocation, active, doHSTSPriming); + AccumulateMixedContentHSTS(innerContentLocation, active); } else { // Ask the parent process to do the same call mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); if (cc) { mozilla::ipc::URIParams uri; SerializeURI(innerContentLocation, uri); - cc->SendAccumulateMixedContentHSTS(uri, active, doHSTSPriming); + cc->SendAccumulateMixedContentHSTS(uri, active); } } } @@ -929,13 +860,7 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, } } } else { - if (doHSTSPriming) { - document->AddHSTSPrimingLocation(innerContentLocation, - HSTSPrimingState::eHSTS_PRIMING_BLOCK); - *aDecision = nsIContentPolicy::ACCEPT; - } else { - *aDecision = nsIContentPolicy::REJECT_REQUEST; - } + *aDecision = nsIContentPolicy::REJECT_REQUEST; LogMixedContentMessage(classification, aContentLocation, rootDoc, eBlocked); if (!rootDoc->GetHasMixedDisplayContentBlocked() && NS_SUCCEEDED(stateRV)) { rootDoc->SetHasMixedDisplayContentBlocked(true); @@ -981,13 +906,7 @@ nsMixedContentBlocker::ShouldLoad(bool aHadInsecureImageRedirect, } } else { //User has not overriden the pref by Disabling protection. Reject the request and update the security state. - if (doHSTSPriming) { - document->AddHSTSPrimingLocation(innerContentLocation, - HSTSPrimingState::eHSTS_PRIMING_BLOCK); - *aDecision = nsIContentPolicy::ACCEPT; - } else { - *aDecision = nsIContentPolicy::REJECT_REQUEST; - } + *aDecision = nsIContentPolicy::REJECT_REQUEST; LogMixedContentMessage(classification, aContentLocation, rootDoc, eBlocked); // See if the pref will change here. If it will, only then do we need to call OnSecurityChange() to update the UI. if (rootDoc->GetHasMixedActiveContentBlocked()) { @@ -1052,24 +971,10 @@ enum MixedContentHSTSState { MCB_HSTS_ACTIVE_WITH_HSTS = 3 }; -// Similar to the existing mixed-content HSTS, except MCB_HSTS_*_NO_HSTS is -// broken into two distinct states, indicating whether we plan to send a priming -// request or not. If we decided not go send a priming request, it could be -// because it is a type we do not support, or because we cached a previous -// negative response. -enum MixedContentHSTSPrimingState { - eMCB_HSTS_PASSIVE_WITH_HSTS = 0, - eMCB_HSTS_ACTIVE_WITH_HSTS = 1, - eMCB_HSTS_PASSIVE_NO_PRIMING = 2, - eMCB_HSTS_PASSIVE_DO_PRIMING = 3, - eMCB_HSTS_ACTIVE_NO_PRIMING = 4, - eMCB_HSTS_ACTIVE_DO_PRIMING = 5 -}; - // Record information on when HSTS would have made mixed content not mixed // content (regardless of whether it was actually blocked) void -nsMixedContentBlocker::AccumulateMixedContentHSTS(nsIURI* aURI, bool aActive, bool aHasHSTSPriming) +nsMixedContentBlocker::AccumulateMixedContentHSTS(nsIURI* aURI, bool aActive) { // This method must only be called in the parent, because // nsSiteSecurityService is only available in the parent @@ -1089,108 +994,26 @@ nsMixedContentBlocker::AccumulateMixedContentHSTS(nsIURI* aURI, bool aActive, bo return; } - // states: would upgrade, would prime, hsts info cached + // states: would upgrade, hsts info cached // active, passive // if (!aActive) { if (!hsts) { Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS, MCB_HSTS_PASSIVE_NO_HSTS); - if (aHasHSTSPriming) { - Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING, - eMCB_HSTS_PASSIVE_DO_PRIMING); - } else { - Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING, - eMCB_HSTS_PASSIVE_NO_PRIMING); - } } else { Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS, MCB_HSTS_PASSIVE_WITH_HSTS); - Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING, - eMCB_HSTS_PASSIVE_WITH_HSTS); } } else { if (!hsts) { Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS, MCB_HSTS_ACTIVE_NO_HSTS); - if (aHasHSTSPriming) { - Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING, - eMCB_HSTS_ACTIVE_DO_PRIMING); - } else { - Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING, - eMCB_HSTS_ACTIVE_NO_PRIMING); - } } else { Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS, MCB_HSTS_ACTIVE_WITH_HSTS); - Telemetry::Accumulate(Telemetry::MIXED_CONTENT_HSTS_PRIMING, - eMCB_HSTS_ACTIVE_WITH_HSTS); } } -} - -//static -nsresult -nsMixedContentBlocker::MarkLoadInfoForPriming(nsIURI* aURI, - nsISupports* aRequestingContext, - nsILoadInfo* aLoadInfo) -{ - nsresult rv; - bool sendPriming = false; - bool mixedContentWouldBlock = false; - rv = GetHSTSPrimingFromRequestingContext(aURI, - aRequestingContext, - &sendPriming, - &mixedContentWouldBlock); - NS_ENSURE_SUCCESS(rv, rv); - - if (sendPriming) { - aLoadInfo->SetHSTSPriming(mixedContentWouldBlock); - } - - return NS_OK; -} - -//static -nsresult -nsMixedContentBlocker::GetHSTSPrimingFromRequestingContext(nsIURI* aURI, - nsISupports* aRequestingContext, - bool* aSendPrimingRequest, - bool* aMixedContentWouldBlock) -{ - *aSendPrimingRequest = false; - *aMixedContentWouldBlock = false; - // If we marked for priming, we used the innermost URI, so get that - nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(aURI); - if (!innerURI) { - NS_ERROR("Can't get innerURI from aContentLocation"); - return NS_ERROR_CONTENT_BLOCKED; - } - - bool isHttp = false; - innerURI->SchemeIs("http", &isHttp); - if (!isHttp) { - // there is nothign to do - return NS_OK; - } - - // If the DocShell was marked for HSTS priming, propagate that to the LoadInfo - nsCOMPtr<nsIDocShell> docShell = NS_CP_GetDocShellFromContext(aRequestingContext); - if (!docShell) { - return NS_OK; - } - nsCOMPtr<nsIDocument> document = docShell->GetDocument(); - if (!document) { - return NS_OK; - } - - HSTSPrimingState status = document->GetHSTSPrimingStateForLocation(innerURI); - if (status != HSTSPrimingState::eNO_HSTS_PRIMING) { - *aSendPrimingRequest = (status != HSTSPrimingState::eNO_HSTS_PRIMING); - *aMixedContentWouldBlock = (status == HSTSPrimingState::eHSTS_PRIMING_BLOCK); - } - - return NS_OK; -} +}
\ No newline at end of file diff --git a/dom/security/nsMixedContentBlocker.h b/dom/security/nsMixedContentBlocker.h index 539c3ebbb..56ab9621f 100644 --- a/dom/security/nsMixedContentBlocker.h +++ b/dom/security/nsMixedContentBlocker.h @@ -62,44 +62,11 @@ public: nsIPrincipal* aRequestPrincipal, int16_t* aDecision); static void AccumulateMixedContentHSTS(nsIURI* aURI, - bool aActive, - bool aHasHSTSPriming); - /* If the document associated with aRequestingContext requires priming for - * aURI, propagate that to the LoadInfo so the HttpChannel will find out about - * it. - * - * @param aURI The URI associated with the load - * @param aRequestingContext the requesting context passed to ShouldLoad - * @param aLoadInfo the LoadInfo for the load - */ - static nsresult MarkLoadInfoForPriming(nsIURI* aURI, - nsISupports* aRequestingContext, - nsILoadInfo* aLoadInfo); - - /* Given a context, return whether HSTS was marked on the document associated - * with the load for the given URI. This is used by MarkLoadInfoForPriming and - * directly by the image loader to determine whether to allow a load to occur - * from the cache. - * - * @param aURI The URI associated with the load - * @param aRequestingContext the requesting context passed to ShouldLoad - * @param aSendPrimingRequest out true if priming is required on the channel - * @param aMixedContentWouldBlock out true if mixed content would block - */ - static nsresult GetHSTSPrimingFromRequestingContext(nsIURI* aURI, - nsISupports* aRequestingContext, - bool* aSendPrimingRequest, - bool* aMixedContentWouldBlock); + bool aActive); static bool sBlockMixedScript; static bool sBlockMixedDisplay; - // Do we move HSTS before mixed-content - static bool sUseHSTS; - // Do we send an HSTS priming request - static bool sSendHSTSPriming; - // Default HSTS Priming failure timeout in seconds - static uint32_t sHSTSPrimingCacheTimeout; }; #endif /* nsMixedContentBlocker_h___ */ diff --git a/dom/security/test/csp/test_referrerdirective.html b/dom/security/test/csp/test_referrerdirective.html index 770fcc40b..f590460a0 100644 --- a/dom/security/test/csp/test_referrerdirective.html +++ b/dom/security/test/csp/test_referrerdirective.html @@ -116,8 +116,6 @@ SimpleTest.waitForExplicitFinish(); SpecialPowers.pushPrefEnv({ 'set': [['security.mixed_content.block_active_content', false], ['security.mixed_content.block_display_content', false], - ['security.mixed_content.send_hsts_priming', false], - ['security.mixed_content.use_hsts', false], ] }, function() { diff --git a/dom/security/test/hsts/browser.ini b/dom/security/test/hsts/browser.ini deleted file mode 100644 index ae75031df..000000000 --- a/dom/security/test/hsts/browser.ini +++ /dev/null @@ -1,19 +0,0 @@ -[DEFAULT] -skip-if = debug # bug 1311599, bug 1311239, etc -support-files = - head.js - file_priming-top.html - file_testserver.sjs - file_1x1.png - file_priming.js - file_stylesheet.css - -[browser_hsts-priming_allow_active.js] -[browser_hsts-priming_block_active.js] -[browser_hsts-priming_hsts_after_mixed.js] -[browser_hsts-priming_allow_display.js] -[browser_hsts-priming_block_display.js] -[browser_hsts-priming_block_active_css.js] -[browser_hsts-priming_block_active_with_redir_same.js] -[browser_hsts-priming_no-duplicates.js] -[browser_hsts-priming_cache-timeout.js] diff --git a/dom/security/test/hsts/browser_hsts-priming_allow_active.js b/dom/security/test/hsts/browser_hsts-priming_allow_active.js deleted file mode 100644 index a932b31b3..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_allow_active.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when active - * content is allowed. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "allow_active"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_allow_display.js b/dom/security/test/hsts/browser_hsts-priming_allow_display.js deleted file mode 100644 index 06546ca65..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_allow_display.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when display - * content is allowed. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "allow_display"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_block_active.js b/dom/security/test/hsts/browser_hsts-priming_block_active.js deleted file mode 100644 index a5478b185..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_block_active.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when active - * content is blocked. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "block_active"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_block_active_css.js b/dom/security/test/hsts/browser_hsts-priming_block_active_css.js deleted file mode 100644 index 340d11483..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_block_active_css.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when active - * content is blocked for css. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "block_active_css"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_block_active_with_redir_same.js b/dom/security/test/hsts/browser_hsts-priming_block_active_with_redir_same.js deleted file mode 100644 index 130a3d5ec..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_block_active_with_redir_same.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when active - * content is blocked and redirect to the same host should still upgrade. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "block_active_with_redir_same"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_block_display.js b/dom/security/test/hsts/browser_hsts-priming_block_display.js deleted file mode 100644 index 4eca62718..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_block_display.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when display - * content is blocked. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "block_display"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_cache-timeout.js b/dom/security/test/hsts/browser_hsts-priming_cache-timeout.js deleted file mode 100644 index 5416a71d2..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_cache-timeout.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Description of the test: - * Test that the network.hsts_priming.cache_timeout preferene causes the cache - * to timeout - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Observer.add_observers(Services); - registerCleanupFunction(do_cleanup); - - let which = "block_display"; - - SetupPrefTestEnvironment(which, [["security.mixed_content.hsts_priming_cache_timeout", 1]]); - - yield execute_test("no-ssl", test_settings[which].mimetype); - - let pre_promise = performance.now(); - - while ((performance.now() - pre_promise) < 2000) { - yield new Promise(function (resolve) { - setTimeout(resolve, 2000); - }); - } - - // clear the fact that we saw a priming request - test_settings[which].priming = {}; - - yield execute_test("no-ssl", test_settings[which].mimetype); - is(test_settings[which].priming["no-ssl"], true, - "Correctly send a priming request after expiration."); - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_hsts_after_mixed.js b/dom/security/test/hsts/browser_hsts-priming_hsts_after_mixed.js deleted file mode 100644 index 89ea6fbeb..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_hsts_after_mixed.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Description of the test: - * Check that HSTS priming occurs correctly with mixed content when the - * mixed-content blocks before HSTS. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Services.obs.addObserver(Observer, "console-api-log-event", false); - Services.obs.addObserver(Observer, "http-on-examine-response", false); - registerCleanupFunction(do_cleanup); - - let which = "hsts_after_mixed"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/browser_hsts-priming_no-duplicates.js b/dom/security/test/hsts/browser_hsts-priming_no-duplicates.js deleted file mode 100644 index 3846fe4f0..000000000 --- a/dom/security/test/hsts/browser_hsts-priming_no-duplicates.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Description of the test: - * Only one request should be sent per host, even if we run the test more - * than once. - */ -'use strict'; - -//jscs:disable -add_task(function*() { - //jscs:enable - Observer.add_observers(Services); - registerCleanupFunction(do_cleanup); - - let which = "block_display"; - - SetupPrefTestEnvironment(which); - - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - test_settings[which].priming = {}; - - // run the tests twice to validate the cache is being used - for (let server of Object.keys(test_servers)) { - yield execute_test(server, test_settings[which].mimetype); - } - - SpecialPowers.popPrefEnv(); -}); diff --git a/dom/security/test/hsts/file_1x1.png b/dom/security/test/hsts/file_1x1.png Binary files differdeleted file mode 100644 index 1ba31ba1a..000000000 --- a/dom/security/test/hsts/file_1x1.png +++ /dev/null diff --git a/dom/security/test/hsts/file_priming-top.html b/dom/security/test/hsts/file_priming-top.html deleted file mode 100644 index b1d1bfa40..000000000 --- a/dom/security/test/hsts/file_priming-top.html +++ /dev/null @@ -1,84 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <title>Bug 1246540</title> - <meta http-equiv='content-type' content="text/html;charset=utf-8" /> -</head> -<body> - <p id="display"></p> - <div id="content" style="visibility: hidden"> - </div> - -<script type="text/javascript"> -/* - * Description of the test: - * Attempt to load an insecure resource. If the resource responds to HSTS - * priming with an STS header, the load should continue securely. - * If it does not, the load should continue be blocked or continue insecurely. - */ - -function parse_query_string() { - var q = {}; - document.location.search.substr(1). - split('&').forEach(function (item, idx, ar) { - let [k, v] = item.split('='); - q[k] = unescape(v); - }); - return q; -} - -var args = parse_query_string(); - -var subresources = { - css: { mimetype: 'text/css', file: 'file_stylesheet.css' }, - img: { mimetype: 'image/png', file: 'file_1x1.png' }, - script: { mimetype: 'text/javascript', file: 'file_priming.js' }, -}; - -function handler(ev) { - console.log("HSTS_PRIMING: Blocked "+args.id); -} - -function loadCss(src) { - let head = document.getElementsByTagName("head")[0]; - let link = document.createElement("link"); - link.setAttribute("rel", "stylesheet"); - link.setAttribute("type", subresources[args.type].mimetype); - link.setAttribute("href", src); - head.appendChild(link); -} - -function loadResource(src) { - let content = document.getElementById("content"); - let testElem = document.createElement(args.type); - testElem.setAttribute("id", args.id); - testElem.setAttribute("charset", "UTF-8"); - testElem.onerror = handler; - content.appendChild(testElem); - testElem.src = src; -} - -function loadTest() { - let subresource = subresources[args.type]; - - let src = "http://" - + args.host - + "/browser/dom/security/test/hsts/file_testserver.sjs" - + "?file=" +escape("browser/dom/security/test/hsts/" + subresource.file) - + "&primer=" + escape(args.id) - + "&mimetype=" + escape(subresource.mimetype) - ; - if (args.type == 'css') { - loadCss(src); - return; - } - - loadResource(src); -} - -// start running the tests -loadTest(); - -</script> -</body> -</html> diff --git a/dom/security/test/hsts/file_priming.js b/dom/security/test/hsts/file_priming.js deleted file mode 100644 index 023022da6..000000000 --- a/dom/security/test/hsts/file_priming.js +++ /dev/null @@ -1,4 +0,0 @@ -function completed() { - return; -} -completed(); diff --git a/dom/security/test/hsts/file_stylesheet.css b/dom/security/test/hsts/file_stylesheet.css deleted file mode 100644 index e69de29bb..000000000 --- a/dom/security/test/hsts/file_stylesheet.css +++ /dev/null diff --git a/dom/security/test/hsts/file_testserver.sjs b/dom/security/test/hsts/file_testserver.sjs deleted file mode 100644 index d5cd6b17a..000000000 --- a/dom/security/test/hsts/file_testserver.sjs +++ /dev/null @@ -1,66 +0,0 @@ -// SJS file for HSTS mochitests - -Components.utils.import("resource://gre/modules/NetUtil.jsm"); -Components.utils.importGlobalProperties(["URLSearchParams"]); - -function loadFromFile(path) { - // Load the HTML to return in the response from file. - // Since it's relative to the cwd of the test runner, we start there and - // append to get to the actual path of the file. - var testFile = - Components.classes["@mozilla.org/file/directory_service;1"]. - getService(Components.interfaces.nsIProperties). - get("CurWorkD", Components.interfaces.nsILocalFile); - var dirs = path.split("/"); - for (var i = 0; i < dirs.length; i++) { - testFile.append(dirs[i]); - } - var testFileStream = - Components.classes["@mozilla.org/network/file-input-stream;1"]. - createInstance(Components.interfaces.nsIFileInputStream); - testFileStream.init(testFile, -1, 0, 0); - var test = NetUtil.readInputStreamToString(testFileStream, testFileStream.available()); - return test; -} - -function handleRequest(request, response) -{ - const query = new URLSearchParams(request.queryString); - - redir = query.get('redir'); - if (redir == 'same') { - query.delete("redir"); - response.setStatus(302); - let newURI = request.uri; - newURI.queryString = query.serialize(); - response.setHeader("Location", newURI.spec) - } - - // avoid confusing cache behaviors - response.setHeader("Cache-Control", "no-cache", false); - - // if we have a priming header, check for required behavior - // and set header appropriately - if (request.hasHeader('Upgrade-Insecure-Requests')) { - var expected = query.get('primer'); - if (expected == 'prime-hsts') { - // set it for 5 minutes - response.setHeader("Strict-Transport-Security", "max-age="+(60*5), false); - } else if (expected == 'reject-upgrade') { - response.setHeader("Strict-Transport-Security", "max-age=0", false); - } - response.write(''); - return; - } - - var file = query.get('file'); - if (file) { - var mimetype = unescape(query.get('mimetype')); - response.setHeader("Content-Type", mimetype, false); - response.write(loadFromFile(unescape(file))); - return; - } - - response.setHeader("Content-Type", "application/json", false); - response.write('{}'); -} diff --git a/dom/security/test/hsts/head.js b/dom/security/test/hsts/head.js deleted file mode 100644 index 362b36444..000000000 --- a/dom/security/test/hsts/head.js +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Description of the tests: - * Check that HSTS priming occurs correctly with mixed content - * - * This test uses three hostnames, each of which treats an HSTS priming - * request differently. - * * no-ssl never returns an ssl response - * * reject-upgrade returns an ssl response, but with no STS header - * * prime-hsts returns an ssl response with the appropriate STS header - * - * For each server, test that it response appropriately when the we allow - * or block active or display content, as well as when we send an hsts priming - * request, but do not change the order of mixed-content and HSTS. - * - * Test use http-on-examine-response, so must be run in browser context. - */ -'use strict'; - -var TOP_URI = "https://example.com/browser/dom/security/test/hsts/file_priming-top.html"; - -var test_servers = { - // a test server that does not support TLS - 'no-ssl': { - host: 'example.co.jp', - response: false, - id: 'no-ssl', - }, - // a test server which does not support STS upgrade - 'reject-upgrade': { - host: 'example.org', - response: true, - id: 'reject-upgrade', - }, - // a test server when sends an STS header when priming - 'prime-hsts': { - host: 'test1.example.com', - response: true, - id: 'prime-hsts' - }, -}; - -var test_settings = { - // mixed active content is allowed, priming will upgrade - allow_active: { - block_active: false, - block_display: false, - use_hsts: true, - send_hsts_priming: true, - type: 'script', - result: { - 'no-ssl': 'insecure', - 'reject-upgrade': 'insecure', - 'prime-hsts': 'secure', - }, - }, - // mixed active content is blocked, priming will upgrade - block_active: { - block_active: true, - block_display: false, - use_hsts: true, - send_hsts_priming: true, - type: 'script', - result: { - 'no-ssl': 'blocked', - 'reject-upgrade': 'blocked', - 'prime-hsts': 'secure', - }, - }, - // keep the original order of mixed-content and HSTS, but send - // priming requests - hsts_after_mixed: { - block_active: true, - block_display: false, - use_hsts: false, - send_hsts_priming: true, - type: 'script', - result: { - 'no-ssl': 'blocked', - 'reject-upgrade': 'blocked', - 'prime-hsts': 'blocked', - }, - }, - // mixed display content is allowed, priming will upgrade - allow_display: { - block_active: true, - block_display: false, - use_hsts: true, - send_hsts_priming: true, - type: 'img', - result: { - 'no-ssl': 'insecure', - 'reject-upgrade': 'insecure', - 'prime-hsts': 'secure', - }, - }, - // mixed display content is blocked, priming will upgrade - block_display: { - block_active: true, - block_display: true, - use_hsts: true, - send_hsts_priming: true, - type: 'img', - result: { - 'no-ssl': 'blocked', - 'reject-upgrade': 'blocked', - 'prime-hsts': 'secure', - }, - }, - // mixed active content is blocked, priming will upgrade (css) - block_active_css: { - block_active: true, - block_display: false, - use_hsts: true, - send_hsts_priming: true, - type: 'css', - result: { - 'no-ssl': 'blocked', - 'reject-upgrade': 'blocked', - 'prime-hsts': 'secure', - }, - }, - // mixed active content is blocked, priming will upgrade - // redirect to the same host - block_active_with_redir_same: { - block_active: true, - block_display: false, - use_hsts: true, - send_hsts_priming: true, - type: 'script', - redir: 'same', - result: { - 'no-ssl': 'blocked', - 'reject-upgrade': 'blocked', - 'prime-hsts': 'secure', - }, - }, -} -// track which test we are on -var which_test = ""; - -const Observer = { - observe: function (subject, topic, data) { - switch (topic) { - case 'console-api-log-event': - return Observer.console_api_log_event(subject, topic, data); - case 'http-on-examine-response': - return Observer.http_on_examine_response(subject, topic, data); - case 'http-on-modify-request': - return Observer.http_on_modify_request(subject, topic, data); - } - throw "Can't handle topic "+topic; - }, - add_observers: function (services) { - services.obs.addObserver(Observer, "console-api-log-event", false); - services.obs.addObserver(Observer, "http-on-examine-response", false); - services.obs.addObserver(Observer, "http-on-modify-request", false); - }, - // When a load is blocked which results in an error event within a page, the - // test logs to the console. - console_api_log_event: function (subject, topic, data) { - var message = subject.wrappedJSObject.arguments[0]; - // when we are blocked, this will match the message we sent to the console, - // ignore everything else. - var re = RegExp(/^HSTS_PRIMING: Blocked ([-\w]+).*$/); - if (!re.test(message)) { - return; - } - - let id = message.replace(re, '$1'); - let curTest =test_servers[id]; - - if (!curTest) { - ok(false, "HSTS priming got a console message blocked, "+ - "but doesn't match expectations "+id+" (msg="+message); - return; - } - - is("blocked", test_settings[which_test].result[curTest.id], "HSTS priming "+ - which_test+":"+curTest.id+" expected "+ - test_settings[which_test].result[curTest.id]+", got blocked"); - test_settings[which_test].finished[curTest.id] = "blocked"; - }, - get_current_test: function(uri) { - for (let item in test_servers) { - let re = RegExp('https?://'+test_servers[item].host); - if (re.test(uri)) { - return test_servers[item]; - } - } - return null; - }, - http_on_modify_request: function (subject, topic, data) { - let channel = subject.QueryInterface(Ci.nsIHttpChannel); - if (channel.requestMethod != 'HEAD') { - return; - } - - let curTest = this.get_current_test(channel.URI.asciiSpec); - - if (!curTest) { - return; - } - - ok(!(curTest.id in test_settings[which_test].priming), "Already saw a priming request for " + curTest.id); - test_settings[which_test].priming[curTest.id] = true; - }, - // When we see a response come back, peek at the response and test it is secure - // or insecure as needed. Addtionally, watch the response for priming requests. - http_on_examine_response: function (subject, topic, data) { - let channel = subject.QueryInterface(Ci.nsIHttpChannel); - let curTest = this.get_current_test(channel.URI.asciiSpec); - - if (!curTest) { - return; - } - - let result = (channel.URI.asciiSpec.startsWith('https:')) ? "secure" : "insecure"; - - // This is a priming request, go ahead and validate we were supposed to see - // a response from the server - if (channel.requestMethod == 'HEAD') { - is(true, curTest.response, "HSTS priming response found " + curTest.id); - return; - } - - // This is the response to our query, make sure it matches - is(result, test_settings[which_test].result[curTest.id], - "HSTS priming result " + which_test + ":" + curTest.id); - test_settings[which_test].finished[curTest.id] = result; - }, -}; - -// opens `uri' in a new tab and focuses it. -// returns the newly opened tab -function openTab(uri) { - let tab = gBrowser.addTab(uri); - - // select tab and make sure its browser is focused - gBrowser.selectedTab = tab; - tab.ownerDocument.defaultView.focus(); - - return tab; -} - -function clear_sts_data() { - for (let test in test_servers) { - SpecialPowers.cleanUpSTSData('http://'+test_servers[test].host); - } -} - -function do_cleanup() { - clear_sts_data(); - - Services.obs.removeObserver(Observer, "console-api-log-event"); - Services.obs.removeObserver(Observer, "http-on-examine-response"); -} - -function SetupPrefTestEnvironment(which, additional_prefs) { - which_test = which; - clear_sts_data(); - - var settings = test_settings[which]; - // priming counts how many priming requests we saw - settings.priming = {}; - // priming counts how many tests were finished - settings.finished= {}; - - var prefs = [["security.mixed_content.block_active_content", - settings.block_active], - ["security.mixed_content.block_display_content", - settings.block_display], - ["security.mixed_content.use_hsts", - settings.use_hsts], - ["security.mixed_content.send_hsts_priming", - settings.send_hsts_priming]]; - - if (additional_prefs) { - for (let idx in additional_prefs) { - prefs.push(additional_prefs[idx]); - } - } - - console.log("prefs=%s", prefs); - - SpecialPowers.pushPrefEnv({'set': prefs}); -} - -// make the top-level test uri -function build_test_uri(base_uri, host, test_id, type) { - return base_uri + - "?host=" + escape(host) + - "&id=" + escape(test_id) + - "&type=" + escape(type); -} - -// open a new tab, load the test, and wait for it to finish -function execute_test(test, mimetype) { - var src = build_test_uri(TOP_URI, test_servers[test].host, - test, test_settings[which_test].type); - - let tab = openTab(src); - test_servers[test]['tab'] = tab; - - let browser = gBrowser.getBrowserForTab(tab); - yield BrowserTestUtils.browserLoaded(browser); - - yield BrowserTestUtils.removeTab(tab); -} diff --git a/dom/security/test/mixedcontentblocker/test_main.html b/dom/security/test/mixedcontentblocker/test_main.html index d2bc9dc7e..bb9536939 100644 --- a/dom/security/test/mixedcontentblocker/test_main.html +++ b/dom/security/test/mixedcontentblocker/test_main.html @@ -162,9 +162,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=62178 } function startTest() { - // Set prefs to use mixed-content before HSTS - SpecialPowers.pushPrefEnv({'set': [["security.mixed_content.use_hsts", false], - ["security.mixed_content.send_hsts_priming", false]]}); //Set the first set of mixed content settings and increment the counter. changePrefs([], function() { //listen for a messages from the mixed content test harness diff --git a/dom/security/test/moz.build b/dom/security/test/moz.build index 946959dee..759e76c73 100644 --- a/dom/security/test/moz.build +++ b/dom/security/test/moz.build @@ -28,5 +28,4 @@ BROWSER_CHROME_MANIFESTS += [ 'contentverifier/browser.ini', 'csp/browser.ini', 'general/browser.ini', - 'hsts/browser.ini', ] diff --git a/dom/tests/mochitest/fetch/test_fetch_cors.js b/dom/tests/mochitest/fetch/test_fetch_cors.js index ac83d050d..f375ce73f 100644 --- a/dom/tests/mochitest/fetch/test_fetch_cors.js +++ b/dom/tests/mochitest/fetch/test_fetch_cors.js @@ -64,9 +64,9 @@ function testSameOriginCredentials() { withCred: "same-origin", }, { - // Default mode is "omit". + // Default mode is "same-origin". pass: 1, - noCookie: 1, + cookie: cookieStr, }, { pass: 1, diff --git a/dom/tests/mochitest/fetch/test_request.js b/dom/tests/mochitest/fetch/test_request.js index badad61b9..5be361a46 100644 --- a/dom/tests/mochitest/fetch/test_request.js +++ b/dom/tests/mochitest/fetch/test_request.js @@ -6,7 +6,7 @@ function testDefaultCtor() { is(req.context, "fetch", "Default context is fetch."); is(req.referrer, "about:client", "Default referrer is `client` which serializes to about:client."); is(req.mode, "cors", "Request mode for string input is cors"); - is(req.credentials, "omit", "Default Request credentials is omit"); + is(req.credentials, "same-origin", "Default Request credentials is same-origin"); is(req.cache, "default", "Default Request cache is default"); var req = new Request(req); @@ -16,7 +16,7 @@ function testDefaultCtor() { is(req.context, "fetch", "Default context is fetch."); is(req.referrer, "about:client", "Default referrer is `client` which serializes to about:client."); is(req.mode, "cors", "Request mode string input is cors"); - is(req.credentials, "omit", "Default Request credentials is omit"); + is(req.credentials, "same-origin", "Default Request credentials is same-origin"); is(req.cache, "default", "Default Request cache is default"); } diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index 1739f3d31..ad95d4896 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -2811,13 +2811,6 @@ WorkerThreadPrimaryRunnable::Run() } { -#ifdef MOZ_ENABLE_PROFILER_SPS - PseudoStack* stack = mozilla_get_pseudo_stack(); - if (stack) { - stack->sampleContext(cx); - } -#endif - { JSAutoRequest ar(cx); @@ -2829,12 +2822,6 @@ WorkerThreadPrimaryRunnable::Run() } BackgroundChild::CloseForCurrentThread(); - -#ifdef MOZ_ENABLE_PROFILER_SPS - if (stack) { - stack->sampleContext(nullptr); - } -#endif } // There may still be runnables on the debugger event queue that hold a diff --git a/dom/xslt/xslt/txFormatNumberFunctionCall.cpp b/dom/xslt/xslt/txFormatNumberFunctionCall.cpp index a4d4b8fb0..674fb553c 100644 --- a/dom/xslt/xslt/txFormatNumberFunctionCall.cpp +++ b/dom/xslt/xslt/txFormatNumberFunctionCall.cpp @@ -265,6 +265,12 @@ txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext, value = fabs(value) * multiplier; + // Make sure the multiplier didn't push value to infinity. + if (value == mozilla::PositiveInfinity<double>()) { + return aContext->recycler()->getStringResult(format->mInfinity, + aResult); + } + // Prefix nsAutoString res(prefix); |