Merge mozilla central to autoland r=merge a=merge on a CLOSED TREE

This commit is contained in:
arthur.iakab 2017-11-24 12:05:22 +02:00
commit 61b76d3643
134 changed files with 1358 additions and 1068 deletions

View file

@ -53,10 +53,7 @@
#include "Logging.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsImageFrame.h"
#include "nsINamed.h"
#include "nsIObserverService.h"
@ -1374,11 +1371,9 @@ nsAccessibilityService::Init()
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
gApplicationAccessible->Init();
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
NS_LITERAL_CSTRING("Active"));
#endif
#ifdef XP_WIN
sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;

View file

@ -7,10 +7,8 @@
#include "Compatibility.h"
#include "mozilla/WindowsVersion.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif // defined(MOZ_CRASHREPORTER)
#include "nsUnicharUtils.h"
#include "nsWindowsDllInterceptor.h"
#include "nsWinUtils.h"
@ -219,11 +217,9 @@ Compatibility::Init()
// Note we collect some AT statistics/telemetry here for convenience.
InitConsumers();
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityInProcClient"),
nsPrintfCString("0x%X", sConsumers));
#endif
// Gather telemetry
uint32_t temp = sConsumers;
@ -411,13 +407,11 @@ UseIAccessibleProxyStub()
return true;
}
#if defined(MOZ_CRASHREPORTER)
// If we reach this point then something is seriously wrong with the
// IAccessible configuration in the computer's registry. Let's annotate this
// so that we can easily determine this condition during crash analysis.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IAccessibleConfig"),
NS_LITERAL_CSTRING("NoSystemTypeLibOrPS"));
#endif // defined(MOZ_CRASHREPORTER)
return false;
}

View file

@ -17,6 +17,7 @@
#include "nsAccessibilityService.h"
#include "nsWindowsHelpers.h"
#include "nsCOMPtr.h"
#include "nsExceptionHandler.h"
#include "nsIFile.h"
#include "nsXPCOM.h"
#include "RootAccessibleWrap.h"
@ -26,10 +27,6 @@
#include "mozilla/Telemetry.h"
#endif // defined(MOZ_TELEMETRY_REPORTING)
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include <oaidl.h>
#if !defined(STATE_SYSTEM_NORMAL)
@ -305,7 +302,7 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
a11y::SetInstantiator(filePath);
}
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#if defined(MOZ_TELEMETRY_REPORTING)
if (!mTelemetryThread) {
// Call GatherTelemetry on a background thread because it does I/O on
// the executable file to retrieve version information.
@ -318,12 +315,12 @@ LazyInstantiator::ShouldInstantiate(const DWORD aClientTid)
new AccumulateRunnable(this)));
NS_NewThread(getter_AddRefs(mTelemetryThread), runnable);
}
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#endif // defined(MOZ_TELEMETRY_REPORTING)
return true;
}
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#if defined(MOZ_TELEMETRY_REPORTING)
/**
* Appends version information in the format "|a.b.c.d".
* If there is no version information, we append nothing.
@ -406,11 +403,9 @@ LazyInstantiator::AccumulateTelemetry(const nsString& aValue)
Telemetry::ScalarSet(Telemetry::ScalarID::A11Y_INSTANTIATORS,
aValue);
#endif // defined(MOZ_TELEMETRY_REPORTING)
#if defined(MOZ_CRASHREPORTER)
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("AccessibilityClient"),
NS_ConvertUTF16toUTF8(aValue));
#endif // defined(MOZ_CRASHREPORTER)
}
if (mTelemetryThread) {
@ -418,7 +413,7 @@ LazyInstantiator::AccumulateTelemetry(const nsString& aValue)
mTelemetryThread = nullptr;
}
}
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#endif // defined(MOZ_TELEMETRY_REPORTING)
RootAccessibleWrap*
LazyInstantiator::ResolveRootAccWrap()

View file

@ -87,7 +87,7 @@ private:
bool ShouldInstantiate(const DWORD aClientTid);
bool GetClientExecutableName(const DWORD aClientTid, nsIFile** aOutClientExe);
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#if defined(MOZ_TELEMETRY_REPORTING)
class AccumulateRunnable final : public Runnable
{
public:
@ -120,7 +120,7 @@ private:
void AppendVersionInfo(nsIFile* aClientExe, nsAString& aStrToAppend);
void GatherTelemetry(nsIFile* aClientExe, AccumulateRunnable* aRunnable);
void AccumulateTelemetry(const nsString& aValue);
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#endif // defined(MOZ_TELEMETRY_REPORTING)
/**
* @return S_OK if we have a valid mRealRoot to invoke methods on
@ -152,9 +152,9 @@ private:
RootAccessibleWrap* mWeakRootAccWrap;
IAccessible* mWeakAccessible;
IDispatch* mWeakDispatch;
#if defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#if defined(MOZ_TELEMETRY_REPORTING)
nsCOMPtr<nsIThread> mTelemetryThread;
#endif // defined(MOZ_TELEMETRY_REPORTING) || defined(MOZ_CRASHREPORTER)
#endif // defined(MOZ_TELEMETRY_REPORTING)
};
} // namespace a11y

View file

@ -86,8 +86,9 @@ add_task(async function navigate() {
});
add_task(async function crash() {
if (!gMultiProcessBrowser || !("nsICrashReporter" in Ci))
if (!gMultiProcessBrowser || !AppConstants.MOZ_CRASHREPORTER) {
return;
}
let tab = BrowserTestUtils.addTab(gBrowser, DUMMY);
let browser = tab.linkedBrowser;

View file

@ -388,20 +388,20 @@ UserProperties.prototype = {
*
* @param {CSSStyleDeclaration} style
* The CSSStyleDeclaration against which the property is to be mapped.
* @param {String} bame
* @param {String} name
* The name of the property to set.
* @param {String} userValue
* The value of the property to set.
*/
setProperty: function (style, bame, userValue) {
let key = this.getKey(style, bame);
setProperty: function (style, name, userValue) {
let key = this.getKey(style, name);
let entry = this.map.get(key, null);
if (entry) {
entry[bame] = userValue;
entry[name] = userValue;
} else {
let props = {};
props[bame] = userValue;
props[name] = userValue;
this.map.set(key, props);
}
},

View file

@ -9,8 +9,7 @@
const promise = require("promise");
const CssLogic = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const {TextProperty} =
require("devtools/client/inspector/rules/models/text-property");
const TextProperty = require("devtools/client/inspector/rules/models/text-property");
const {promiseWarn} = require("devtools/client/inspector/shared/utils");
const {parseNamedDeclarations} = require("devtools/shared/css/parsing-utils");
const Services = require("Services");

View file

@ -212,4 +212,4 @@ TextProperty.prototype = {
}
};
exports.TextProperty = TextProperty;
module.exports = TextProperty;

View file

@ -7,9 +7,12 @@
const {l10n} = require("devtools/shared/inspector/css-logic");
const {ELEMENT_STYLE} = require("devtools/shared/specs/styles");
const Rule = require("devtools/client/inspector/rules/models/rule");
const {InplaceEditor, editableField, editableItem} =
require("devtools/client/shared/inplace-editor");
const {TextPropertyEditor} =
const {
InplaceEditor,
editableField,
editableItem
} = require("devtools/client/shared/inplace-editor");
const TextPropertyEditor =
require("devtools/client/inspector/rules/views/text-property-editor");
const {
createChild,

View file

@ -1040,4 +1040,4 @@ TextPropertyEditor.prototype = {
},
};
exports.TextPropertyEditor = TextPropertyEditor;
module.exports = TextPropertyEditor;

View file

@ -107,4 +107,4 @@ skip-if = !e10s # test is designed to work on e10s only
[test_webextension-addon-debugging-reload.html]
skip-if = !e10s # test is designed to work on e10s only
[test_websocket-server.html]
skip-if = false
skip-if = os == 'mac' # bug 1294873 intermittent leaks

View file

@ -2424,12 +2424,10 @@ nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs)
NS_IMETHODIMP
nsDocShell::SetRemoteTabs(bool aUseRemoteTabs)
{
#ifdef MOZ_CRASHREPORTER
if (aUseRemoteTabs) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("DOMIPCEnabled"),
NS_LITERAL_CSTRING("1"));
}
#endif
mUseRemoteTabs = aUseRemoteTabs;
return NS_OK;

View file

@ -7929,7 +7929,7 @@ CheckCrossStyleBackendAdoption(nsIDocument* aOldDoc,
if (styleDataTypes.isEmpty()) {
return;
}
#ifdef MOZ_CRASHREPORTER
// We are adopting node with pre-existing style data across style
// backend. We want some more information to help diagnose when that
// can happen.
@ -7994,7 +7994,7 @@ CheckCrossStyleBackendAdoption(nsIDocument* aOldDoc,
}
note.Append('\n');
CrashReporter::AppendAppNotesToCrashReport(note);
#endif // MOZ_CRASHREPORTER
MOZ_CRASH("Must not adopt a node with pre-existing style data "
"into a document with different style backend");
}

View file

@ -214,6 +214,7 @@
#include "DomainPolicy.h"
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/net/NeckoMessageUtils.h"
#include "mozilla/widget/PuppetBidiKeyboard.h"
#include "mozilla/RemoteSpellCheckEngineChild.h"
@ -228,9 +229,6 @@
#ifdef MOZ_WIDGET_GTK
#include "nsAppRunner.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#endif
#ifdef MOZ_CODE_COVERAGE
#include "mozilla/CodeCoverageHandler.h"
@ -649,9 +647,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
}
#endif
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingleton(this);
#endif
mID = aChildID;
mIsForBrowser = aIsForBrowser;
@ -1701,7 +1697,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
sandboxEnabled = StartMacOSContentSandbox();
#endif
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("ContentSandboxEnabled"),
sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
@ -1714,7 +1709,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
#endif /* XP_LINUX && !OS_ANDROID */
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("RemoteType"),
NS_ConvertUTF16toUTF8(GetRemoteType()));
#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_CONTENT_SANDBOX */
return IPC_OK();
@ -2349,9 +2343,8 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
}
mIsAlive = false;
# ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
# endif
XRE_ShutdownChildProcess();
#endif // NS_FREE_PERMANENT_DATA
}
@ -2376,10 +2369,9 @@ ContentChild::ProcessingError(Result aCode, const char* aReason)
MOZ_CRASH("not reached");
}
#if defined(MOZ_CRASHREPORTER)
nsDependentCString reason(aReason);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ipc_channel_error"), reason);
#endif
MOZ_CRASH("Content child abort due to IPC error");
}
@ -2960,10 +2952,9 @@ ContentChild::RecvShutdown()
// to wait for that event loop to finish. Otherwise we could prematurely
// terminate an "unload" or "pagehide" event handler (which might be doing a
// sync XHR, for example).
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
NS_LITERAL_CSTRING("RecvShutdown"));
#endif
MOZ_ASSERT(NS_IsMainThread());
RefPtr<nsThread> mainThread = nsThreadManager::get().GetCurrentThread();
// Note that we only have to check the recursion count for the current
@ -3019,18 +3010,13 @@ ContentChild::RecvShutdown()
// parent closes.
StartForceKillTimer();
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
NS_LITERAL_CSTRING("SendFinishShutdown (sending)"));
bool sent = SendFinishShutdown();
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
sent ? NS_LITERAL_CSTRING("SendFinishShutdown (sent)")
: NS_LITERAL_CSTRING("SendFinishShutdown (failed)"));
#else
// Ignore errors here. If this fails, the parent will kill us after a
// timeout.
Unused << SendFinishShutdown();
#endif
return IPC_OK();
}

View file

@ -67,6 +67,7 @@
#include "mozilla/hal_sandbox/PHalParent.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/FileDescriptorUtils.h"
#include "mozilla/ipc/PChildToParentStreamParent.h"
#include "mozilla/ipc/TestShellParent.h"
@ -150,6 +151,7 @@
#include "nsIDOMChromeWindow.h"
#include "nsIWindowWatcher.h"
#include "nsPIWindowWatcher.h"
#include "nsThread.h"
#include "nsWindowWatcher.h"
#include "nsIXULRuntime.h"
#include "mozilla/dom/nsMixedContentBlocker.h"
@ -248,11 +250,6 @@
#include "mozilla/widget/AudioSession.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsThread.h"
#include "mozilla/ipc/CrashReporterHost.h"
#endif
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@ -273,9 +270,7 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
using base::KillProcess;
#ifdef MOZ_CRASHREPORTER
using namespace CrashReporter;
#endif
using namespace mozilla::dom::power;
using namespace mozilla::media;
using namespace mozilla::embedding;
@ -1730,7 +1725,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
#ifdef MOZ_CRASHREPORTER
// There's a window in which child processes can crash
// after IPC is established, but before a crash reporter
// is created.
@ -1747,7 +1741,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
}
props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
}
#endif
}
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
@ -3060,7 +3053,6 @@ ContentParent::KillHard(const char* aReason)
mCalledKillHard = true;
mForceKillTimer = nullptr;
#if defined(MOZ_CRASHREPORTER)
// We're about to kill the child process associated with this content.
// Something has gone wrong to get us here, so we generate a minidump
// of the parent and child for submission to the crash server.
@ -3093,19 +3085,17 @@ ContentParent::KillHard(const char* aReason)
true);
return;
}
#endif
OnGenerateMinidumpComplete(false);
}
void
ContentParent::OnGenerateMinidumpComplete(bool aDumpResult)
{
#if defined(MOZ_CRASHREPORTER)
if (mCrashReporter && aDumpResult) {
// CrashReporterHost::GenerateMinidumpAndPair() is successful.
mCreatedPairedMinidumps = mCrashReporter->FinalizeCrashReport();
}
#endif
Unused << aDumpResult; // Don't care about result if no minidump was requested.
@ -3146,12 +3136,11 @@ ContentParent::FriendlyName(nsAString& aName, bool aAnonymize)
mozilla::ipc::IPCResult
ContentParent::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<CrashReporterHost>(
GeckoProcessType_Content,
aShmem,
aThreadId);
#endif
return IPC_OK();
}
@ -4947,9 +4936,7 @@ ContentParent::RecvNotifyLowMemory()
Telemetry::ScalarAdd(Telemetry::ScalarID::DOM_CONTENTPROCESS_TROUBLED_DUE_TO_MEMORY, 1);
#ifdef MOZ_CRASHREPORTER
nsThread::SaveMemoryReportNearOOM(nsThread::ShouldSaveMemoryReport::kForceReport);
#endif
return IPC_OK();
}

View file

@ -1283,9 +1283,8 @@ private:
nsTHashtable<nsCStringHashKey> mActivePermissionKeys;
nsTArray<nsCString> mBlobURLs;
#ifdef MOZ_CRASHREPORTER
UniquePtr<mozilla::ipc::CrashReporterHost> mCrashReporter;
#endif
static uint64_t sNextTabParentId;
static nsDataHashtable<nsUint64HashKey, TabParent*> sNextTabParents;

View file

@ -23,14 +23,12 @@
#include "mozilla/Unused.h"
#include "mozilla/WeakPtr.h"
#include "nsExceptionHandler.h"
#include "nsIFrameLoader.h"
#include "nsIHangReport.h"
#include "nsITabParent.h"
#include "nsPluginHost.h"
#include "nsThreadUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "base/task.h"
#include "base/thread.h"
@ -610,7 +608,6 @@ HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor)
HangMonitorParent::~HangMonitorParent()
{
#ifdef MOZ_CRASHREPORTER
MutexAutoLock lock(mBrowserCrashDumpHashLock);
for (auto iter = mBrowserCrashDumpIds.Iter(); !iter.Done(); iter.Next()) {
@ -619,7 +616,6 @@ HangMonitorParent::~HangMonitorParent()
CrashReporter::DeleteMinidumpFilesForID(crashId);
}
}
#endif
}
void
@ -772,7 +768,6 @@ bool
HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
nsString& aCrashId)
{
#ifdef MOZ_CRASHREPORTER
MutexAutoLock lock(mBrowserCrashDumpHashLock);
if (!mBrowserCrashDumpIds.Get(aPhd.pluginId(), &aCrashId)) {
nsCOMPtr<nsIFile> browserDump;
@ -788,7 +783,6 @@ HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
}
}
}
#endif // MOZ_CRASHREPORTER
return false;
}
@ -891,11 +885,10 @@ HangMonitorParent::CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles)
return;
}
mBrowserCrashDumpIds.Remove(aPluginId);
#ifdef MOZ_CRASHREPORTER
if (aRemoveFiles && !crashId.IsEmpty()) {
CrashReporter::DeleteMinidumpFilesForID(crashId);
}
#endif
}
void

View file

@ -59,9 +59,7 @@
#include "nsEmbedCID.h"
#include "nsGlobalWindow.h"
#include <algorithm>
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsFilePickerProxy.h"
#include "mozilla/dom/Element.h"
#include "nsGlobalWindow.h"
@ -1194,9 +1192,7 @@ TabChild::RecvLoadURL(const nsCString& aURI,
NS_WARNING("WebNavigation()->LoadURI failed. Eating exception, what else can I do?");
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), aURI);
#endif
return IPC_OK();
}

View file

@ -8,14 +8,11 @@
#define TABMESSAGE_UTILS_H
#include "ipc/IPCMessageUtils.h"
#include "nsExceptionHandler.h"
#include "nsIDOMEvent.h"
#include "nsPIDOMWindow.h"
#include "nsCOMPtr.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace dom {
struct RemoteDOMEvent
@ -27,12 +24,7 @@ struct RemoteDOMEvent
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
mozilla::dom::RemoteDOMEvent* aResult);
#ifdef MOZ_CRASHREPORTER
typedef CrashReporter::ThreadId NativeThreadId;
#else
// unused in this case
typedef int32_t NativeThreadId;
#endif
} // namespace dom
} // namespace mozilla

View file

@ -246,9 +246,7 @@ GMPChild::Init(const nsAString& aPluginPath,
return false;
}
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingleton(this);
#endif
mPluginPath = aPluginPath;
@ -617,9 +615,8 @@ GMPChild::ActorDestroy(ActorDestroyReason aWhy)
ProcessChild::QuickExit();
}
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

View file

@ -7,11 +7,13 @@
#include "mozilla/Logging.h"
#include "nsComponentManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsPrintfCString.h"
#include "nsThreadUtils.h"
#include "nsIRunnable.h"
#include "nsIWritablePropertyBag2.h"
#include "mozIGeckoMediaPluginService.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/SSE.h"
#include "mozilla/SyncRunnable.h"
@ -28,12 +30,8 @@
using mozilla::ipc::GeckoChildProcessHost;
#ifdef MOZ_CRASHREPORTER
#include "nsPrintfCString.h"
#include "mozilla/ipc/CrashReporterHost.h"
using CrashReporter::AnnotationTable;
using CrashReporter::GetIDFromMinidump;
#endif
#include "mozilla/Telemetry.h"
@ -452,7 +450,6 @@ GMPParent::EnsureProcessLoaded()
return NS_SUCCEEDED(rv);
}
#ifdef MOZ_CRASHREPORTER
void
GMPParent::WriteExtraDataForMinidump()
{
@ -497,12 +494,12 @@ GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, cons
service->RunPluginCrashCallbacks(aPluginID, aPluginName);
}
}
#endif
void
GMPParent::ActorDestroy(ActorDestroyReason aWhy)
{
LOGD("%s: (%d)", __FUNCTION__, (int)aWhy);
#ifdef MOZ_CRASHREPORTER
if (AbnormalShutdown == aWhy) {
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("gmplugin"), 1);
@ -519,7 +516,7 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
&GMPNotifyObservers, mPluginId, mDisplayName, dumpID);
mMainThread->Dispatch(r.forget());
}
#endif
// warn us off trying to close again
mState = GMPStateClosing;
mAbnormalShutdownInProgress = true;
@ -540,12 +537,11 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
mozilla::ipc::IPCResult
GMPParent::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GMPlugin,
aShmem,
aThreadId);
#endif
return IPC_OK();
}

View file

@ -153,10 +153,8 @@ private:
RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile);
RefPtr<GenericPromise> ParseChromiumManifest(const nsAString& aJSON); // Main thread.
RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
#ifdef MOZ_CRASHREPORTER
void WriteExtraDataForMinidump();
bool GetCrashID(nsString& aResult);
#endif
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvInitCrashReporter(Shmem&& shmem, const NativeThreadId& aThreadId) override;
@ -217,9 +215,7 @@ private:
// to terminate gracefully.
bool mHoldingSelfRef;
#ifdef MOZ_CRASHREPORTER
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
#endif
const RefPtr<AbstractThread> mMainThread;
};

View file

@ -11,6 +11,7 @@
#include <cstdlib>
#include <stdio.h>
#include "prio.h"
#include "nsExceptionHandler.h"
#include "nsNPAPIPlugin.h"
#include "nsNPAPIPluginStreamListener.h"
#include "nsNPAPIPluginInstance.h"
@ -103,10 +104,6 @@
#include "winbase.h"
#endif
#if MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "npapi.h"
using namespace mozilla;

View file

@ -26,9 +26,7 @@
#include "mozilla/UniquePtr.h"
#include "nsCocoaFeatures.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include <string.h>
#include <stdio.h>
@ -424,14 +422,13 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
NS_WARNING(msg.get());
return NS_ERROR_FAILURE;
}
#if defined(MOZ_CRASHREPORTER)
// The block above assumes that "fbplugin" is the filename of the plugin
// to be blocked, or that the filename starts with "fbplugin_". But we
// don't yet know for sure if this is always true. So for the time being
// record extra information in our crash logs.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
fileName);
#endif
}
// It's possible that our plugin has 2 entry points that'll give us mime type
@ -441,14 +438,14 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
// Sadly we have to load the library for this to work.
rv = LoadPlugin(outLibrary);
#if defined(MOZ_CRASHREPORTER)
if (nsCocoaFeatures::OnYosemiteOrLater()) {
// If we didn't crash in LoadPlugin(), change the previous annotation so we
// don't sow confusion.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
NS_LITERAL_CSTRING("Didn't crash, please ignore"));
}
#endif
if (NS_FAILED(rv))
return rv;

View file

@ -22,10 +22,9 @@
#include "nsString.h"
#include "nsTArray.h"
#include "mozilla/Logging.h"
#include "nsHashKeys.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsHashKeys.h"
#ifdef XP_MACOSX
#include "PluginInterposeOSX.h"
#else

View file

@ -27,6 +27,8 @@
# include "nsX11ErrorHandler.h"
# include "mozilla/X11Util.h"
#endif
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/plugins/PluginInstanceChild.h"
#include "mozilla/plugins/StreamNotifyChild.h"
@ -48,10 +50,6 @@
#include "PluginUtilsOSX.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#endif
#ifdef MOZ_GECKO_PROFILER
#include "ChildProfilerController.h"
#endif
@ -750,10 +748,9 @@ PluginModuleChild::RecvInitPluginModuleChild(Endpoint<PPluginModuleChild>&& aEnd
mozilla::ipc::IPCResult
PluginModuleChild::AnswerInitCrashReporter(Shmem&& aShmem, mozilla::dom::NativeThreadId* aOutId)
{
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::InitSingletonWithShmem(aShmem);
*aOutId = CrashReporter::CurrentThreadId();
#endif
return IPC_OK();
}
@ -792,9 +789,8 @@ PluginModuleChild::ActorDestroy(ActorDestroyReason why)
// doesn't matter why we're being destroyed; it's up to us to
// initiate (clean) shutdown
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

View file

@ -10,6 +10,8 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h"
@ -65,12 +67,7 @@ using namespace mozilla;
using namespace mozilla::plugins;
using namespace mozilla::plugins::parent;
#ifdef MOZ_CRASHREPORTER
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/CrashReporterHost.h"
using namespace CrashReporter;
#endif
static const char kContentTimeoutPref[] = "dom.ipc.plugins.contentTimeoutSecs";
static const char kChildTimeoutPref[] = "dom.ipc.plugins.timeoutSecs";
@ -525,7 +522,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
RegisterSettingsCallbacks();
#ifdef MOZ_CRASHREPORTER
// If this fails, we're having IPC troubles, and we're doomed anyways.
if (!InitCrashReporter()) {
mShutdown = true;
@ -533,7 +529,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
OnInitFailure();
return;
}
#endif
#if defined(XP_WIN) && defined(_X86_)
// Protected mode only applies to Windows and only to x86.
@ -552,7 +547,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
bool
PluginModuleChromeParent::InitCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
ipc::Shmem shmem;
if (!ipc::CrashReporterClient::AllocShmem(this, &shmem)) {
return false;
@ -570,7 +564,6 @@ PluginModuleChromeParent::InitCrashReporter()
shmem,
threadId);
}
#endif
return true;
}
@ -588,9 +581,7 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome)
, mTaskFactory(this)
, mSandboxLevel(0)
, mIsFlashPlugin(false)
#ifdef MOZ_CRASHREPORTER
, mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
#endif
{
}
@ -702,7 +693,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
mozilla::HangMonitor::UnregisterAnnotator(*this);
}
#ifdef MOZ_CRASHREPORTER
void
PluginModuleChromeParent::WriteExtraDataForMinidump()
{
@ -744,7 +734,6 @@ PluginModuleChromeParent::WriteExtraDataForMinidump()
#endif
}
}
#endif // MOZ_CRASHREPORTER
void
PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
@ -1000,7 +989,6 @@ PluginModuleChromeParent::AnnotateHang(mozilla::HangMonitor::HangAnnotations& aA
}
}
#ifdef MOZ_CRASHREPORTER
static bool
CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
nsIFile* parentMinidump, const nsACString& name)
@ -1012,7 +1000,6 @@ CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
}
return CreateAdditionalChildMinidump(handle, 0, parentMinidump, name);
}
#endif
bool
PluginModuleChromeParent::ShouldContinueFromReplyTimeout()
@ -1067,7 +1054,6 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
std::function<void(nsString)>&& aCallback,
bool aAsync)
{
#ifdef MOZ_CRASHREPORTER
mozilla::MutexAutoLock lock(mCrashReporterMutex);
if (!mCrashReporter || !mTakeFullMinidumpCallback.IsEmpty()) {
@ -1111,12 +1097,8 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
} else {
TakeBrowserAndPluginMinidumps(false, aContentPid, browserDumpId, aAsync);
}
#else // MOZ_CRASHREPORTER
aCallback(NS_LITERAL_STRING(""));
#endif
}
#ifdef MOZ_CRASHREPORTER
void
PluginModuleChromeParent::RetainPluginRef()
{
@ -1235,8 +1217,6 @@ PluginModuleChromeParent::OnTakeFullMinidumpComplete(bool aReportsReady,
}
}
#endif // MOZ_CRASHREPORTER
void
PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
base::ProcessId aContentPid,
@ -1251,7 +1231,6 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
}
mTerminateChildProcessCallback.Init(Move(aCallback), aAsync);
#ifdef MOZ_CRASHREPORTER
// Start by taking a full minidump if necessary, this is done early
// because it also needs to lock the mCrashReporterMutex and Mutex doesn't
// support recursive locking.
@ -1276,17 +1255,12 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
} else {
TerminateChildProcessOnDumpComplete(aMsgLoop, aMonitorDescription);
}
#else
TerminateChildProcessOnDumpComplete(aMsgLoop, aMonitorDescription);
#endif
}
void
PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgLoop,
const nsCString& aMonitorDescription)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporterMutex.AssertCurrentThreadOwns();
if (!mCrashReporter) {
@ -1310,7 +1284,6 @@ PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgL
}
}
#endif // XP_WIN
#endif // MOZ_CRASHREPORTER
mozilla::ipc::ScopedProcessHandle geckoChildProcess;
bool childOpened = base::OpenProcessHandle(OtherPid(),
@ -1341,7 +1314,7 @@ PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgL
if (!GetProcessCpuUsage(processHandles, mPluginCpuUsageOnHang)) {
mPluginCpuUsageOnHang.Clear();
}
#endif // MOZ_CRASHREPORTER
#endif
// this must run before the error notification from the channel,
// or not at all
@ -1486,7 +1459,6 @@ PluginModuleChromeParent::OnHangUIContinue()
}
#endif // XP_WIN
#ifdef MOZ_CRASHREPORTER
#ifdef MOZ_CRASHREPORTER_INJECTOR
static void
RemoveMinidump(nsIFile* minidump)
@ -1578,7 +1550,6 @@ PluginModuleChromeParent::ProcessFirstMinidump()
}
mCrashReporter->FinalizeCrashReport();
}
#endif
void
PluginModuleParent::ActorDestroy(ActorDestroyReason why)
@ -1617,9 +1588,7 @@ void
PluginModuleChromeParent::ActorDestroy(ActorDestroyReason why)
{
if (why == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
ProcessFirstMinidump();
#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("plugin"), 1);
}
@ -1656,11 +1625,11 @@ PluginModuleParent::NotifyPluginCrashed()
nsString dumpID;
nsString browserDumpID;
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter && mCrashReporter->HasMinidump()) {
dumpID = mCrashReporter->MinidumpID();
}
#endif
mPlugin->PluginCrashed(dumpID, browserDumpID);
}

View file

@ -21,6 +21,7 @@
#include "mozilla/Unused.h"
#include "npapi.h"
#include "npfunctions.h"
#include "nsExceptionHandler.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIObserver.h"
@ -31,10 +32,6 @@
#endif
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
class nsPluginTag;
namespace mozilla {
@ -334,7 +331,6 @@ protected:
RefPtr<layers::TextureClientRecycleAllocator> mTextureAllocatorForDirectBitmap;
RefPtr<layers::TextureClientRecycleAllocator> mTextureAllocatorForDXGISurface;
#ifdef MOZ_CRASHREPORTER
/**
* This mutex protects the crash reporter when the Plugin Hang UI event
* handler is executing off main thread. It is intended to protect both
@ -343,7 +339,6 @@ protected:
*/
mozilla::Mutex mCrashReporterMutex;
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
#endif // MOZ_CRASHREPORTER
};
class PluginModuleContentParent : public PluginModuleParent
@ -458,7 +453,6 @@ class PluginModuleChromeParent
}
private:
#ifdef MOZ_CRASHREPORTER
// The following methods are callbacks invoked after calling
// TakeFullMinidump(). The methods are invoked in the following order:
void TakeBrowserAndPluginMinidumps(bool aReportsReady,
@ -469,7 +463,7 @@ class PluginModuleChromeParent
base::ProcessId aContentPid,
const nsAString& aBrowserDumpId);
#endif
// The following method is the callback invoked after calling
// TerminateChidlProcess().
void TerminateChildProcessOnDumpComplete(MessageLoop* aMsgLoop,
@ -518,12 +512,10 @@ private:
virtual bool ShouldContinueFromReplyTimeout() override;
#ifdef MOZ_CRASHREPORTER
void ProcessFirstMinidump();
void WriteExtraDataForMinidump();
void RetainPluginRef();
void ReleasePluginRef();
#endif
PluginProcessParent* Process() const { return mSubprocess; }
base::ProcessHandle ChildProcessHandle() { return mSubprocess->GetChildProcessHandle(); }
@ -641,10 +633,9 @@ private:
mozilla::SandboxPermissions mSandboxPermissions;
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsIFile> mBrowserDumpFile;
TakeFullMinidumpCallback mTakeFullMinidumpCallback;
#endif
TerminateChildProcessCallback mTerminateChildProcessCallback;
};

View file

@ -669,6 +669,13 @@ RespondWithHandler::ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValu
}
}
Telemetry::ScalarAdd(Telemetry::ScalarID::SW_SYNTHESIZED_RES_COUNT, 1);
if (mRequestMode == RequestMode::Same_origin &&
response->Type() == ResponseType::Cors) {
Telemetry::ScalarAdd(Telemetry::ScalarID::SW_CORS_RES_FOR_SO_REQ_COUNT, 1);
}
UniquePtr<RespondWithClosure> closure(new RespondWithClosure(mInterceptedChannel,
mRegistration,
mRequestURL,

View file

@ -217,7 +217,10 @@ GLContextEGLFactory::Create(EGLNativeWindowType aWindow,
gl->MakeCurrent();
gl->SetIsDoubleBuffered(doubleBuffered);
if (aWebRender && sEGLLibrary.IsANGLE()) {
MOZ_ASSERT(doubleBuffered);
sEGLLibrary.fSwapInterval(EGL_DISPLAY(), 0);
}
return gl.forget();
}

View file

@ -413,6 +413,7 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
SYMBOL(QueryContext),
SYMBOL(BindTexImage),
SYMBOL(ReleaseTexImage),
SYMBOL(SwapInterval),
SYMBOL(QuerySurface),
END_OF_SYMBOLS
};

View file

@ -256,6 +256,9 @@ public:
EGLBoolean fReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) const
WRAP( fReleaseTexImage(dpy, surface, buffer) )
EGLBoolean fSwapInterval(EGLDisplay dpy, EGLint interval) const
WRAP( fSwapInterval(dpy, interval) )
EGLImage fCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint* attrib_list) const
WRAP( fCreateImageKHR(dpy, ctx, target, buffer, attrib_list) )
@ -433,6 +436,7 @@ private:
EGLint buffer);
EGLBoolean (GLAPIENTRY * fReleaseTexImage)(EGLDisplay, EGLSurface surface,
EGLint buffer);
EGLBoolean (GLAPIENTRY * fSwapInterval)(EGLDisplay dpy, EGLint interval);
EGLImage (GLAPIENTRY * fCreateImageKHR)(EGLDisplay dpy, EGLContext ctx,
EGLenum target, EGLClientBuffer buffer,
const EGLint* attrib_list);

View file

@ -6,13 +6,10 @@
#include <string>
#include <sstream>
#include "nsExceptionHandler.h"
#include "GfxTexturesReporter.h"
#include "gfxPrefs.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
using namespace mozilla;
using namespace mozilla::gl;
@ -76,7 +73,5 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
}
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateTexturesSize(sAmount);
#endif
}

View file

@ -144,12 +144,11 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
mozilla::ipc::IPCResult
GPUChild::RecvInitCrashReporter(Shmem&& aShmem, const NativeThreadId& aThreadId)
{
#ifdef MOZ_CRASHREPORTER
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
GeckoProcessType_GPU,
aShmem,
aThreadId);
#endif
return IPC_OK();
}
@ -252,12 +251,10 @@ void
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
#ifdef MOZ_CRASHREPORTER
if (mCrashReporter) {
mCrashReporter->GenerateCrashReport(OtherPid());
mCrashReporter = nullptr;
}
#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU)), 1);

View file

@ -100,10 +100,8 @@ GPUParent::Init(base::ProcessId aParentPid,
// versions.
GetIPCChannel()->SendBuildID();
#ifdef MOZ_CRASHREPORTER
// Init crash reporter support.
CrashReporterClient::InitSingleton(this);
#endif
// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
@ -471,9 +469,7 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
gfxVars::Shutdown();
gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
#ifdef MOZ_CRASHREPORTER
CrashReporterClient::DestroySingleton();
#endif
XRE_ShutdownChildProcess();
}

View file

@ -39,11 +39,8 @@
#include "mozilla/dom/VideoDecoderManagerChild.h"
#include "mozilla/dom/VideoDecoderManagerParent.h"
#include "MediaPrefs.h"
#include "nsPrintfCString.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsPrintfCString.h"
#if defined(MOZ_WIDGET_ANDROID)
#include "mozilla/widget/AndroidUiThread.h"
@ -368,7 +365,6 @@ GPUProcessManager::OnProcessLaunchComplete(GPUProcessHost* aHost)
mVsyncBridge = VsyncBridgeChild::Create(mVsyncIOThread, mProcessToken, Move(vsyncChild));
mGPUChild->SendInitVsyncBridge(Move(vsyncParent));
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Running"));
@ -376,7 +372,6 @@ GPUProcessManager::OnProcessLaunchComplete(GPUProcessHost* aHost)
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessLaunchCount"),
nsPrintfCString("%d", mNumProcessAttempts));
#endif
}
static bool
@ -717,11 +712,9 @@ GPUProcessManager::DestroyProcess()
mVsyncBridge = nullptr;
}
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("GPUProcessStatus"),
NS_LITERAL_CSTRING("Destroyed"));
#endif
}
already_AddRefed<CompositorSession>

View file

@ -9,9 +9,7 @@
#include "gfxConfig.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
@ -167,11 +165,9 @@ DriverCrashGuard::~DriverCrashGuard()
dom::ContentChild::GetSingleton()->SendEndDriverCrashGuard(uint32_t(mType));
}
#ifdef MOZ_CRASHREPORTER
// Remove the crash report annotation.
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
NS_LITERAL_CSTRING(""));
#endif
}
bool
@ -210,7 +206,6 @@ DriverCrashGuard::ActivateGuard()
{
mGuardActivated = true;
#ifdef MOZ_CRASHREPORTER
// Anotate crash reports only if we're a real guard. Otherwise, we could
// attribute a random parent process crash to a graphics problem in a child
// process.
@ -218,7 +213,6 @@ DriverCrashGuard::ActivateGuard()
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
NS_LITERAL_CSTRING("1"));
}
#endif
// If we're in the content process, the rest of the guarding is handled
// in the parent.

View file

@ -5,13 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxCrashReporterUtils.h"
#if defined(MOZ_CRASHREPORTER)
#define MOZ_GFXFEATUREREPORTER 1
#endif
#ifdef MOZ_GFXFEATUREREPORTER
#include "gfxCrashReporterUtils.h"
#include <string.h> // for strcmp
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/Services.h" // for GetObserverService
@ -137,13 +130,3 @@ ScopedGfxFeatureReporter::AppNote(const nsACString& aMessage)
}
} // end namespace mozilla
#else
namespace mozilla {
void ScopedGfxFeatureReporter::WriteAppNote(char) {}
void ScopedGfxFeatureReporter::AppNote(const nsACString&) {}
} // namespace mozilla
#endif

View file

@ -81,7 +81,6 @@ TEST(GfxPrefs, Set) {
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
}
#ifdef MOZ_CRASHREPORTER
// Randomly test the function we use in nsExceptionHandler.cpp here:
extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
TEST(GfxPrefs, StringUtility)
@ -104,4 +103,3 @@ TEST(GfxPrefs, StringUtility)
// It won't fit into 32:
ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2));
}
#endif

View file

@ -21,16 +21,13 @@
#include "mozilla/layers/DeviceAttachmentsD3D11.h"
#include "mozilla/layers/MLGDeviceD3D11.h"
#include "mozilla/layers/PaintThread.h"
#include "nsExceptionHandler.h"
#include "nsIGfxInfo.h"
#include "nsPrintfCString.h"
#include "nsString.h"
#include <d3d11.h>
#include <ddraw.h>
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif
namespace mozilla {
namespace gfx {
@ -772,12 +769,10 @@ DeviceManagerDx::MaybeResetAndReacquireDevices()
Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason));
}
#ifdef MOZ_CRASHREPORTER
nsPrintfCString reasonString("%d", int(resetReason));
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("DeviceResetReason"),
reasonString);
#endif
bool createCompositorDevice = !!mCompositorDevice;
bool createContentDevice = !!mContentDevice;

View file

@ -70,6 +70,7 @@
#include "gfxGradientCache.h"
#include "gfxUtils.h" // for NextPowerOfTwo
#include "nsExceptionHandler.h"
#include "nsUnicodeRange.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
@ -77,9 +78,6 @@
#include "nsIScreenManager.h"
#include "FrameMetrics.h"
#include "MainThreadUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsWeakReference.h"
@ -298,12 +296,9 @@ void CrashStatsLogForwarder::UpdateCrashReport()
message << logAnnotation << Get<0>(it) << "]" << Get<1>(it) << " (t=" << Get<2>(it) << ") ";
}
#ifdef MOZ_CRASHREPORTER
nsCString reportString(message.str().c_str());
nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString);
#else
nsresult annotated = NS_ERROR_NOT_IMPLEMENTED;
#endif
if (annotated != NS_OK) {
printf("Crash Annotation %s: %s",
mCrashCriticalKey.get(), message.str().c_str());

View file

@ -954,6 +954,13 @@ VectorImage::Draw(gfxContext* aContext,
SendOnUnlockedDraw(aFlags);
}
// We should always bypass the cache when using DrawTargetRecording because
// we prefer the drawing commands in general to the rasterized surface. This
// allows blob images to avoid rasterized SVGs with WebRender.
if (aContext->GetDrawTarget()->GetBackendType() == BackendType::RECORDING) {
aFlags |= FLAG_BYPASS_SURFACE_CACHE;
}
MOZ_ASSERT(!(aFlags & FLAG_FORCE_PRESERVEASPECTRATIO_NONE) ||
(aSVGContext && aSVGContext->GetViewportSize()),
"Viewport size is required when using "

View file

@ -8,7 +8,6 @@
#include "CrashReporterMetadataShmem.h"
#include "nsISupportsImpl.h"
#ifdef MOZ_CRASHREPORTER
namespace mozilla {
namespace ipc {
@ -65,4 +64,3 @@ CrashReporterClient::GetSingleton()
} // namespace ipc
} // namespace mozilla
#endif // MOZ_CRASHREPORTER

View file

@ -12,7 +12,6 @@
#include "mozilla/Unused.h"
#include "mozilla/ipc/Shmem.h"
#ifdef MOZ_CRASHREPORTER
namespace mozilla {
namespace ipc {
@ -78,7 +77,6 @@ private:
} // namespace ipc
} // namespace mozilla
#endif // MOZ_CRASHREPORTER
#endif // mozilla_ipc_CrashReporterClient_h

View file

@ -10,11 +10,9 @@
#include "mozilla/Sprintf.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/Telemetry.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsIAsyncShutdown.h"
#include "nsICrashService.h"
#endif
namespace mozilla {
namespace ipc {
@ -30,7 +28,6 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType,
{
}
#ifdef MOZ_CRASHREPORTER
bool
CrashReporterHost::GenerateCrashReport(base::ProcessId aPid)
{
@ -288,7 +285,6 @@ CrashReporterHost::AddNote(const nsCString& aKey, const nsCString& aValue)
{
mExtraNotes.Put(aKey, aValue);
}
#endif
} // namespace ipc
} // namespace mozilla

View file

@ -12,9 +12,7 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/ipc/Shmem.h"
#include "base/process.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsThreadUtils.h"
namespace mozilla {
@ -30,13 +28,8 @@ class GeckoChildProcessHost;
class CrashReporterHost
{
typedef mozilla::ipc::Shmem Shmem;
#ifdef MOZ_CRASHREPORTER
typedef CrashReporter::AnnotationTable AnnotationTable;
typedef CrashReporter::ThreadId ThreadId;
#else
// unused in this case
typedef int32_t ThreadId;
#endif
public:
@ -99,7 +92,6 @@ public:
const Shmem& aShmem,
ThreadId aThreadId);
#ifdef MOZ_CRASHREPORTER
// Helper function for generating a crash report for a process that probably
// crashed (i.e., had an AbnormalShutdown in ActorDestroy). Returns true if
// the process has a minidump attached and we were able to generate a report.
@ -149,7 +141,6 @@ public:
MOZ_ASSERT(HasMinidump());
return mDumpID;
}
#endif
private:
static void AsyncAddCrash(int32_t aProcessType, int32_t aCrashType,
@ -161,9 +152,7 @@ private:
Shmem mShmem;
ThreadId mThreadId;
time_t mStartTime;
#ifdef MOZ_CRASHREPORTER
AnnotationTable mExtraNotes;
#endif
nsString mDumpID;
bool mFinalized;
nsCOMPtr<nsIFile> mTargetDump;

View file

@ -208,7 +208,6 @@ private:
EntryType mEntryType;
};
#ifdef MOZ_CRASHREPORTER
void
CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes)
{
@ -229,7 +228,6 @@ CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::Ann
}
}
}
#endif
} // namespace ipc
} // namespace mozilla

View file

@ -28,9 +28,7 @@ public:
void AnnotateCrashReport(const nsCString& aKey, const nsCString& aData);
void AppendAppNotes(const nsCString& aData);
#ifdef MOZ_CRASHREPORTER
static void ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes);
#endif
private:
void SyncNotesToShmem();

View file

@ -224,11 +224,9 @@ GeckoChildProcessHost::GetUniqueID()
void
GeckoChildProcessHost::PrepareLaunch()
{
#ifdef MOZ_CRASHREPORTER
if (CrashReporter::GetEnabled()) {
CrashReporter::OOPInit();
}
#endif
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
SandboxLaunchPrepare(mProcessType, mLaunchOptions.get());
@ -755,9 +753,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// always populated (but possibly with an empty value) for a GPU child process.
if (mProcessType == GeckoProcessType_GPU) {
nsCOMPtr<nsIFile> file;
# ifdef MOZ_CRASHREPORTER
CrashReporter::GetChildProcessTmpDir(getter_AddRefs(file));
# endif // MOZ_CRASHREPORTER
nsAutoCString path;
if (file) {
file->GetNativePath(path);
@ -767,26 +763,27 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
childArgv.push_back(pidstring);
# if defined(MOZ_CRASHREPORTER)
if (!CrashReporter::IsDummy()) {
#if defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
int childCrashFd, childCrashRemapFd;
if (!CrashReporter::CreateNotificationPipeForChild(
&childCrashFd, &childCrashRemapFd))
if (!CrashReporter::CreateNotificationPipeForChild(&childCrashFd,
&childCrashRemapFd)) {
return false;
}
if (0 <= childCrashFd) {
mLaunchOptions->fds_to_remap
.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd));
// "true" == crash reporting enabled
childArgv.push_back("true");
}
else {
} else {
// "false" == crash reporting disabled
childArgv.push_back("false");
}
#elif defined(MOZ_WIDGET_COCOA) // defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
childArgv.push_back(CrashReporter::GetChildNotificationPipe());
#endif // defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
# endif // defined(MOZ_CRASHREPORTER)
}
# ifdef MOZ_WIDGET_COCOA
// Add a mach port to the command line so the child can communicate its
@ -1000,9 +997,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// always populated (but possibly with an empty value) for a GPU child process.
if (mProcessType == GeckoProcessType_GPU) {
nsCOMPtr<nsIFile> file;
# ifdef MOZ_CRASHREPORTER
CrashReporter::GetChildProcessTmpDir(getter_AddRefs(file));
# endif // MOZ_CRASHREPORTER
nsString path;
if (file) {
MOZ_ALWAYS_SUCCEEDS(file->GetPath(path));
@ -1014,10 +1009,8 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// Process id
cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
# if defined(MOZ_CRASHREPORTER)
cmdLine.AppendLooseValue(
UTF8ToWide(CrashReporter::GetChildNotificationPipe()));
# endif // defined(MOZ_CRASHREPORTER)
// Process type
cmdLine.AppendLooseValue(UTF8ToWide(childProcessType));

View file

@ -25,9 +25,7 @@
#include <stdint.h>
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsID.h"
#include "nsIWidget.h"
#include "nsMemory.h"
@ -127,16 +125,12 @@ struct EnumSerializer {
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
uintParamType value;
if (!ReadParam(aMsg, aIter, &value)) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
NS_LITERAL_CSTRING("Bad iter"));
#endif
return false;
} else if (!EnumValidator::IsLegalValue(paramType(value))) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
NS_LITERAL_CSTRING("Illegal value"));
#endif
return false;
}
*aResult = paramType(value);

View file

@ -674,10 +674,8 @@ void
MessageChannel::WillDestroyCurrentMessageLoop()
{
#if defined(DEBUG)
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProtocolName"),
nsDependentCString(mName));
#endif
MOZ_CRASH("MessageLoop destroyed before MessageChannel that's bound to it");
#endif
@ -701,10 +699,8 @@ MessageChannel::Clear()
#if !defined(ANDROID)
if (!Unsound_IsClosed()) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProtocolName"),
nsDependentCString(mName));
#endif
MOZ_CRASH("MessageChannel destroyed without being closed");
}
#endif

View file

@ -14,9 +14,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/DebugOnly.h"
#include "nsDebug.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsISupportsImpl.h"
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
@ -161,10 +159,8 @@ void
ProcessLink::SendMessage(Message *msg)
{
if (msg->size() > IPC::Channel::kMaximumMessageSize) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageName"), nsDependentCString(msg->name()));
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageSize"), nsPrintfCString("%d", msg->size()));
#endif
MOZ_CRASH("IPC message size is too large");
}

View file

@ -28,7 +28,7 @@
#include "mozilla/sandboxTarget.h"
#endif
#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
#if defined(XP_WIN)
#include "aclapi.h"
#include "sddl.h"
@ -45,7 +45,7 @@ using base::ProcessId;
namespace mozilla {
#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
#if defined(XP_WIN)
// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR.
MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr, \
RemovePointer<LPTSTR>::Type, \
@ -209,11 +209,9 @@ bool DuplicateHandle(HANDLE aSourceHandle,
FALSE,
aTargetProcessId));
if (!targetProcess) {
#ifdef MOZ_CRASHREPORTER
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("IPCTransportFailureReason"),
NS_LITERAL_CSTRING("Failed to open target process."));
#endif
return false;
}
@ -223,7 +221,6 @@ bool DuplicateHandle(HANDLE aSourceHandle,
}
#endif
#ifdef MOZ_CRASHREPORTER
void
AnnotateSystemError()
{
@ -239,9 +236,8 @@ AnnotateSystemError()
nsPrintfCString("%" PRId64, error));
}
}
#endif
#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
#if defined(XP_MACOSX)
void
AnnotateCrashReportWithErrno(const char* tag, int error)
{
@ -288,7 +284,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
formattedMessage.AppendLiteral("]: \"");
formattedMessage.AppendASCII(aMsg);
if (aIsParent) {
#ifdef MOZ_CRASHREPORTER
// We're going to crash the parent process because at this time
// there's no other really nice way of getting a minidump out of
// this process if we're off the main thread.
@ -299,7 +294,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"),
nsDependentCString(aMsg));
AnnotateSystemError();
#endif
MOZ_CRASH("IPC FatalError in the parent process!");
} else {
formattedMessage.AppendLiteral("\". abort()ing as a result.");
@ -617,11 +611,7 @@ bool
IToplevelProtocol::TakeMinidump(nsIFile** aDump, uint32_t* aSequence)
{
MOZ_RELEASE_ASSERT(GetSide() == ParentSide);
#ifdef MOZ_CRASHREPORTER
return XRE_TakeMinidumpForChild(OtherPid(), aDump, aSequence);
#else
return false;
#endif
}
bool

View file

@ -573,11 +573,7 @@ DuplicateHandle(HANDLE aSourceHandle,
* Annotate the crash reporter with the error code from the most recent system
* call. Returns the system error.
*/
#ifdef MOZ_CRASHREPORTER
void AnnotateSystemError();
#else
#define AnnotateSystemError() do { } while (0)
#endif
/**
* An endpoint represents one end of a partially initialized IPDL channel. To
@ -696,7 +692,7 @@ private:
ProcessId mMyPid, mOtherPid;
};
#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
#if defined(XP_MACOSX)
void AnnotateCrashReportWithErrno(const char* tag, int error);
#else
static inline void AnnotateCrashReportWithErrno(const char* tag, int error)

View file

@ -2566,13 +2566,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
'"'+ _protocolHeaderName(self.protocol, self.side) +'.h"') ]
+ setToIncludes(self.externalIncludes))
if self.protocol.decl.type.isToplevel():
cf.addthings([
CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
CppDirective(' include', '"nsXULAppAPI.h"'),
CppDirective('endif')
])
cppheaders = [CppDirective('include', '"%s"' % filename)
for filename in ipdl.builtin.CppIncludes]

View file

@ -16,9 +16,7 @@
#if defined(MOZ_CONTENT_SANDBOX)
#include "mozilla/SandboxSettings.h"
#endif // defined(MOZ_CONTENT_SANDBOX)
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif // defined(MOZ_CRASHREPORTER)
namespace mozilla {
namespace mscom {
@ -212,10 +210,8 @@ struct ParamTraits<mozilla::mscom::COMPtrHolder<Interface, _IID>>
mozilla::mscom::ProxyStream proxyStream(_IID, buf.get(), length, &env);
if (!proxyStream.IsValid()) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamValid"),
NS_LITERAL_CSTRING("false"));
#endif // defined(MOZ_CRASHREPORTER)
return false;
}

View file

@ -22,15 +22,12 @@
#include "mozilla/DebugOnly.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#include "nsRefPtrHashtable.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#define ENSURE_HR_SUCCEEDED(hr) \
if (FAILED((HRESULT)hr)) { \
nsPrintfCString location("ENSURE_HR_SUCCEEDED \"%s\": %u", __FILE__, __LINE__); \
@ -40,15 +37,6 @@
return hr; \
}
#else
#define ENSURE_HR_SUCCEEDED(hr) \
if (FAILED((HRESULT)hr)) { \
return hr; \
}
#endif // defined(MOZ_CRASHREPORTER)
namespace mozilla {
namespace mscom {
namespace detail {

View file

@ -13,9 +13,9 @@
#include "mozilla/Assertions.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
#include "nsExceptionHandler.h"
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
#include "nsWindowsHelpers.h"
#include "nsXULAppAPI.h"
@ -50,7 +50,7 @@ MainThreadRuntime::MainThreadRuntime()
, mActCtxRgn(a11y::Compatibility::GetActCtxResourceId())
#endif // defined(ACCESSIBILITY)
{
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
GeckoProcessType procType = XRE_GetProcessType();
if (procType == GeckoProcessType_Default ||
procType == GeckoProcessType_Content) {
@ -65,7 +65,7 @@ MainThreadRuntime::MainThreadRuntime()
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AssemblyManifestCtx"),
strActCtx);
}
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
// We must be the outermost COM initialization on this thread. The COM runtime
// cannot be configured once we start manipulating objects

View file

@ -5,22 +5,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Move.h"
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
#include "HandlerData.h"
#include "mozilla/a11y/Platform.h"
#include "mozilla/mscom/ActivationContext.h"
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
#include "mozilla/mscom/EnsureMTA.h"
#include "mozilla/mscom/ProxyStream.h"
#include "mozilla/mscom/Utils.h"
#include "mozilla/ScopeExit.h"
#if defined(MOZ_CRASHREPORTER)
#include "mozilla/mscom/Objref.h"
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#include "RegistrationAnnotator.h"
#endif
#include <windows.h>
#include <objbase.h>
@ -46,15 +44,11 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
, mBufSize(aInitBufSize)
, mPreserveStream(false)
{
#if defined(MOZ_CRASHREPORTER)
NS_NAMED_LITERAL_CSTRING(kCrashReportKey, "ProxyStreamUnmarshalStatus");
#endif
if (!aInitBufSize) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(kCrashReportKey,
NS_LITERAL_CSTRING("!aInitBufSize"));
#endif // defined(MOZ_CRASHREPORTER)
// We marshaled a nullptr. Nothing else to do here.
return;
}
@ -62,10 +56,8 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
HRESULT createStreamResult = CreateStream(aInitBuf, aInitBufSize,
getter_AddRefs(mStream));
if (FAILED(createStreamResult)) {
#if defined(MOZ_CRASHREPORTER)
nsPrintfCString hrAsStr("0x%08X", createStreamResult);
CrashReporter::AnnotateCrashReport(kCrashReportKey, hrAsStr);
#endif // defined(MOZ_CRASHREPORTER)
return;
}
@ -74,18 +66,16 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
// in that case, even though marshaling a nullptr is allowable.
MOZ_ASSERT(mStream);
if (!mStream) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(kCrashReportKey,
NS_LITERAL_CSTRING("!mStream"));
#endif // defined(MOZ_CRASHREPORTER)
return;
}
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
const uint32_t expectedStreamLen = GetOBJREFSize(WrapNotNull(mStream));
nsAutoCString strActCtx;
nsAutoString manifestPath;
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
HRESULT unmarshalResult = S_OK;
@ -93,11 +83,11 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
// correctness with IPDL. We'll request an IUnknown and then QI the
// actual interface later.
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
auto marshalFn = [this, &strActCtx, &manifestPath, &unmarshalResult, &aIID, aEnv]() -> void
#else
auto marshalFn = [this, &unmarshalResult, &aIID, aEnv]() -> void
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
{
if (aEnv) {
bool pushOk = aEnv->Push();
@ -116,7 +106,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
MOZ_DIAGNOSTIC_ASSERT(popOk);
});
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
auto curActCtx = ActivationContext::GetCurrent();
if (curActCtx.isOk()) {
strActCtx.AppendPrintf("0x%p", curActCtx.unwrap());
@ -125,7 +115,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
}
ActivationContext::GetCurrentManifestPath(manifestPath);
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
unmarshalResult =
::CoUnmarshalInterface(mStream, aIID, getter_AddRefs(mUnmarshaledProxy));
@ -143,7 +133,6 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
mStream = nullptr;
#if defined(MOZ_CRASHREPORTER)
if (FAILED(unmarshalResult) || !mUnmarshaledProxy) {
nsPrintfCString hrAsStr("0x%08X", unmarshalResult);
CrashReporter::AnnotateCrashReport(
@ -176,7 +165,6 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
actualStreamLen);
#endif // defined(ACCESSIBILITY)
}
#endif // defined(MOZ_CRASHREPORTER)
}
ProxyStream::ProxyStream(ProxyStream&& aOther)
@ -308,17 +296,11 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
HRESULT statResult = S_OK;
HRESULT getHGlobalResult = S_OK;
#if defined(MOZ_CRASHREPORTER)
nsAutoString manifestPath;
auto marshalFn = [this, &aIID, aObject, mshlFlags, &stream, &streamSize,
&hglobal, &createStreamResult, &marshalResult, &statResult,
&getHGlobalResult, aEnv, &manifestPath]() -> void
#else
auto marshalFn = [this, &aIID, aObject, mshlFlags, &stream, &streamSize,
&hglobal, &createStreamResult, &marshalResult, &statResult,
&getHGlobalResult, aEnv]() -> void
#endif // defined(MOZ_CRASHREPORTER)
{
if (aEnv) {
bool pushOk = aEnv->Push();
@ -343,9 +325,9 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
return;
}
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
#if defined(ACCESSIBILITY)
ActivationContext::GetCurrentManifestPath(manifestPath);
#endif // defined(MOZ_CRASHREPORTER)
#endif // defined(ACCESSIBILITY)
marshalResult = ::CoMarshalInterface(stream, aIID, aObject, MSHCTX_LOCAL,
nullptr, mshlFlags);
@ -375,7 +357,6 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
EnsureMTA mta(marshalFn);
}
#if defined(MOZ_CRASHREPORTER)
if (FAILED(createStreamResult)) {
nsPrintfCString hrAsStr("0x%08X", createStreamResult);
CrashReporter::AnnotateCrashReport(
@ -405,15 +386,12 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
NS_LITERAL_CSTRING("GetHGlobalFromStreamFailure"),
hrAsStr);
}
#endif // defined(MOZ_CRASHREPORTER)
mStream = mozilla::Move(stream);
if (streamSize) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSizeFrom"),
NS_LITERAL_CSTRING("IStream::Stat"));
#endif // defined(MOZ_CRASHREPORTER)
mBufSize = streamSize;
}
@ -428,20 +406,16 @@ ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject, Environment* aEnv,
// the size of the memory block allocated by the HGLOBAL, though it might
// be larger than the actual stream size.
if (!streamSize) {
#if defined(MOZ_CRASHREPORTER)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSizeFrom"),
NS_LITERAL_CSTRING("GlobalSize"));
#endif // defined(MOZ_CRASHREPORTER)
mBufSize = static_cast<int>(::GlobalSize(hglobal));
}
#if defined(MOZ_CRASHREPORTER)
nsAutoCString strBufSize;
strBufSize.AppendInt(mBufSize);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProxyStreamSize"),
strBufSize);
#endif // defined(MOZ_CRASHREPORTER)
}
} // namespace mscom

View file

@ -7,10 +7,6 @@
#ifndef mozilla_mscom_RegistrationAnnotator_h
#define mozilla_mscom_RegistrationAnnotator_h
#if !defined(MOZ_CRASHREPORTER)
#error "This header requires crash reporting to be enabled"
#endif
namespace mozilla {
namespace mscom {

View file

@ -32,12 +32,8 @@ UNIFIED_SOURCES += [
'Objref.cpp',
'PassthruProxy.cpp',
'ProxyStream.cpp',
'Utils.cpp',
]
if CONFIG['MOZ_CRASHREPORTER']:
UNIFIED_SOURCES += [
'RegistrationAnnotator.cpp',
'Utils.cpp',
]
if CONFIG['ACCESSIBILITY']:

View file

@ -634,6 +634,12 @@ class FullParseHandler
return new_<CodeNode>(PNK_FUNCTION, JSOP_LAMBDA_ARROW, pos);
}
bool isExpressionClosure(ParseNode* node) const {
return node->isKind(PNK_FUNCTION) &&
node->pn_funbox->isExprBody() &&
!node->pn_funbox->isArrow();
}
void setFunctionFormalParametersAndBody(ParseNode* pn, ParseNode* kid) {
MOZ_ASSERT_IF(kid, kid->isKind(PNK_PARAMSBODY));
pn->pn_body = kid;

View file

@ -1415,8 +1415,25 @@ AccessorTypeToJSOp(AccessorType atype)
enum FunctionSyntaxKind
{
Expression,
// A non-arrow function expression that is a PrimaryExpression and *also* a
// complete AssignmentExpression. For example, in
//
// var x = (function y() {});
//
// |y| is such a function expression.
AssignmentExpression,
// A non-arrow function expression that is a PrimaryExpression but *not* a
// complete AssignmentExpression. For example, in
//
// var x = (1 + function y() {});
//
// |y| is such a function expression.
PrimaryExpression,
// A named function appearing as a Statement.
Statement,
Arrow,
Method,
ClassConstructor,
@ -1427,6 +1444,12 @@ enum FunctionSyntaxKind
SetterNoExpressionClosure
};
static inline bool
IsFunctionExpression(FunctionSyntaxKind kind)
{
return kind == AssignmentExpression || kind == PrimaryExpression;
}
static inline bool
IsConstructorKind(FunctionSyntaxKind kind)
{

View file

@ -2788,7 +2788,8 @@ ParserBase::newFunction(HandleAtom atom, FunctionSyntaxKind kind,
bool isGlobalSelfHostedBuiltin = false;
#endif
switch (kind) {
case Expression:
case AssignmentExpression:
case PrimaryExpression:
flags = (generatorKind == GeneratorKind::NotGenerator &&
asyncKind == FunctionAsyncKind::SyncFunction
? JSFunction::INTERPRETED_LAMBDA
@ -3347,9 +3348,8 @@ Parser<ParseHandler, CharT>::templateLiteral(YieldHandling yieldHandling)
template <class ParseHandler, typename CharT>
typename ParseHandler::Node
Parser<ParseHandler, CharT>::functionDefinition(Node pn, uint32_t toStringStart,
InHandling inHandling,
YieldHandling yieldHandling, HandleAtom funName,
FunctionSyntaxKind kind,
InHandling inHandling, YieldHandling yieldHandling,
HandleAtom funName, FunctionSyntaxKind kind,
GeneratorKind generatorKind,
FunctionAsyncKind asyncKind,
bool tryAnnexB /* = false */)
@ -3526,9 +3526,9 @@ Parser<SyntaxParseHandler, char16_t>::trySyntaxParseInnerFunction(Node pn, Handl
template <class ParseHandler, typename CharT>
bool
Parser<ParseHandler, CharT>::innerFunction(Node pn, ParseContext* outerpc, FunctionBox* funbox,
uint32_t toStringStart,
InHandling inHandling, YieldHandling yieldHandling,
FunctionSyntaxKind kind, Directives inheritedDirectives,
uint32_t toStringStart, InHandling inHandling,
YieldHandling yieldHandling, FunctionSyntaxKind kind,
Directives inheritedDirectives,
Directives* newDirectives)
{
// Note that it is possible for outerpc != this->pc, as we may be
@ -3550,12 +3550,10 @@ Parser<ParseHandler, CharT>::innerFunction(Node pn, ParseContext* outerpc, Funct
template <class ParseHandler, typename CharT>
bool
Parser<ParseHandler, CharT>::innerFunction(Node pn, ParseContext* outerpc, HandleFunction fun,
uint32_t toStringStart,
InHandling inHandling, YieldHandling yieldHandling,
FunctionSyntaxKind kind,
uint32_t toStringStart, InHandling inHandling,
YieldHandling yieldHandling, FunctionSyntaxKind kind,
GeneratorKind generatorKind,
FunctionAsyncKind asyncKind,
bool tryAnnexB,
FunctionAsyncKind asyncKind, bool tryAnnexB,
Directives inheritedDirectives,
Directives* newDirectives)
{
@ -3725,7 +3723,7 @@ Parser<ParseHandler, CharT>::functionFormalParametersAndBody(InHandling inHandli
if (kind != Arrow) {
if (funbox->isGenerator() || funbox->isAsync() || kind == Method ||
kind == GetterNoExpressionClosure || kind == SetterNoExpressionClosure ||
IsConstructorKind(kind))
IsConstructorKind(kind) || kind == PrimaryExpression)
{
error(JSMSG_CURLY_BEFORE_BODY);
return false;
@ -3766,15 +3764,17 @@ Parser<ParseHandler, CharT>::functionFormalParametersAndBody(InHandling inHandli
}
// Revalidate the function name when we transitioned to strict mode.
if ((kind == Statement || kind == Expression) && fun->explicitName()
&& !inheritedStrict && pc->sc()->strict())
if ((kind == Statement || IsFunctionExpression(kind)) &&
fun->explicitName() &&
!inheritedStrict &&
pc->sc()->strict())
{
MOZ_ASSERT(pc->sc()->hasExplicitUseStrict(),
"strict mode should only change when a 'use strict' directive is present");
PropertyName* propertyName = fun->explicitName()->asPropertyName();
YieldHandling nameYieldHandling;
if (kind == Expression) {
if (IsFunctionExpression(kind)) {
// Named lambda has binding inside it.
nameYieldHandling = bodyYieldHandling;
} else {
@ -3913,7 +3913,9 @@ Parser<ParseHandler, CharT>::functionStmt(uint32_t toStringStart, YieldHandling
template <class ParseHandler, typename CharT>
typename ParseHandler::Node
Parser<ParseHandler, CharT>::functionExpr(uint32_t toStringStart, InvokedPrediction invoked,
Parser<ParseHandler, CharT>::functionExpr(uint32_t toStringStart,
ExpressionClosure expressionClosureHandling,
InvokedPrediction invoked,
FunctionAsyncKind asyncKind)
{
MOZ_ASSERT(tokenStream.isCurrentTokenType(TOK_FUNCTION));
@ -3948,7 +3950,11 @@ Parser<ParseHandler, CharT>::functionExpr(uint32_t toStringStart, InvokedPredict
if (invoked)
pn = handler.setLikelyIIFE(pn);
return functionDefinition(pn, toStringStart, InAllowed, yieldHandling, name, Expression,
FunctionSyntaxKind kind = expressionClosureHandling == ExpressionClosure::Allowed
? AssignmentExpression
: PrimaryExpression;
return functionDefinition(pn, toStringStart, InAllowed, yieldHandling, name, kind,
generatorKind, asyncKind);
}
@ -7093,7 +7099,8 @@ Parser<ParseHandler, CharT>::classDefinition(YieldHandling yieldHandling,
if (hasHeritage) {
if (!tokenStream.getToken(&tt))
return null();
classHeritage = memberExpr(yieldHandling, TripledotProhibited, tt);
classHeritage = memberExpr(yieldHandling, TripledotProhibited,
ExpressionClosure::Forbidden, tt);
if (!classHeritage)
return null();
}
@ -7840,6 +7847,7 @@ template <class ParseHandler, typename CharT>
MOZ_ALWAYS_INLINE typename ParseHandler::Node
Parser<ParseHandler, CharT>::orExpr(InHandling inHandling, YieldHandling yieldHandling,
TripledotHandling tripledotHandling,
ExpressionClosure expressionClosureHandling,
PossibleError* possibleError,
InvokedPrediction invoked /* = PredictUninvoked */)
{
@ -7853,10 +7861,16 @@ Parser<ParseHandler, CharT>::orExpr(InHandling inHandling, YieldHandling yieldHa
int depth = 0;
Node pn;
for (;;) {
pn = unaryExpr(yieldHandling, tripledotHandling, possibleError, invoked);
pn = unaryExpr(yieldHandling, tripledotHandling, expressionClosureHandling, possibleError,
invoked);
if (!pn)
return null();
if (handler.isExpressionClosure(pn))
return pn;
expressionClosureHandling = ExpressionClosure::Forbidden;
// If a binary operator follows, consume it and compute the
// corresponding operator.
TokenKind tok;
@ -7921,13 +7935,18 @@ template <class ParseHandler, typename CharT>
MOZ_ALWAYS_INLINE typename ParseHandler::Node
Parser<ParseHandler, CharT>::condExpr(InHandling inHandling, YieldHandling yieldHandling,
TripledotHandling tripledotHandling,
ExpressionClosure expressionClosureHandling,
PossibleError* possibleError,
InvokedPrediction invoked /* = PredictUninvoked */)
{
Node condition = orExpr(inHandling, yieldHandling, tripledotHandling, possibleError, invoked);
Node condition = orExpr(inHandling, yieldHandling, tripledotHandling,
expressionClosureHandling, possibleError, invoked);
if (!condition)
return null();
if (handler.isExpressionClosure(condition))
return condition;
bool matched;
if (!tokenStream.matchToken(&matched, TOK_HOOK))
return null();
@ -8052,7 +8071,8 @@ Parser<ParseHandler, CharT>::assignExpr(InHandling inHandling, YieldHandling yie
isArrow = true;
} else {
lhs = condExpr(inHandling, yieldHandling, tripledotHandling, &possibleErrorInner, invoked);
lhs = condExpr(inHandling, yieldHandling, tripledotHandling, ExpressionClosure::Allowed,
&possibleErrorInner, invoked);
if (!lhs)
return null();
@ -8096,8 +8116,8 @@ Parser<ParseHandler, CharT>::assignExpr(InHandling inHandling, YieldHandling yie
if (!pn)
return null();
return functionDefinition(pn, toStringStart, inHandling, yieldHandling, nullptr,
Arrow, GeneratorKind::NotGenerator, asyncKind);
return functionDefinition(pn, toStringStart, inHandling, yieldHandling, nullptr, Arrow,
GeneratorKind::NotGenerator, asyncKind);
}
MOZ_ALWAYS_TRUE(tokenStream.getToken(&tokenAfterLHS, TokenStream::Operand));
@ -8247,7 +8267,7 @@ typename ParseHandler::Node
Parser<ParseHandler, CharT>::unaryOpExpr(YieldHandling yieldHandling, ParseNodeKind kind,
uint32_t begin)
{
Node kid = unaryExpr(yieldHandling, TripledotProhibited);
Node kid = unaryExpr(yieldHandling, TripledotProhibited, ExpressionClosure::Forbidden);
if (!kid)
return null();
return handler.newUnary(kind, begin, kid);
@ -8257,6 +8277,7 @@ template <class ParseHandler, typename CharT>
typename ParseHandler::Node
Parser<ParseHandler, CharT>::unaryExpr(YieldHandling yieldHandling,
TripledotHandling tripledotHandling,
ExpressionClosure expressionClosureHandling,
PossibleError* possibleError /* = nullptr */,
InvokedPrediction invoked /* = PredictUninvoked */)
{
@ -8291,7 +8312,7 @@ Parser<ParseHandler, CharT>::unaryExpr(YieldHandling yieldHandling,
// // Evaluates expression, triggering a runtime ReferenceError for
// // the undefined name.
// typeof (1, nonExistentName);
Node kid = unaryExpr(yieldHandling, TripledotProhibited);
Node kid = unaryExpr(yieldHandling, TripledotProhibited, ExpressionClosure::Forbidden);
if (!kid)
return null();
@ -8306,7 +8327,8 @@ Parser<ParseHandler, CharT>::unaryExpr(YieldHandling yieldHandling,
return null();
uint32_t operandOffset = pos().begin;
Node operand = memberExpr(yieldHandling, TripledotProhibited, tt2);
Node operand =
memberExpr(yieldHandling, TripledotProhibited, ExpressionClosure::Forbidden, tt2);
if (!operand || !checkIncDecOperand(operand, operandOffset))
return null();
@ -8319,7 +8341,7 @@ Parser<ParseHandler, CharT>::unaryExpr(YieldHandling yieldHandling,
if (!tokenStream.peekOffset(&exprOffset, TokenStream::Operand))
return null();
Node expr = unaryExpr(yieldHandling, TripledotProhibited);
Node expr = unaryExpr(yieldHandling, TripledotProhibited, ExpressionClosure::Forbidden);
if (!expr)
return null();
@ -8337,7 +8359,8 @@ Parser<ParseHandler, CharT>::unaryExpr(YieldHandling yieldHandling,
case TOK_AWAIT: {
if (pc->isAsync()) {
Node kid = unaryExpr(yieldHandling, tripledotHandling, possibleError, invoked);
Node kid = unaryExpr(yieldHandling, tripledotHandling, ExpressionClosure::Forbidden,
possibleError, invoked);
if (!kid)
return null();
pc->lastAwaitOffset = begin;
@ -8348,11 +8371,14 @@ Parser<ParseHandler, CharT>::unaryExpr(YieldHandling yieldHandling,
MOZ_FALLTHROUGH;
default: {
Node expr = memberExpr(yieldHandling, tripledotHandling, tt, /* allowCallSyntax = */ true,
possibleError, invoked);
Node expr = memberExpr(yieldHandling, tripledotHandling, expressionClosureHandling, tt,
/* allowCallSyntax = */ true, possibleError, invoked);
if (!expr)
return null();
if (handler.isExpressionClosure(expr))
return expr;
/* Don't look across a newline boundary for a postfix incop. */
if (!tokenStream.peekTokenSameLine(&tt))
return null();
@ -8459,6 +8485,7 @@ template <class ParseHandler, typename CharT>
typename ParseHandler::Node
Parser<ParseHandler, CharT>::memberExpr(YieldHandling yieldHandling,
TripledotHandling tripledotHandling,
ExpressionClosure expressionClosureHandling,
TokenKind tt, bool allowCallSyntax /* = true */,
PossibleError* possibleError /* = nullptr */,
InvokedPrediction invoked /* = PredictUninvoked */)
@ -8482,7 +8509,8 @@ Parser<ParseHandler, CharT>::memberExpr(YieldHandling yieldHandling,
} else {
// Gotten by tryNewTarget
tt = tokenStream.currentToken().type;
Node ctorExpr = memberExpr(yieldHandling, TripledotProhibited, tt,
Node ctorExpr = memberExpr(yieldHandling, TripledotProhibited,
ExpressionClosure::Forbidden, tt,
/* allowCallSyntax = */ false,
/* possibleError = */ nullptr, PredictInvoked);
if (!ctorExpr)
@ -8511,9 +8539,13 @@ Parser<ParseHandler, CharT>::memberExpr(YieldHandling yieldHandling,
if (!lhs)
return null();
} else {
lhs = primaryExpr(yieldHandling, tripledotHandling, tt, possibleError, invoked);
lhs = primaryExpr(yieldHandling, tripledotHandling, expressionClosureHandling, tt,
possibleError, invoked);
if (!lhs)
return null();
if (handler.isExpressionClosure(lhs))
return lhs;
}
MOZ_ASSERT_IF(handler.isSuperBase(lhs), tokenStream.isCurrentTokenType(TOK_SUPER));
@ -9690,7 +9722,8 @@ Parser<ParseHandler, CharT>::tryNewTarget(Node &newTarget)
template <class ParseHandler, typename CharT>
typename ParseHandler::Node
Parser<ParseHandler, CharT>::primaryExpr(YieldHandling yieldHandling,
TripledotHandling tripledotHandling, TokenKind tt,
TripledotHandling tripledotHandling,
ExpressionClosure expressionClosureHandling, TokenKind tt,
PossibleError* possibleError,
InvokedPrediction invoked /* = PredictUninvoked */)
{
@ -9700,7 +9733,8 @@ Parser<ParseHandler, CharT>::primaryExpr(YieldHandling yieldHandling,
switch (tt) {
case TOK_FUNCTION:
return functionExpr(pos().begin, invoked);
return functionExpr(pos().begin, expressionClosureHandling, invoked,
FunctionAsyncKind::SyncFunction);
case TOK_CLASS:
return classDefinition(yieldHandling, ClassExpression, NameRequired);
@ -9765,7 +9799,7 @@ Parser<ParseHandler, CharT>::primaryExpr(YieldHandling yieldHandling,
if (nextSameLine == TOK_FUNCTION) {
uint32_t toStringStart = pos().begin;
tokenStream.consumeKnownToken(TOK_FUNCTION);
return functionExpr(toStringStart, PredictUninvoked,
return functionExpr(toStringStart, expressionClosureHandling, PredictUninvoked,
FunctionAsyncKind::AsyncFunction);
}
}

View file

@ -305,6 +305,8 @@ ParseContext::VarScope::VarScope(ParserBase* parser)
useAsVarScope(parser->pc);
}
enum class ExpressionClosure { Allowed, Forbidden };
template <class ParseHandler, typename CharT>
class Parser final : public ParserBase, private JS::AutoGCRooter
{
@ -557,8 +559,7 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
// Parse an inner function given an enclosing ParseContext and a
// FunctionBox for the inner function.
bool innerFunction(Node pn, ParseContext* outerpc, FunctionBox* funbox, uint32_t toStringStart,
InHandling inHandling, YieldHandling yieldHandling,
FunctionSyntaxKind kind,
InHandling inHandling, YieldHandling yieldHandling, FunctionSyntaxKind kind,
Directives inheritedDirectives, Directives* newDirectives);
// Parse a function's formal parameters and its body assuming its function
@ -593,8 +594,8 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
Node functionStmt(uint32_t toStringStart,
YieldHandling yieldHandling, DefaultHandling defaultHandling,
FunctionAsyncKind asyncKind = FunctionAsyncKind::SyncFunction);
Node functionExpr(uint32_t toStringStart, InvokedPrediction invoked = PredictUninvoked,
FunctionAsyncKind asyncKind = FunctionAsyncKind::SyncFunction);
Node functionExpr(uint32_t toStringStart, ExpressionClosure expressionClosureHandling,
InvokedPrediction invoked, FunctionAsyncKind asyncKind);
Node statementList(YieldHandling yieldHandling);
Node statement(YieldHandling yieldHandling);
@ -723,23 +724,24 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
Node assignExprWithoutYieldOrAwait(YieldHandling yieldHandling);
Node yieldExpression(InHandling inHandling);
Node condExpr(InHandling inHandling, YieldHandling yieldHandling,
TripledotHandling tripledotHandling,
TripledotHandling tripledotHandling, ExpressionClosure expressionClosureHandling,
PossibleError* possibleError,
InvokedPrediction invoked = PredictUninvoked);
Node orExpr(InHandling inHandling, YieldHandling yieldHandling,
TripledotHandling tripledotHandling,
TripledotHandling tripledotHandling, ExpressionClosure expressionClosureHandling,
PossibleError* possibleError,
InvokedPrediction invoked = PredictUninvoked);
Node unaryExpr(YieldHandling yieldHandling, TripledotHandling tripledotHandling,
ExpressionClosure expressionClosureHandling,
PossibleError* possibleError = nullptr,
InvokedPrediction invoked = PredictUninvoked);
Node memberExpr(YieldHandling yieldHandling, TripledotHandling tripledotHandling,
TokenKind tt, bool allowCallSyntax = true,
PossibleError* possibleError = nullptr,
ExpressionClosure expressionClosureHandling, TokenKind tt,
bool allowCallSyntax = true, PossibleError* possibleError = nullptr,
InvokedPrediction invoked = PredictUninvoked);
Node primaryExpr(YieldHandling yieldHandling, TripledotHandling tripledotHandling,
TokenKind tt, PossibleError* possibleError,
InvokedPrediction invoked = PredictUninvoked);
ExpressionClosure expressionClosureHandling, TokenKind tt,
PossibleError* possibleError, InvokedPrediction invoked = PredictUninvoked);
Node exprInParens(InHandling inHandling, YieldHandling yieldHandling,
TripledotHandling tripledotHandling, PossibleError* possibleError = nullptr);
@ -754,9 +756,8 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
bool functionArguments(YieldHandling yieldHandling, FunctionSyntaxKind kind,
Node funcpn);
Node functionDefinition(Node func, uint32_t toStringStart,
InHandling inHandling, YieldHandling yieldHandling,
HandleAtom name, FunctionSyntaxKind kind,
Node functionDefinition(Node func, uint32_t toStringStart, InHandling inHandling,
YieldHandling yieldHandling, HandleAtom name, FunctionSyntaxKind kind,
GeneratorKind generatorKind, FunctionAsyncKind asyncKind,
bool tryAnnexB = false);
@ -835,15 +836,13 @@ class Parser final : public ParserBase, private JS::AutoGCRooter
bool skipLazyInnerFunction(Node pn, uint32_t toStringStart, FunctionSyntaxKind kind,
bool tryAnnexB);
bool innerFunction(Node pn, ParseContext* outerpc, HandleFunction fun, uint32_t toStringStart,
InHandling inHandling, YieldHandling yieldHandling,
FunctionSyntaxKind kind,
InHandling inHandling, YieldHandling yieldHandling, FunctionSyntaxKind kind,
GeneratorKind generatorKind, FunctionAsyncKind asyncKind, bool tryAnnexB,
Directives inheritedDirectives, Directives* newDirectives);
bool trySyntaxParseInnerFunction(Node pn, HandleFunction fun, uint32_t toStringStart,
InHandling inHandling, YieldHandling yieldHandling,
FunctionSyntaxKind kind,
GeneratorKind generatorKind, FunctionAsyncKind asyncKind,
bool tryAnnexB,
FunctionSyntaxKind kind, GeneratorKind generatorKind,
FunctionAsyncKind asyncKind, bool tryAnnexB,
Directives inheritedDirectives, Directives* newDirectives);
bool finishFunctionScopes(bool isStandaloneFunction);
bool finishFunction(bool isStandaloneFunction = false);

View file

@ -50,7 +50,16 @@ class SyntaxParseHandler
NodeVarDeclaration,
NodeLexicalDeclaration,
NodeFunctionDefinition,
// A non-arrow function expression with block body, from bog-standard
// ECMAScript.
NodeFunctionExpressionBlockBody,
// A non-arrow function expression with AssignmentExpression body -- a
// proprietary SpiderMonkey extension.
NodeFunctionExpressionClosure,
NodeFunctionArrow,
NodeFunctionStatement,
// This is needed for proper assignment-target handling. ES6 formally
// requires function calls *not* pass IsValidSimpleAssignmentTarget,
@ -119,6 +128,10 @@ class SyntaxParseHandler
NodeSuperBase
};
bool isNonArrowFunctionExpression(Node node) const {
return node == NodeFunctionExpressionBlockBody || node == NodeFunctionExpressionClosure;
}
bool isPropertyAccess(Node node) {
return node == NodeDottedProperty || node == NodeElement;
}
@ -319,9 +332,20 @@ class SyntaxParseHandler
void checkAndSetIsDirectRHSAnonFunction(Node pn) {}
Node newFunctionStatement(const TokenPos& pos) { return NodeFunctionDefinition; }
Node newFunctionExpression(const TokenPos& pos) { return NodeFunctionDefinition; }
Node newArrowFunction(const TokenPos& pos) { return NodeFunctionDefinition; }
Node newFunctionStatement(const TokenPos& pos) { return NodeFunctionStatement; }
Node newFunctionExpression(const TokenPos& pos) {
// All non-arrow function expressions are initially presumed to have
// block body. This will be overridden later *if* the function
// expression permissibly has an AssignmentExpression body.
return NodeFunctionExpressionBlockBody;
}
Node newArrowFunction(const TokenPos& pos) { return NodeFunctionArrow; }
bool isExpressionClosure(Node node) const {
return node == NodeFunctionExpressionClosure;
}
void setFunctionFormalParametersAndBody(Node pn, Node kid) {}
void setFunctionBody(Node pn, Node kid) {}
@ -420,7 +444,8 @@ class SyntaxParseHandler
}
bool isStatementPermittedAfterReturnStatement(Node pn) {
return pn == NodeFunctionDefinition || pn == NodeVarDeclaration ||
return pn == NodeFunctionStatement || isNonArrowFunctionExpression(pn) ||
pn == NodeVarDeclaration ||
pn == NodeBreak ||
pn == NodeThrow ||
pn == NodeEmptyStatement;

View file

@ -1,8 +1,11 @@
if (getBuildConfiguration().release_or_beta) {
eval(`
function f() {
// The expression closure is deliberate here, testing the semicolon after
// one when it appears as a FunctionDeclaration from B.3.4
// FunctionDeclarations in IfStatement Statement Clauses.
if (0)
function g() { x };
function g() x;
else;
}
f();`)

View file

@ -0,0 +1,41 @@
// |reftest| skip-if(!xulRuntime.shell) -- needs getBuildConfiguration
/* 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/. */
// ArrowFunctions with block bodies appearing at the end of the
// AssignmentExpression returned by SpiderMonkey-specific function expression
// closures, where subsequent token-examination must use the Operand modifier
// to avoid an assertion.
if (getBuildConfiguration().release_or_beta)
{
eval(`
var ec1 = function() 0 ? 1 : a => {};
assertEq(typeof ec1, "function");
assertEq(typeof ec1(), "function");
assertEq(ec1()(), undefined);
var ec2 = function() 0 ? 1 : a => {} // deliberately exercise ASI here
assertEq(typeof ec2, "function");
assertEq(typeof ec2(), "function");
assertEq(ec2()(), undefined);
function ec3() 0 ? 1 : a => {} // exercise ASI here
assertEq(typeof ec3(), "function");
function ec4() 0 ? 1 : a => {};
assertEq(typeof ec4(), "function");
var needle = "@";
var x = 42;
var g = { test() { assertEq(true, false, "shouldn't be called"); } };
function ec5() 0 ? 1 : a => {} // ASI
/x/g.test((needle = "x"));
assertEq(needle, "x");
`);
}
if (typeof reportCompare === "function")
reportCompare(true, true);

View file

@ -0,0 +1,64 @@
// |reftest| skip-if(!xulRuntime.shell) -- needs getBuildConfiguration
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
//-----------------------------------------------------------------------------
var BUGNUMBER = 1416337;
var summary =
"Expression closure syntax is only permitted for functions that constitute " +
"entire AssignmentExpressions, not PrimaryExpressions that are themselves " +
"components of larger binary expressions";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
if (getBuildConfiguration().release_or_beta)
{
function assertThrowsSyntaxError(code)
{
function testOne(replacement)
{
var x, rv;
try
{
rv = eval(code.replace("@@@", replacement));
}
catch (e)
{
assertEq(e instanceof SyntaxError, true,
"should have thrown a SyntaxError, instead got: " + e);
return;
}
assertEq(true, false, "should have thrown, instead returned " + rv);
}
testOne("function");
testOne("async function");
}
assertThrowsSyntaxError("x = ++@@@() 1");
assertThrowsSyntaxError("x = delete @@@() 1");
assertThrowsSyntaxError("x = new @@@() 1");
assertThrowsSyntaxError("x = void @@@() 1");
assertThrowsSyntaxError("x = +@@@() 1");
assertThrowsSyntaxError("x = 1 + @@@() 1");
assertThrowsSyntaxError("x = null != @@@() 1");
assertThrowsSyntaxError("x = null != @@@() 0 ? 1 : a => {}");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {} !== null");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {}.toString");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {}['toString']");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {}``");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {}()");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {}++");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {} || 0");
assertThrowsSyntaxError("x = 0 || @@@() 0 ? 1 : a => {}");
assertThrowsSyntaxError("x = @@@() 0 ? 1 : a => {} && true");
assertThrowsSyntaxError("x = true && @@@() 0 ? 1 : a => {}");
}
if (typeof reportCompare === "function")
reportCompare(true, true);

View file

@ -18,6 +18,7 @@
#include "nsAutoPtr.h"
#include "nsNetUtil.h"
#include "nsExceptionHandler.h"
#include "nsIMemoryInfoDumper.h"
#include "nsIMemoryReporter.h"
#include "nsIObserverService.h"
@ -60,10 +61,6 @@
#include "nsIXULRuntime.h"
#include "nsJSPrincipals.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#ifdef XP_WIN
#include <windows.h>
#endif
@ -752,9 +749,7 @@ XPCJSRuntime::GCSliceCallback(JSContext* cx,
if (!self)
return;
#ifdef MOZ_CRASHREPORTER
CrashReporter::SetGarbageCollecting(progress == JS::GC_CYCLE_BEGIN);
#endif
if (self->mPrevGCSliceCallback)
(*self->mPrevGCSliceCallback)(cx, progress, desc);

View file

@ -13,6 +13,7 @@
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsExceptionHandler.h"
#include "nsIServiceManager.h"
#include "nsIFile.h"
#include "nsString.h"
@ -61,11 +62,6 @@
#include <unistd.h> /* for isatty() */
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#endif
#ifdef ENABLE_TESTS
#include "xpctest_private.h"
#endif
@ -1193,9 +1189,8 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
argv += 2;
}
#ifdef MOZ_CRASHREPORTER
const char* val = getenv("MOZ_CRASHREPORTER");
if (val && *val) {
if (val && *val && !CrashReporter::IsDummy()) {
rv = CrashReporter::SetExceptionHandler(greDir, true);
if (NS_FAILED(rv)) {
printf("CrashReporter::SetExceptionHandler failed!\n");
@ -1203,7 +1198,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
}
MOZ_ASSERT(CrashReporter::GetEnabled());
}
#endif
if (argc > 1 && !strcmp(argv[1], "--greomni")) {
nsCOMPtr<nsIFile> greOmni;
@ -1395,11 +1389,10 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
rv = NS_ShutdownXPCOM( nullptr );
MOZ_ASSERT(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
#ifdef MOZ_CRASHREPORTER
// Shut down the crashreporter service to prevent leaking some strings it holds.
if (CrashReporter::GetEnabled())
if (CrashReporter::GetEnabled()) {
CrashReporter::UnsetExceptionHandler();
#endif
}
#ifdef MOZ_GECKO_PROFILER
// This must precede NS_LogTerm(), otherwise xpcshell return non-zero

View file

@ -7,6 +7,6 @@ needs-focus == select-required-invalid.html select-required-ref.html
needs-focus == select-required-valid.html select-required-ref.html
needs-focus == select-required-multiple-still-valid.html select-required-multiple-ref.html
fuzzy-if(skiaContent,1,250) needs-focus == select-required-multiple-valid.html select-required-multiple-ref.html
fuzzy-if(skiaContent&&!Android,1,3) skip-if(Android) needs-focus == select-disabled-fieldset-1.html select-fieldset-ref.html
fuzzy-if(skiaContent&&!Android,2,3) skip-if(Android) needs-focus == select-disabled-fieldset-2.html select-fieldset-ref.html
fuzzy-if(skiaContent&&!Android,1,3) fuzzy-if(Android,8,1) needs-focus == select-disabled-fieldset-1.html select-fieldset-ref.html
fuzzy-if(skiaContent&&!Android,2,3) fuzzy-if(Android,8,1) needs-focus == select-disabled-fieldset-2.html select-fieldset-ref.html
fuzzy-if(skiaContent,2,5) needs-focus == select-fieldset-legend.html select-fieldset-legend-ref.html

View file

@ -25,6 +25,7 @@
#include "nsDOMTokenList.h"
#include "nsDeviceContext.h"
#include "nsIContentInlines.h"
#include "nsICrashReporter.h"
#include "nsIDOMNode.h"
#include "nsIDocumentInlines.h"
#include "nsILoadContext.h"
@ -75,10 +76,6 @@
# include "mozmemory.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
using namespace mozilla;
using namespace mozilla::css;
using namespace mozilla::dom;
@ -2822,11 +2819,9 @@ void
Gecko_AddBufferToCrashReport(const void* addr, size_t len)
{
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
NS_ENSURE_TRUE_VOID(cr);
cr->RegisterAppMemory((uint64_t) addr, len);
#endif
}
void
@ -2835,11 +2830,9 @@ Gecko_AnnotateCrashReport(const char* key_str, const char* value_str)
MOZ_ASSERT(NS_IsMainThread());
nsDependentCString key(key_str);
nsDependentCString value(value_str);
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> cr = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
NS_ENSURE_TRUE_VOID(cr);
cr->AnnotateCrashReport(key, value);
#endif
}
void

View file

@ -9,6 +9,7 @@
#include "nsAppDirectoryServiceDefs.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
@ -16,28 +17,24 @@
#include "mozilla/dom/SRIMetadata.h"
#include "MainThreadUtils.h"
#include "nsColor.h"
#include "nsIConsoleService.h"
#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
#include "nsIXULRuntime.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
// Includes for the crash report annotation in ErrorLoadingSheet.
#ifdef MOZ_CRASHREPORTER
#include "mozilla/Omnijar.h"
#include "nsDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryService.h"
#include "nsExceptionHandler.h"
#include "nsIChromeRegistry.h"
#include "nsIConsoleService.h"
#include "nsIFile.h"
#include "nsIObserverService.h"
#include "nsISimpleEnumerator.h"
#include "nsISubstitutingProtocolHandler.h"
#include "zlib.h"
#include "nsIXULRuntime.h"
#include "nsNetUtil.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
#include "nsZipArchive.h"
#endif
#include "zlib.h"
using namespace mozilla;
using namespace mozilla::css;
@ -477,7 +474,6 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile,
LoadSheet(uri, aSheet, aParsingMode, aFailureAction);
}
#ifdef MOZ_CRASHREPORTER
static inline nsresult
ComputeCRC32(nsIFile* aFile, uint32_t* aResult)
{
@ -754,7 +750,6 @@ AnnotateCrashReport(nsIURI* aURI)
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SheetLoadFailure"),
NS_ConvertUTF16toUTF8(annotation));
}
#endif
static void
ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
@ -770,10 +765,7 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
}
}
#ifdef MOZ_CRASHREPORTER
AnnotateCrashReport(aURI);
#endif
MOZ_CRASH_UNSAFE_OOL(errorMessage.get());
}
@ -800,9 +792,8 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
}
}
#ifdef MOZ_CRASHREPORTER
nsZipArchive::sFileCorruptedReason = nullptr;
#endif
nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet);
if (NS_FAILED(rv)) {
ErrorLoadingSheet(aURI,

View file

@ -572,8 +572,12 @@ nsDisplayXULImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBui
mozilla::layers::WebRenderLayerManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder)
{
ContainerLayerParameters parameter;
if (GetLayerState(aDisplayListBuilder, aManager, parameter) != LAYER_ACTIVE) {
nsImageBoxFrame* imageFrame = static_cast<nsImageBoxFrame*>(mFrame);
if (!imageFrame->CanOptimizeToImageLayer()) {
return false;
}
if (!imageFrame->mImageRequest) {
return false;
}
@ -585,7 +589,7 @@ nsDisplayXULImage::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBui
flags |= imgIContainer::FLAG_HIGH_QUALITY_SCALING;
}
DrawResult result = static_cast<nsImageBoxFrame*>(mFrame)->
DrawResult result = imageFrame->
CreateWebRenderCommands(aBuilder, aResources, aSc, aManager, this, ToReferenceFrame(), flags);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);

View file

@ -1,6 +1,6 @@
fails-if(Android) == textbox-multiline-noresize.xul textbox-multiline-ref.xul # reference is blank on Android (due to no native theme support?)
!= textbox-multiline-resize.xul textbox-multiline-ref.xul
== popup-explicit-size.xul popup-explicit-size-ref.xul
random-if(Android) fuzzy-if(webrender,128-128,324-540) == image-size.xul image-size-ref.xul
random-if(Android) fuzzy-if(webrender,128-128,168-168) == image-size.xul image-size-ref.xul
== image-scaling-min-height-1.xul image-scaling-min-height-1-ref.xul
== textbox-text-transform.xul textbox-text-transform-ref.xul

View file

@ -8,15 +8,13 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/Vector.h"
#include "mozmemory.h"
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#include "Utils.h"
#include "gtest/gtest.h"
#ifdef MOZ_CRASHREPORTER
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#endif
#ifdef NIGHTLY_BUILD
#if defined(DEBUG) && !defined(XP_WIN) && !defined(ANDROID)
@ -28,13 +26,11 @@ extern unsigned int _gdb_sleep_duration;
#ifndef XP_DARWIN
static void DisableCrashReporter()
{
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
#endif
}
// Wrap ASSERT_DEATH_IF_SUPPORTED to disable the crash reporter

View file

@ -1991,9 +1991,7 @@ var BrowserApp = {
// Crash reporter submit pref must be fetched from nsICrashReporter
// service.
case "datareporting.crashreporter.submitEnabled":
let crashReporterBuilt = "nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter;
if (crashReporterBuilt) {
if (AppConstants.MOZ_CRASHREPORTER) {
aSubject.setAsBool(Services.appinfo.submitReports);
}
break;
@ -2046,9 +2044,7 @@ var BrowserApp = {
// Crash reporter preference is in a service; set and return.
case "datareporting.crashreporter.submitEnabled":
let crashReporterBuilt = "nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter;
if (crashReporterBuilt) {
if (AppConstants.MOZ_CRASHREPORTER) {
Services.appinfo.submitReports = value;
aSubject.setAsEmpty();
}

View file

@ -1239,8 +1239,7 @@ SessionStore.prototype = {
},
_updateCrashReportURL: function ss_updateCrashReportURL(aWindow) {
let crashReporterBuilt = "nsICrashReporter" in Ci && Services.appinfo instanceof Ci.nsICrashReporter;
if (!crashReporterBuilt) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}

View file

@ -81,10 +81,6 @@
#include "plstr.h"
#include "prlink.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
#ifdef XP_WIN
#include "windows.h"
#endif
@ -484,13 +480,18 @@ public:
mHasUserValue = false;
}
void SetValue(PrefType aType,
nsresult SetValue(PrefType aType,
PrefValue aValue,
uint32_t aFlags,
bool* aValueChanged,
bool* aDirty)
{
if (aFlags & kPrefSetDefault) {
// Types must always match when setting the default value.
if (!IsType(aType)) {
return NS_ERROR_UNEXPECTED;
}
if (!IsLocked()) {
// ?? change of semantics?
if (!mHasDefaultValue || !mDefaultValue.Equals(aType, aValue)) {
@ -506,6 +507,12 @@ public:
// Should we clear the user value?
}
} else {
// If we have a default value, types must match when setting the user
// value.
if (mHasDefaultValue && !IsType(aType)) {
return NS_ERROR_UNEXPECTED;
}
// If new value is same as the default value and it's not a "sticky"
// pref, then un-set the user value. Otherwise, set the user value only
// if it has changed.
@ -527,6 +534,7 @@ public:
}
}
}
return NS_OK;
}
// Returns false if this pref doesn't have a user value worth saving.
@ -757,23 +765,24 @@ pref_SetPref(const char* aPrefName,
if (!pref->Name()) {
// New (zeroed) entry. Initialize it.
new (pref) PrefHashEntry(aPrefName, aType);
}
} else if (pref->HasDefaultValue() && !pref->IsType(aType)) {
bool valueChanged = false, handleDirty = false;
nsresult rv =
pref->SetValue(aType, aValue, aFlags, &valueChanged, &handleDirty);
if (NS_FAILED(rv)) {
NS_WARNING(
nsPrintfCString(
"Ignoring attempt to overwrite value of default pref %s (type %s) with "
"the wrong type (%s)!",
"Rejected attempt to change type of pref %s's %s value from %s to %s",
aPrefName,
(aFlags & kPrefSetDefault) ? "default" : "user",
PrefTypeToString(pref->Type()),
PrefTypeToString(aType))
.get());
return NS_ERROR_UNEXPECTED;
return rv;
}
bool valueChanged = false, handleDirty = false;
pref->SetValue(aType, aValue, aFlags, &valueChanged, &handleDirty);
if (handleDirty) {
Preferences::HandleDirty();
}

View file

@ -17,47 +17,125 @@ function run_test() {
let defaultBranch = ps.getDefaultBranch("");
let userBranch = ps.getBranch("");
//**************************************************************************//
// Can't change the type of prefs that have default values
// Prefs that only have a default value -- we can't change their type.
defaultBranch.setBoolPref("TypeTest.default.bool", true);
defaultBranch.setIntPref("TypeTest.default.int", 23);
defaultBranch.setCharPref("TypeTest.default.char", "hey");
defaultBranch.setBoolPref("TypeTest.existing.bool", true);
defaultBranch.setIntPref("TypeTest.existing.int", 23);
defaultBranch.setCharPref("TypeTest.existing.char", "hey");
do_check_eq(userBranch.getBoolPref("TypeTest.default.bool"), true);
do_check_eq(userBranch.getIntPref("TypeTest.default.int"), 23);
do_check_eq(userBranch.getCharPref("TypeTest.default.char"), "hey");
// The user branch reads back the expected default
do_check_eq(userBranch.getBoolPref("TypeTest.existing.bool"), true);
do_check_eq(userBranch.getIntPref("TypeTest.existing.int"), 23);
do_check_eq(userBranch.getCharPref("TypeTest.existing.char"), "hey");
// Prefs that only have a user value -- we can change their type, but only
// when we set the user value.
userBranch.setBoolPref("TypeTest.user.bool", false);
userBranch.setIntPref("TypeTest.user.int", 24);
userBranch.setCharPref("TypeTest.user.char", "hi");
// All the combinations of attempted type changes
do_check_throws(function() {
userBranch.setCharPref("TypeTest.existing.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setIntPref("TypeTest.existing.bool", 5); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setCharPref("TypeTest.existing.int", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setBoolPref("TypeTest.existing.int", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setBoolPref("TypeTest.existing.char", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setIntPref("TypeTest.existing.char", 6); }, Cr.NS_ERROR_UNEXPECTED);
do_check_eq(userBranch.getBoolPref("TypeTest.user.bool"), false);
do_check_eq(userBranch.getIntPref("TypeTest.user.int"), 24);
do_check_eq(userBranch.getCharPref("TypeTest.user.char"), "hi");
// Prefs that have both a default and a user value -- we can't change their
// type.
defaultBranch.setBoolPref("TypeTest.both.bool", true);
userBranch.setBoolPref("TypeTest.both.bool", false);
defaultBranch.setIntPref("TypeTest.both.int", 25);
userBranch.setIntPref("TypeTest.both.int", 26);
defaultBranch.setCharPref("TypeTest.both.char", "yo");
userBranch.setCharPref("TypeTest.both.char", "ya");
//**************************************************************************//
// Prefs that don't have default values can mutate
let pref = "TypeTest.user";
userBranch.setBoolPref(pref, true);
userBranch.setCharPref(pref, "yay");
do_check_eq(userBranch.getCharPref(pref), "yay");
userBranch.setIntPref(pref, 7);
do_check_eq(userBranch.getIntPref(pref), 7);
userBranch.setBoolPref(pref, false);
do_check_eq(userBranch.getBoolPref(pref), false);
userBranch.setIntPref(pref, 8);
do_check_eq(userBranch.getIntPref(pref), 8);
userBranch.setCharPref(pref, "whee");
do_check_eq(userBranch.getCharPref(pref), "whee");
userBranch.setBoolPref(pref, true);
do_check_eq(userBranch.getBoolPref(pref), true);
do_check_eq(userBranch.getBoolPref("TypeTest.both.bool"), false);
do_check_eq(userBranch.getIntPref("TypeTest.both.int"), 26);
do_check_eq(userBranch.getCharPref("TypeTest.both.char"), "ya");
// We only have a default value, and we try to set a default value of a
// different type --> fails.
do_check_throws(function() {
defaultBranch.setCharPref("TypeTest.default.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setIntPref("TypeTest.default.bool", 5); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setCharPref("TypeTest.default.int", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setBoolPref("TypeTest.default.int", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setBoolPref("TypeTest.default.char", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setIntPref("TypeTest.default.char", 6); }, Cr.NS_ERROR_UNEXPECTED);
// We only have a default value, and we try to set a user value of a
// different type --> fails.
do_check_throws(function() {
userBranch.setCharPref("TypeTest.default.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setIntPref("TypeTest.default.bool", 5); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setCharPref("TypeTest.default.int", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setBoolPref("TypeTest.default.int", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setBoolPref("TypeTest.default.char", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setIntPref("TypeTest.default.char", 6); }, Cr.NS_ERROR_UNEXPECTED);
// We only have a user value, and we try to set a default value of a
// different type --> fails.
do_check_throws(function() {
defaultBranch.setCharPref("TypeTest.user.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setIntPref("TypeTest.user.bool", 5); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setCharPref("TypeTest.user.int", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setBoolPref("TypeTest.user.int", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setBoolPref("TypeTest.user.char", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setIntPref("TypeTest.user.char", 6); }, Cr.NS_ERROR_UNEXPECTED);
// We only have a user value, and we try to set a user value of a
// different type --> SUCCEEDS.
userBranch.setCharPref("TypeTest.user.bool", "boo");
do_check_eq(userBranch.getCharPref("TypeTest.user.bool"), "boo");
userBranch.setIntPref("TypeTest.user.bool", 5);
do_check_eq(userBranch.getIntPref("TypeTest.user.bool"), 5);
userBranch.setCharPref("TypeTest.user.int", "boo");
do_check_eq(userBranch.getCharPref("TypeTest.user.int"), "boo");
userBranch.setBoolPref("TypeTest.user.int", true);
do_check_eq(userBranch.getBoolPref("TypeTest.user.int"), true);
userBranch.setBoolPref("TypeTest.user.char", true);
do_check_eq(userBranch.getBoolPref("TypeTest.user.char"), true);
userBranch.setIntPref("TypeTest.user.char", 6);
do_check_eq(userBranch.getIntPref("TypeTest.user.char"), 6);
// We have both a default value and user value, and we try to set a default
// value of a different type --> fails.
do_check_throws(function() {
defaultBranch.setCharPref("TypeTest.both.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setIntPref("TypeTest.both.bool", 5); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setCharPref("TypeTest.both.int", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setBoolPref("TypeTest.both.int", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setBoolPref("TypeTest.both.char", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
defaultBranch.setIntPref("TypeTest.both.char", 6); }, Cr.NS_ERROR_UNEXPECTED);
// We have both a default value and user value, and we try to set a user
// value of a different type --> fails.
do_check_throws(function() {
userBranch.setCharPref("TypeTest.both.bool", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setIntPref("TypeTest.both.bool", 5); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setCharPref("TypeTest.both.int", "boo"); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setBoolPref("TypeTest.both.int", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setBoolPref("TypeTest.both.char", true); }, Cr.NS_ERROR_UNEXPECTED);
do_check_throws(function() {
userBranch.setIntPref("TypeTest.both.char", 6); }, Cr.NS_ERROR_UNEXPECTED);
}

View file

@ -9,15 +9,13 @@
#include "mozilla/DebugOnly.h"
#include "ipc/IPCMessageUtils.h"
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#include "nsStringGlue.h"
#include "prio.h"
#include "mozilla/net/DNS.h"
#include "TimingStruct.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif
namespace IPC {
@ -102,12 +100,11 @@ struct ParamTraits<mozilla::net::NetAddr>
aMsg->WriteBytes(aParam.local.path, sizeof(aParam.local.path));
#endif
} else {
#ifdef MOZ_CRASHREPORTER
if (XRE_IsParentProcess()) {
nsPrintfCString msg("%d", aParam.raw.family);
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Unknown NetAddr socket family"), msg);
}
#endif
MOZ_CRASH("Unknown socket family");
}
}

View file

@ -18,9 +18,7 @@
#include "mozilla/Unused.h"
#include "mozilla/dom/Exceptions.h"
#include "nsContentUtils.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "mozilla/StackWalk.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@ -106,11 +104,8 @@ static void
SandboxCrash(int nr, siginfo_t *info, void *void_context)
{
pid_t pid = getpid(), tid = syscall(__NR_gettid);
bool dumped = false;
bool dumped = CrashReporter::WriteMinidumpForSigInfo(nr, info, void_context);
#ifdef MOZ_CRASHREPORTER
dumped = CrashReporter::WriteMinidumpForSigInfo(nr, info, void_context);
#endif
if (!dumped) {
SANDBOX_LOG_ERROR("crash reporter is disabled (or failed);"
" trying stack trace:");

View file

@ -12,6 +12,7 @@
#include "nsAutoPtr.h"
#include "nsCollationCID.h"
#include "nsEmbedCID.h"
#include "nsExceptionHandler.h"
#include "nsThreadUtils.h"
#include "mozStoragePrivateHelpers.h"
#include "nsIXPConnect.h"
@ -26,10 +27,6 @@
#include "sqlite3.h"
#include "mozilla/AutoSQLiteLifetime.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#ifdef XP_WIN
// "windows.h" was included and it can #define lots of things we care about...
#undef CompareString
@ -801,13 +798,11 @@ Service::Observe(nsISupports *, const char *aTopic, const char16_t *)
getConnections(connections);
for (uint32_t i = 0, n = connections.Length(); i < n; i++) {
if (!connections[i]->isClosed()) {
#ifdef MOZ_CRASHREPORTER
// getFilename is only the leaf name for the database file,
// so it shouldn't contain privacy-sensitive information.
CrashReporter::AnnotateCrashReport(
NS_LITERAL_CSTRING("StorageConnectionNotClosed"),
connections[i]->getFilename());
#endif
#ifdef DEBUG
printf_stderr("Storage connection not closed: %s",
connections[i]->getFilename().get());

View file

@ -6,9 +6,7 @@
#include "GTestRunner.h"
#include "gtest/gtest.h"
#include "mozilla/Attributes.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
#include "testing/TestHarness.h"
#include "prenv.h"
#ifdef XP_WIN
@ -91,7 +89,6 @@ int RunGTestFunc(int* argc, char** argv)
#ifdef XP_WIN
mozilla::ipc::windows::InitUIThread();
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter;
char *crashreporterStr = PR_GetEnv("MOZ_CRASHREPORTER");
if (crashreporterStr && !strcmp(crashreporterStr, "1")) {
@ -112,7 +109,6 @@ int RunGTestFunc(int* argc, char** argv)
crashreporter->SetMinidumpPath(cwd);
}
}
#endif
return RUN_ALL_TESTS();
}

View file

@ -1088,7 +1088,7 @@ this.BrowserTestUtils = {
}
let dumpID;
if ('nsICrashReporter' in Ci) {
if (AppConstants.MOZ_CRASHREPORTER) {
dumpID = subject.getPropertyAsAString('dumpID');
if (!dumpID) {
return reject("dumpID was not present despite crash reporting " +

View file

@ -6,6 +6,13 @@
SPHINX_TREES['crash-manager'] = 'docs'
XPIDL_MODULE = 'toolkit_crashservice'
XPIDL_SOURCES += [
'nsICrashService.idl',
]
if CONFIG['MOZ_CRASHREPORTER']:
EXTRA_COMPONENTS += [
'CrashService.js',
'CrashService.manifest',
@ -21,11 +28,6 @@ TESTING_JS_MODULES += [
XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
XPIDL_MODULE = 'toolkit_crashservice'
XPIDL_SOURCES += [
'nsICrashService.idl',
]
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Crash Reporting')

View file

@ -26,6 +26,7 @@ DIRS += [
'commandlines',
'contentprefs',
'contextualidentity',
'crashes',
'crashmonitor',
'diskspacewatcher',
'downloads',
@ -80,9 +81,6 @@ if CONFIG['MOZ_BUILD_APP'] != 'mobile/android':
if CONFIG['NS_PRINTING']:
DIRS += ['printing']
if CONFIG['MOZ_CRASHREPORTER']:
DIRS += ['crashes']
if CONFIG['BUILD_CTYPES']:
DIRS += ['ctypes']

View file

@ -6,9 +6,7 @@
#include "nsWidgetsCID.h"
#include "nsIComponentRegistrar.h"
#ifdef MOZ_CRASHREPORTER
#include "nsICrashReporter.h"
#endif
#ifndef TEST_NAME
#error "Must #define TEST_NAME before including places_test_harness_tail.h"

View file

@ -1358,6 +1358,39 @@ timestamps:
record_in_processes:
- main
# The following section contains the service worker scalars.
sw:
synthesized_res_count:
bug_numbers:
- 1416629
description: >
The count of number of synthesize response made by service workers.
expires: "61"
kind: uint
notification_emails:
- sw-telemetry@mozilla.com
- ttung@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
- 'content'
cors_res_for_so_req_count:
bug_numbers:
- 1416629
description: >
The count of number of synthesize response made by service workers and
it's a cors type resposne for a same-origin mode request.
expires: "61"
kind: uint
notification_emails:
- sw-telemetry@mozilla.com
- ttung@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- 'main'
- 'content'
# The following section is for probes testing the Telemetry system. They will not be
# submitted in pings and are only used for testing.
telemetry.test:

View file

@ -29,9 +29,7 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#if defined(MOZ_CRASHREPORTER)
#include "nsExceptionHandler.h"
#endif
#include "GeckoProfiler.h"
#include "nsThreadUtils.h"
@ -165,9 +163,8 @@ RunWatchdog(void* arg)
}
// Shutdown is apparently dead. Crash the process.
#if defined(MOZ_CRASHREPORTER)
CrashReporter::SetMinidumpAnalysisAllThreads();
#endif
MOZ_CRASH("Shutdown too long, probably frozen, causing a crash.");
}
}
@ -555,13 +552,11 @@ nsTerminator::UpdateTelemetry()
void
nsTerminator::UpdateCrashReport(const char* aTopic)
{
#if defined(MOZ_CRASHREPORTER)
// In case of crash, we wish to know where in shutdown we are
nsAutoCString report(aTopic);
Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"),
report);
#endif // defined(MOZ_CRASHREPORTER)
}

View file

@ -3,5 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
toolkit.jar:
#ifdef MOZ_CRASHREPORTER
content/global/crashes.xhtml (content/crashes.xhtml)
content/global/crashes.js (content/crashes.js)
#endif

View file

@ -6,6 +6,19 @@
SPHINX_TREES['crashreporter'] = 'docs'
EXPORTS += [
'nsExceptionHandler.h',
]
JAR_MANIFESTS += ['jar.mn']
UNIFIED_SOURCES = [
'nsExceptionHandlerUtils.cpp',
]
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_CRASHREPORTER']:
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += [
'google-breakpad/src/common',
@ -58,10 +71,6 @@ if CONFIG['ENABLE_TESTS']:
TEST_DIRS += ['test']
EXPORTS += [
'nsExceptionHandler.h',
]
UNIFIED_SOURCES += [
'nsExceptionHandler.cpp',
'ThreadAnnotation.cpp',
@ -80,8 +89,6 @@ EXTRA_JS_MODULES += [
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['OS_TARGET'] == 'Android':
DEFINES['ANDROID_NDK_MAJOR_VERSION'] = CONFIG['ANDROID_NDK_MAJOR_VERSION']
DEFINES['ANDROID_NDK_MINOR_VERSION'] = CONFIG['ANDROID_NDK_MINOR_VERSION']
@ -96,8 +103,6 @@ if CONFIG['OS_TARGET'] == 'Android':
DEFINES['UNICODE'] = True
DEFINES['_UNICODE'] = True
JAR_MANIFESTS += ['jar.mn']
LOCAL_INCLUDES += [
'google-breakpad/src',
]
@ -108,8 +113,13 @@ PYTHON_UNITTEST_MANIFESTS += [
include('/toolkit/crashreporter/crashreporter.mozbuild')
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Crash Reporting')
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-shadow']
else:
UNIFIED_SOURCES += [
'nsDummyExceptionHandler.cpp',
]
with Files('**'):
BUG_COMPONENT = ('Toolkit', 'Crash Reporting')

View file

@ -0,0 +1,425 @@
/* -*- 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 "nsExceptionHandler.h"
#include "nsExceptionHandlerUtils.h"
namespace CrashReporter {
void
AnnotateOOMAllocationSize(size_t size)
{
}
void
AnnotateTexturesSize(size_t size)
{
}
void
AnnotatePendingIPC(size_t aNumOfPendingIPC,
uint32_t aTopPendingIPCCount,
const char* aTopPendingIPCName,
uint32_t aTopPendingIPCType)
{
}
nsresult
SetExceptionHandler(nsIFile* aXREDirectory,
bool force/*=false*/)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
GetEnabled()
{
return false;
}
bool
GetMinidumpPath(nsAString& aPath)
{
return false;
}
nsresult
SetMinidumpPath(const nsAString& aPath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetupExtraData(nsIFile* aAppDataDirectory,
const nsACString& aBuildID)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
UnsetExceptionHandler()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
AnnotateCrashReport(const nsACString& key,
const nsACString& data)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
RemoveCrashReportAnnotation(const nsACString& key)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetGarbageCollecting(bool collecting)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetEventloopNestingLevel(uint32_t level)
{
}
void
SetMinidumpAnalysisAllThreads()
{
}
nsresult
AppendAppNotesToCrashReport(const nsACString& data)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
bool
GetAnnotation(const nsACString& key, nsACString& data)
{
return false;
}
nsresult
RegisterAppMemory(void* ptr, size_t length)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
UnregisterAppMemory(void* ptr)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetIncludeContextHeap(bool aValue)
{
}
bool
GetServerURL(nsACString& aServerURL)
{
return false;
}
nsresult
SetServerURL(const nsACString& aServerURL)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetRestartArgs(int argc, char** argv)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#ifdef XP_WIN32
nsresult
WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif
#ifdef XP_LINUX
bool
WriteMinidumpForSigInfo(int signo,
siginfo_t* info,
void* uc)
{
return false;
}
#endif
#ifdef XP_MACOSX
nsresult
AppendObjCExceptionInfoToAppNotes(void *inException)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
#endif
nsresult
GetSubmitReports(bool* aSubmitReports)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
SetSubmitReports(bool aSubmitReports)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetProfileDirectory(nsIFile* aDir)
{
}
void
SetUserAppDataDirectory(nsIFile* aDir)
{
}
void
UpdateCrashEventsDir()
{
}
bool
GetCrashEventsDir(nsAString& aPath)
{
return false;
}
void
SetMemoryReportFile(nsIFile* aFile)
{
}
nsresult
GetDefaultMemoryReportFile(nsIFile** aFile)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void
SetTelemetrySessionId(const nsACString& id)
{
}
void
DeleteMinidumpFilesForID(const nsAString& id)
{
}
bool
GetMinidumpForID(const nsAString& id, nsIFile** minidump)
{
return false;
}
bool
GetIDFromMinidump(nsIFile* minidump, nsAString& id)
{
return false;
}
bool
GetExtraFileForID(const nsAString& id,
nsIFile** extraFile)
{
return false;
}
bool
GetExtraFileForMinidump(nsIFile* minidump,
nsIFile** extraFile)
{
return false;
}
bool
AppendExtraData(const nsAString& id,
const AnnotationTable& data)
{
return false;
}
bool
AppendExtraData(nsIFile* extraFile,
const AnnotationTable& data)
{
return false;
}
void
OOPInit()
{
}
void
GetChildProcessTmpDir(nsIFile** aOutTmpDir)
{
}
#if defined(XP_WIN) || defined(XP_MACOSX)
const char*
GetChildNotificationPipe()
{
return nullptr;
}
#endif
#ifdef MOZ_CRASHREPORTER_INJECTOR
void
InjectCrashReporterIntoProcess(DWORD processID, InjectorCrashCallback* cb)
{
}
void
UnregisterInjectorCallback(DWORD processID)
{
}
#endif // MOZ_CRASHREPORTER_INJECTOR
bool
GetLastRunCrashID(nsAString& id)
{
return false;
}
#if defined(XP_WIN) || defined(XP_MACOSX)
void
InitChildProcessTmpDir(nsIFile* aDirOverride)
{
}
#endif // defined(XP_WIN) || defined(XP_MACOSX)
#if defined(XP_WIN)
bool
SetRemoteExceptionHandler(const nsACString& crashPipe)
{
return false;
}
#elif defined(XP_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
bool
CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd)
{
return false;
}
bool
SetRemoteExceptionHandler()
{
return false;
}
#elif defined(XP_MACOSX)
bool
SetRemoteExceptionHandler(const nsACString& crashPipe)
{
return false;
}
#endif // XP_WIN
bool
TakeMinidumpForChild(uint32_t childPid, nsIFile** dump, uint32_t* aSequence)
{
return false;
}
void
RenameAdditionalHangMinidump(nsIFile* minidump, nsIFile* childMinidump,
const nsACString& name)
{
}
ThreadId
CurrentThreadId()
{
return -1;
}
bool
TakeMinidump(nsIFile** aResult, bool aMoveToPending)
{
return false;
}
void
CreateMinidumpsAndPair(ProcessHandle aTargetPid,
ThreadId aTargetBlamedThread,
const nsACString& aIncomingPairName,
nsIFile* aIncomingDumpToPair,
nsIFile** aMainDumpOut,
std::function<void(bool)>&& aCallback,
bool aAsync)
{
}
bool
CreateAdditionalChildMinidump(ProcessHandle childPid,
ThreadId childBlamedThread,
nsIFile* parentMinidump,
const nsACString& name)
{
return false;
}
bool
UnsetRemoteExceptionHandler()
{
return false;
}
#if defined(MOZ_WIDGET_ANDROID)
void
SetNotificationPipeForChild(int childCrashFd)
{
}
void
AddLibraryMapping(const char* library_name,
uintptr_t start_address,
size_t mapping_length,
size_t file_offset)
{
}
#endif
// From ThreadAnnotation.cpp
void
InitThreadAnnotation()
{
}
void
SetCurrentThreadName(const char* aName)
{
}
void
GetFlatThreadAnnotation(const std::function<void(const char*)>& aCallback)
{
}
void
ShutdownThreadAnnotation()
{
}
} // namespace CrashReporter

View file

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsExceptionHandler.h"
#include "nsExceptionHandlerUtils.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
@ -87,7 +88,6 @@ using mozilla::InjectCrashRunnable;
#include <map>
#include <vector>
#include "mozilla/double-conversion.h"
#include "mozilla/IOInterposer.h"
#include "mozilla/mozalloc_oom.h"
#include "mozilla/WindowsDllBlocklist.h"
@ -413,54 +413,6 @@ typedef std::map<uint32_t,google_breakpad::MappingList> MappingMap;
#endif
}
// Format a non-negative double to a string, without using C-library functions,
// which need to be avoided (.e.g. bug 1240160, comment 10). Leave the utility
// non-file static so that we can gtest it. Return false if we failed to
// get the formatting done correctly.
bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength)
{
// aBufferLength is the size of the buffer. Be paranoid.
aBuffer[aBufferLength-1] = '\0';
if (aValue < 0) {
return false;
}
int length, point, i;
bool sign;
bool ok = true;
double_conversion::DoubleToStringConverter::DoubleToAscii(
aValue,
double_conversion::DoubleToStringConverter::SHORTEST,
8,
aBuffer,
aBufferLength,
&sign,
&length,
&point);
// length does not account for the 0 terminator.
if (length > point && (length+1) < (aBufferLength-1)) {
// We have to insert a decimal point. Not worried about adding a leading zero
// in the < 1 (point == 0) case.
aBuffer[length+1] = '\0';
for (i=length; i>point; i-=1) {
aBuffer[i] = aBuffer[i-1];
}
aBuffer[i] = '.'; // Not worried about locales
} else if (length < point) {
// Trailing zeros scenario
for (i=length; i<point; i+=1) {
if (i >= aBufferLength-2) {
ok = false;
}
aBuffer[i] = '0';
}
aBuffer[i] = '\0';
}
return ok;
}
namespace CrashReporter {
#ifdef XP_LINUX

View file

@ -3,6 +3,12 @@
* 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/. */
// This header has two implementations, the real one in nsExceptionHandler.cpp
// and a dummy in nsDummyExceptionHandler.cpp. The latter is used in builds
// configured with --disable-crashreporter. If you add or remove a function
// from this header you must update both implementations otherwise you'll break
// builds that disable the crash reporter.
#ifndef nsExceptionHandler_h__
#define nsExceptionHandler_h__
@ -34,6 +40,19 @@ template<class KeyClass, class DataType> class nsDataHashtable;
class nsCStringHashKey;
namespace CrashReporter {
/**
* Returns true if the crash reporter is using the dummy implementation.
*/
static inline bool
IsDummy() {
#ifdef MOZ_CRASHREPORTER
return false;
#else
return true;
#endif
}
nsresult SetExceptionHandler(nsIFile* aXREDirectory, bool force=false);
nsresult UnsetExceptionHandler();
@ -248,7 +267,7 @@ void UnregisterInjectorCallback(DWORD processID);
bool SetRemoteExceptionHandler(const nsACString& crashPipe);
void InitChildProcessTmpDir(nsIFile* aDirOverride = nullptr);
# elif defined(XP_LINUX)
# elif defined(XP_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS)
// Parent-side API for children
// Set the outparams for crash reporter server's fd (|childCrashFd|)

View file

@ -0,0 +1,56 @@
/* -*- 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 "nsExceptionHandlerUtils.h"
#include "mozilla/double-conversion.h"
// Format a non-negative double to a string, without using C-library functions,
// which need to be avoided (.e.g. bug 1240160, comment 10). Return false if
// we failed to get the formatting done correctly.
bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength)
{
// aBufferLength is the size of the buffer. Be paranoid.
aBuffer[aBufferLength-1] = '\0';
if (aValue < 0) {
return false;
}
int length, point, i;
bool sign;
bool ok = true;
double_conversion::DoubleToStringConverter::DoubleToAscii(
aValue,
double_conversion::DoubleToStringConverter::SHORTEST,
8,
aBuffer,
aBufferLength,
&sign,
&length,
&point);
// length does not account for the 0 terminator.
if (length > point && (length+1) < (aBufferLength-1)) {
// We have to insert a decimal point. Not worried about adding a leading zero
// in the < 1 (point == 0) case.
aBuffer[length+1] = '\0';
for (i=length; i>point; i-=1) {
aBuffer[i] = aBuffer[i-1];
}
aBuffer[i] = '.'; // Not worried about locales
} else if (length < point) {
// Trailing zeros scenario
for (i=length; i<point; i+=1) {
if (i >= aBufferLength-2) {
ok = false;
}
aBuffer[i] = '0';
}
aBuffer[i] = '\0';
}
return ok;
}

View file

@ -0,0 +1,12 @@
/* -*- 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 nsExceptionHandlerUtils_h__
#define nsExceptionHandlerUtils_h__
bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
#endif // nsExceptionHandlerUtils_h__

View file

@ -7,6 +7,7 @@
DIRS += [
'components',
'content',
'crashreporter',
'forgetaboutsite',
'locales',
'modules',
@ -46,9 +47,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['system/androidproxy']
if CONFIG['MOZ_CRASHREPORTER']:
DIRS += ['crashreporter']
TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.crashreporter.test.browser += [
'crashreporter/test/browser/crashreport.sjs',
]

View file

@ -2201,8 +2201,7 @@ this.XPIProvider = {
Services.obs.notifyObservers(null, "chrome-flush-caches");
}
if ("nsICrashReporter" in Ci &&
Services.appinfo instanceof Ci.nsICrashReporter) {
if (AppConstants.MOZ_CRASHREPORTER) {
// Annotate the crash report with relevant add-on information.
try {
Services.appinfo.annotateCrashReport("Theme", this.currentSkin);
@ -2763,14 +2762,16 @@ this.XPIProvider = {
* Adds a list of currently active add-ons to the next crash report.
*/
addAddonsToCrashReporter() {
if (!("nsICrashReporter" in Ci) ||
!(Services.appinfo instanceof Ci.nsICrashReporter))
if (!(Services.appinfo instanceof Ci.nsICrashReporter) ||
!AppConstants.MOZ_CRASHREPORTER) {
return;
}
// In safe mode no add-ons are loaded so we should not include them in the
// crash report
if (Services.appinfo.inSafeMode)
if (Services.appinfo.inSafeMode) {
return;
}
let data = Array.from(XPIStates.enabledAddons(),
a => encoded`${a.id}:${a.version}`).join(",");

Some files were not shown because too many files have changed in this diff Show more