merge mozilla-inbound to mozilla-central. r=merge a=merge

MozReview-Commit-ID: 5E7o1qELKmN
This commit is contained in:
Sebastian Hengst 2017-04-01 13:09:55 +02:00
Родитель cc062e76c1 3a0357deec
Коммит 65f9bb8041
24 изменённых файлов: 129 добавлений и 138 удалений

Просмотреть файл

@ -4690,14 +4690,24 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
# For JS-implemented APIs, we refuse to allow passing objects that the
# API consumer does not subsume. The extra parens around
# ($${passedToJSImpl}) suppress unreachable code warnings when
# $${passedToJSImpl} is the literal `false`.
# $${passedToJSImpl} is the literal `false`. But Apple is shipping a
# buggy clang (clang 3.9) in Xcode 8.3, so there even the parens are not
# enough. So we manually disable some warnings in clang.
if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
templateBody = fill(
"""
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#pragma clang diagnostic ignored "-Wunreachable-code-return"
#endif // __clang__
if (($${passedToJSImpl}) && !CallerSubsumes($${val})) {
ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
$*{exceptionCode}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
""",
sourceDescription=sourceDescription,
exceptionCode=exceptionCode) + templateBody
@ -5896,14 +5906,24 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
# For JS-implemented APIs, we refuse to allow passing objects that the
# API consumer does not subsume. The extra parens around
# ($${passedToJSImpl}) suppress unreachable code warnings when
# $${passedToJSImpl} is the literal `false`.
# $${passedToJSImpl} is the literal `false`. But Apple is shipping a
# buggy clang (clang 3.9) in Xcode 8.3, so there even the parens are not
# enough. So we manually disable some warnings in clang.
if not isinstance(descriptorProvider, Descriptor) or descriptorProvider.interface.isJSImplemented():
templateBody = fill(
"""
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#pragma clang diagnostic ignored "-Wunreachable-code-return"
#endif // __clang__
if (($${passedToJSImpl}) && !CallerSubsumes($${val})) {
ThrowErrorMessage(cx, MSG_PERMISSION_DENIED_TO_PASS_ARG, "${sourceDescription}");
$*{exceptionCode}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif // __clang__
""",
sourceDescription=sourceDescription,
exceptionCode=exceptionCode) + templateBody

Просмотреть файл

@ -4,14 +4,18 @@
# 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/.
# These files cannot be built in unified mode because they rely on plarena.h
SOURCES += [
UNIFIED_SOURCES += [
'ChromeScriptLoader.cpp',
'mozJSComponentLoader.cpp',
'mozJSLoaderUtils.cpp',
'mozJSSubScriptLoader.cpp',
]
# mozJSComponentLoader.cpp cannot be built in unified mode because it uses
# windows.h
SOURCES += [
'mozJSComponentLoader.cpp'
]
EXPORTS.mozilla.dom += [
'PrecompiledScript.h',
]

Просмотреть файл

@ -3546,7 +3546,7 @@ XPCJSContext::Initialize()
// isRunOnce mode and compiled function bodies (from
// JS::CompileFunction). In practice, this means content scripts and event
// handlers.
UniquePtr<XPCJSSourceHook> hook(new XPCJSSourceHook);
mozilla::UniquePtr<XPCJSSourceHook> hook(new XPCJSSourceHook);
js::SetSourceHook(cx, Move(hook));
// Set up locale information and callbacks for the newly-created context so

Просмотреть файл

@ -1303,8 +1303,8 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
// A initializer to initialize histogram collection
// used by telemetry.
UniquePtr<base::StatisticsRecorder> telStats =
MakeUnique<base::StatisticsRecorder>();
auto telStats =
mozilla::MakeUnique<base::StatisticsRecorder>();
char aLocal;
profiler_init(&aLocal);

Просмотреть файл

@ -17,6 +17,7 @@ UNIFIED_SOURCES += [
'nsXPConnect.cpp',
'Sandbox.cpp',
'XPCCallContext.cpp',
'XPCComponents.cpp',
'XPCConvert.cpp',
'XPCDebug.cpp',
'XPCException.cpp',
@ -42,11 +43,6 @@ UNIFIED_SOURCES += [
'XPCWrapper.cpp',
]
# XPCComponents.cpp cannot be built in unified mode because it uses plarena.h.
SOURCES += [
'XPCComponents.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -104,6 +104,7 @@ UNIFIED_SOURCES += [
'nsLayoutDebugger.cpp',
'nsLayoutHistoryState.cpp',
'nsLayoutUtils.cpp',
'nsPresArena.cpp',
'nsPresContext.cpp',
'nsQuoteList.cpp',
'nsStyleChangeList.cpp',
@ -136,10 +137,8 @@ else:
'nsBidi_noICU.cpp',
]
# nsPresArena.cpp needs to be built separately because it uses plarena.h.
# nsRefreshDriver.cpp needs to be built separately because of name clashes in the OS X headers
SOURCES += [
'nsPresArena.cpp',
'nsRefreshDriver.cpp',
]

Просмотреть файл

@ -7,16 +7,6 @@
/* arena allocation for the frame tree and closely-related objects */
// Even on 32-bit systems, we allocate objects from the frame arena
// that require 8-byte alignment. The cast to uintptr_t is needed
// because plarena isn't as careful about mask construction as it
// ought to be.
#define ALIGN_SHIFT 3
#define PL_ARENA_CONST_ALIGN_MASK ((uintptr_t(1) << ALIGN_SHIFT) - 1)
#include "plarena.h"
// plarena.h needs to be included first to make it use the above
// PL_ARENA_CONST_ALIGN_MASK in this file.
#include "nsPresArena.h"
#include "mozilla/Poison.h"
@ -29,12 +19,8 @@
using namespace mozilla;
// Size to use for PLArena block allocations.
static const size_t ARENA_PAGE_SIZE = 8192;
nsPresArena::nsPresArena()
{
PL_INIT_ARENA_POOL(&mPool, "PresArena", ARENA_PAGE_SIZE);
}
nsPresArena::~nsPresArena()
@ -52,8 +38,6 @@ nsPresArena::~nsPresArena()
}
}
#endif
PL_FinishArenaPool(&mPool);
}
/* inline */ void
@ -114,7 +98,7 @@ nsPresArena::Allocate(uint32_t aCode, size_t aSize)
MOZ_ASSERT(aSize > 0, "PresArena cannot allocate zero bytes");
// We only hand out aligned sizes
aSize = PL_ARENA_ALIGN(&mPool, aSize);
aSize = mPool.AlignedSize(aSize);
// If there is no free-list entry for this type already, we have
// to create one now, to record its size.
@ -162,11 +146,7 @@ nsPresArena::Allocate(uint32_t aCode, size_t aSize)
// Allocate a new chunk from the arena
list->mEntriesEverAllocated++;
PL_ARENA_ALLOCATE(result, &mPool, aSize);
if (!result) {
NS_ABORT_OOM(aSize);
}
return result;
return mPool.Allocate(aSize);
}
void
@ -198,7 +178,7 @@ nsPresArena::AddSizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf,
// slop in the arena itself as well as the size of objects that
// we've not measured explicitly.
size_t mallocSize = PL_SizeOfArenaPoolExcludingPool(&mPool, aMallocSizeOf);
size_t mallocSize = mPool.SizeOfExcludingThis(aMallocSizeOf);
mallocSize += mFreeLists.SizeOfExcludingThis(aMallocSizeOf);
size_t totalSizeInFreeLists = 0;

Просмотреть файл

@ -10,6 +10,7 @@
#ifndef nsPresArena_h___
#define nsPresArena_h___
#include "mozilla/ArenaAllocator.h"
#include "mozilla/ArenaObjectID.h"
#include "mozilla/ArenaRefPtr.h"
#include "mozilla/MemoryChecking.h" // Note: Do not remove this, needed for MOZ_HAVE_MEM_CHECKS below
@ -20,7 +21,6 @@
#include "nsHashKeys.h"
#include "nsTArray.h"
#include "nsTHashtable.h"
#include "plarena.h"
struct nsArenaMemoryStats;
@ -156,7 +156,7 @@ private:
};
nsTHashtable<FreeList> mFreeLists;
PLArenaPool mPool;
mozilla::ArenaAllocator<8192, 8> mPool;
nsDataHashtable<nsPtrHashKey<void>, mozilla::ArenaObjectID> mArenaRefPtrs;
};

Просмотреть файл

@ -158,6 +158,7 @@ UNIFIED_SOURCES += [
'nsIntervalSet.cpp',
'nsLeafFrame.cpp',
'nsLineBox.cpp',
'nsLineLayout.cpp',
'nsPageContentFrame.cpp',
'nsPageFrame.cpp',
'nsPlaceholderFrame.cpp',
@ -186,10 +187,8 @@ UNIFIED_SOURCES += [
'ViewportFrame.cpp',
]
# nsLineLayout.cpp needs to be built separately because it uses plarena.h.
# nsPluginFrame.cpp needs to be built separately because of name clashes in the OS X headers.
SOURCES += [
'nsLineLayout.cpp',
'nsPluginFrame.cpp',
]

Просмотреть файл

@ -5,9 +5,6 @@
/* state and methods used while laying out a single line of a block frame */
// This has to be defined before nsLineLayout.h is included, because
// nsLineLayout.h has a #include for plarena.h, which needs this defined:
#define PL_ARENA_CONST_ALIGN_MASK (sizeof(void*)-1)
#include "nsLineLayout.h"
#include "LayoutLogging.h"
@ -111,7 +108,6 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
// spans, we do it on demand so that situations that only use a few
// frames and spans won't waste a lot of time in unneeded
// initialization.
PL_INIT_ARENA_POOL(&mArena, "nsLineLayout", 1024);
mFrameFreeList = nullptr;
mSpanFreeList = nullptr;
@ -129,8 +125,6 @@ nsLineLayout::~nsLineLayout()
MOZ_COUNT_DTOR(nsLineLayout);
NS_ASSERTION(nullptr == mRootSpan, "bad line-layout user");
PL_FinishArenaPool(&mArena);
}
// Find out if the frame has a non-null prev-in-flow, i.e., whether it
@ -386,12 +380,7 @@ nsLineLayout::NewPerSpanData()
nsLineLayout* outerLineLayout = GetOutermostLineLayout();
PerSpanData* psd = outerLineLayout->mSpanFreeList;
if (!psd) {
void *mem;
size_t sz = sizeof(PerSpanData);
PL_ARENA_ALLOCATE(mem, &outerLineLayout->mArena, sz);
if (!mem) {
NS_ABORT_OOM(sz);
}
void *mem = outerLineLayout->mArena.Allocate(sizeof(PerSpanData));
psd = reinterpret_cast<PerSpanData*>(mem);
}
else {
@ -652,12 +641,7 @@ nsLineLayout::NewPerFrameData(nsIFrame* aFrame)
nsLineLayout* outerLineLayout = GetOutermostLineLayout();
PerFrameData* pfd = outerLineLayout->mFrameFreeList;
if (!pfd) {
void *mem;
size_t sz = sizeof(PerFrameData);
PL_ARENA_ALLOCATE(mem, &outerLineLayout->mArena, sz);
if (!mem) {
NS_ABORT_OOM(sz);
}
void *mem = outerLineLayout->mArena.Allocate(sizeof(PerFrameData));
pfd = reinterpret_cast<PerFrameData*>(mem);
}
else {

Просмотреть файл

@ -19,10 +19,10 @@
#include "gfxTypes.h"
#include "JustificationUtils.h"
#include "mozilla/ArenaAllocator.h"
#include "mozilla/WritingModes.h"
#include "BlockReflowInput.h"
#include "nsLineBox.h"
#include "plarena.h"
class nsFloatManager;
struct nsStyleText;
@ -635,7 +635,11 @@ protected:
int32_t mSpansAllocated, mSpansFreed;
int32_t mFramesAllocated, mFramesFreed;
#endif
PLArenaPool mArena; // Per span and per frame data, 4 byte aligned
/**
* Per span and per frame data.
*/
mozilla::ArenaAllocator<1024, sizeof(void*)> mArena;
/**
* Allocate a PerFrameData from the mArena pool. The allocation is infallible.

Просмотреть файл

@ -923,8 +923,6 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mHitTestShouldStopAtFirstOpaque(false)
{
MOZ_COUNT_CTOR(nsDisplayListBuilder);
PL_InitArenaPool(&mPool, "displayListArena", 4096,
std::max(NS_ALIGNMENT_OF(void*),NS_ALIGNMENT_OF(double))-1);
nsPresContext* pc = aReferenceFrame->PresContext();
nsIPresShell *shell = pc->PresShell();
@ -1112,7 +1110,6 @@ nsDisplayListBuilder::~nsDisplayListBuilder() {
c->DisplayItemClipChain::~DisplayItemClipChain();
}
PL_FinishArenaPool(&mPool);
MOZ_COUNT_DTOR(nsDisplayListBuilder);
}
@ -1336,12 +1333,7 @@ nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame)
void*
nsDisplayListBuilder::Allocate(size_t aSize)
{
void *tmp;
PL_ARENA_ALLOCATE(tmp, &mPool, aSize);
if (!tmp) {
NS_ABORT_OOM(aSize);
}
return tmp;
return mPool.Allocate(aSize);
}
ActiveScrolledRoot*

Просмотреть файл

@ -13,16 +13,17 @@
#ifndef NSDISPLAYLIST_H_
#define NSDISPLAYLIST_H_
#include "mozilla/ArenaAllocator.h"
#include "mozilla/Attributes.h"
#include "mozilla/Array.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/EnumSet.h"
#include "mozilla/Maybe.h"
#include "mozilla/TemplateLib.h" // mozilla::tl::Max
#include "nsCOMPtr.h"
#include "nsContainerFrame.h"
#include "nsPoint.h"
#include "nsRect.h"
#include "plarena.h"
#include "nsRegion.h"
#include "nsDisplayListInvalidation.h"
#include "nsRenderingContext.h"
@ -235,7 +236,7 @@ enum class nsDisplayListBuilderMode : uint8_t {
* This manages a display list and is passed as a parameter to
* nsIFrame::BuildDisplayList.
* It contains the parameters that don't change from frame to frame and manages
* the display list memory using a PLArena. It also establishes the reference
* the display list memory using an arena. It also establishes the reference
* coordinate system for all display list items. Some of the parameters are
* available from the prescontext/presshell, but we copy them into the builder
* for faster/more convenient access.
@ -1455,7 +1456,11 @@ private:
nsIFrame* const mReferenceFrame;
nsIFrame* mIgnoreScrollFrame;
nsDisplayLayerEventRegions* mLayerEventRegions;
PLArenaPool mPool;
static const size_t kArenaAlignment =
mozilla::tl::Max<NS_ALIGNMENT_OF(void*), NS_ALIGNMENT_OF(double)>::value;
mozilla::ArenaAllocator<4096, kArenaAlignment> mPool;
nsCOMPtr<nsISelection> mBoundingSelection;
AutoTArray<PresShellState,8> mPresShellStates;
AutoTArray<nsIFrame*,100> mFramesMarkedForDisplay;

Просмотреть файл

@ -186,6 +186,7 @@ UNIFIED_SOURCES += [
'nsCSSProps.cpp',
'nsCSSPseudoClasses.cpp',
'nsCSSPseudoElements.cpp',
'nsCSSRuleProcessor.cpp',
'nsCSSRules.cpp',
'nsCSSScanner.cpp',
'nsCSSValue.cpp',
@ -230,12 +231,9 @@ UNIFIED_SOURCES += [
'StyleSheet.cpp',
]
# - nsCSSRuleProcessor.cpp needs to be built separately because it uses
# plarena.h.
# - nsLayoutStylesheetCache.cpp needs to be built separately because it uses
# nsExceptionHandler.h, which includes windows.h.
SOURCES += [
'nsCSSRuleProcessor.cpp',
'nsLayoutStylesheetCache.cpp',
]

Просмотреть файл

@ -9,13 +9,6 @@
* matching and cascading
*/
#define PL_ARENA_CONST_ALIGN_MASK 7
// We want page-sized arenas so there's no fragmentation involved.
// Including plarena.h must come first to avoid it being included by some
// header file thereby making PL_ARENA_CONST_ALIGN_MASK ineffective.
#define NS_CASCADEENUMDATA_ARENA_BLOCK_SIZE (4096)
#include "plarena.h"
#include "nsCSSRuleProcessor.h"
#include "nsAutoPtr.h"
@ -64,6 +57,8 @@
using namespace mozilla;
using namespace mozilla::dom;
typedef ArenaAllocator<4096, 8> CascadeAllocator;
#define VISITED_PSEUDO_PREF "layout.css.visited_links_enabled"
static bool gSupportVisitedPseudo = true;
@ -3444,10 +3439,8 @@ struct PerWeightDataListItem : public RuleSelectorPair {
// Placement new to arena allocate the PerWeightDataListItem
void *operator new(size_t aSize, PLArenaPool &aArena) CPP_THROW_NEW {
void *mem;
PL_ARENA_ALLOCATE(mem, &aArena, aSize);
return mem;
void *operator new(size_t aSize, CascadeAllocator &aArena) CPP_THROW_NEW {
return aArena.Allocate(aSize, fallible);
}
PerWeightDataListItem *mNext;
@ -3521,14 +3514,10 @@ struct CascadeEnumData {
mSheetType(aSheetType),
mMustGatherDocumentRules(aMustGatherDocumentRules)
{
// Initialize our arena
PL_INIT_ARENA_POOL(&mArena, "CascadeEnumDataArena",
NS_CASCADEENUMDATA_ARENA_BLOCK_SIZE);
}
~CascadeEnumData()
{
PL_FinishArenaPool(&mArena);
}
nsPresContext* mPresContext;
@ -3540,7 +3529,8 @@ struct CascadeEnumData {
nsTArray<css::DocumentRule*>& mDocumentRules;
nsMediaQueryResultCacheKey& mCacheKey;
nsDocumentRuleResultCacheKey& mDocumentCacheKey;
PLArenaPool mArena;
// We want page-sized arenas so there's no fragmentation involved.
CascadeAllocator mArena;
// Hooray, a manual PLDHashTable since nsClassHashtable doesn't
// provide a getter that gives me a *reference* to the value.
PLDHashTable mRulesByWeight; // of PerWeightDataListItem linked lists

Просмотреть файл

@ -229,6 +229,10 @@ static const DllBlockInfo sWindowsDllBlocklist[] = {
{ "smci32.dll", ALL_VERSIONS },
{ "smci64.dll", ALL_VERSIONS },
// Crashes with Internet Download Manager, bug 1333486
{ "idmcchandler7.dll", ALL_VERSIONS },
{ "idmcchandler7_64.dll", ALL_VERSIONS },
{ nullptr, 0 }
};

Просмотреть файл

@ -153,11 +153,10 @@ nsDirIndexParser::ParseFormat(const char* aFormatStr) {
// Prevent nullptr Deref - Bug 443299
if (mFormat == nullptr)
return NS_ERROR_OUT_OF_MEMORY;
mFormat[num] = -1;
mFormat[0] = -1; // to detect zero header fields
int formatNum=0;
do {
mFormat[formatNum] = -1;
while (*aFormatStr && nsCRT::IsAsciiSpace(char16_t(*aFormatStr)))
++aFormatStr;
@ -198,7 +197,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
// Parse a "201" data line, using the field ordering specified in
// mFormat.
if (!mFormat) {
if (!mFormat || (mFormat[0] == -1)) {
// Ignore if we haven't seen a format yet.
return NS_OK;
}
@ -207,15 +206,10 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
nsAutoCString filename;
int32_t lineLen = aLineLen;
if (mFormat[0] == -1) {
// no known header fields is an error
return NS_ERROR_ILLEGAL_VALUE;
}
for (int32_t i = 0; mFormat[i] != -1; ++i) {
// If we've exhausted the data before we run out of fields, just bail.
if (!*aDataStr || (lineLen < 1)) {
return NS_ERROR_ILLEGAL_VALUE;
return NS_OK;
}
while ((lineLen > 0) && nsCRT::IsAsciiSpace(*aDataStr)) {
@ -225,7 +219,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
if (lineLen < 1) {
// invalid format, bail
return NS_ERROR_ILLEGAL_VALUE;
return NS_OK;
}
char *value = aDataStr;
@ -245,7 +239,7 @@ nsDirIndexParser::ParseData(nsIDirIndex *aIdx, char* aDataStr, int32_t aLineLen)
if (!lineLen) {
// invalid format, bail
return NS_ERROR_ILLEGAL_VALUE;
return NS_OK;
}
} else {
// it's unquoted. snarf until we see whitespace.

Просмотреть файл

@ -66,6 +66,7 @@ config = {
'enable_count_ctors': True,
'enable_talos_sendchange': False,
'enable_unittest_sendchange': True,
'skip_balrog_uploads': True, # If True, rely on Funsize to update Balrog
#########################################################################

Просмотреть файл

@ -65,6 +65,7 @@ config = {
'enable_count_ctors': True,
'enable_talos_sendchange': False,
'enable_unittest_sendchange': True,
'skip_balrog_uploads': True, # If True, rely on Funsize to update Balrog
#########################################################################

Просмотреть файл

@ -2126,6 +2126,10 @@ or run without that action (ie: --no-{action})"
self.generate_balrog_props(props_path)
return
if self.config.get('skip_balrog_uploads'):
self.info("Funsize will submit to balrog, skipping submission here.")
return
if not self.config.get("balrog_servers"):
self.fatal("balrog_servers not set; skipping balrog submission.")
return

Просмотреть файл

@ -2288,46 +2288,58 @@ TelemetryHistogram::CreateHistogramSnapshots(JSContext *cx,
// OK, now we can actually reflect things.
JS::Rooted<JSObject*> hobj(cx);
for (auto h : hs) {
if (!internal_ShouldReflectHistogram(h) || internal_IsEmpty(h) ||
internal_IsExpired(h)) {
GeckoProcessType const processTypes[] = { GeckoProcessType_Default, GeckoProcessType_Content, GeckoProcessType_GPU };
size_t numProcessTypes = (includeGPUProcess ? 3 : 2);
for (size_t i = 0; i < mozilla::Telemetry::HistogramCount; ++i) {
if (gHistograms[i].keyed) {
continue;
}
Histogram* original = h;
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
h = internal_GetSubsessionHistogram(*h);
if (!h) {
Histogram* h = nullptr;
mozilla::Telemetry::HistogramID id = mozilla::Telemetry::HistogramID(i);
for (size_t type = 0; type < numProcessTypes; ++type) {
nsresult rv = internal_GetHistogramByEnumId(id, &h, processTypes[type]);
if (NS_WARN_IF(NS_FAILED(rv)) || !internal_ShouldReflectHistogram(h) ||
internal_IsEmpty(h) || internal_IsExpired(h)) {
continue;
}
}
Histogram* original = h;
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession) {
h = internal_GetSubsessionHistogram(*h);
if (!h) {
continue;
}
}
#endif
hobj = JS_NewPlainObject(cx);
if (!hobj) {
return NS_ERROR_FAILURE;
}
switch (internal_ReflectHistogramSnapshot(cx, hobj, h)) {
case REFLECT_CORRUPT:
// We can still hit this case even if ShouldReflectHistograms
// returns true. The histogram lies outside of our control
// somehow; just skip it.
continue;
case REFLECT_FAILURE:
return NS_ERROR_FAILURE;
case REFLECT_OK:
if (!JS_DefineProperty(cx, root_obj, original->histogram_name().c_str(),
hobj, JSPROP_ENUMERATE)) {
hobj = JS_NewPlainObject(cx);
if (!hobj) {
return NS_ERROR_FAILURE;
}
}
switch (internal_ReflectHistogramSnapshot(cx, hobj, h)) {
case REFLECT_CORRUPT:
// We can still hit this case even if ShouldReflectHistograms
// returns true. The histogram lies outside of our control
// somehow; just skip it.
continue;
case REFLECT_FAILURE:
return NS_ERROR_FAILURE;
case REFLECT_OK:
if (!JS_DefineProperty(cx, root_obj, original->histogram_name().c_str(),
hobj, JSPROP_ENUMERATE)) {
return NS_ERROR_FAILURE;
}
}
#if !defined(MOZ_WIDGET_ANDROID)
if (subsession && clearSubsession) {
h->Clear();
}
if (subsession && clearSubsession) {
h->Clear();
}
#endif
}
}
return NS_OK;
}

Просмотреть файл

@ -778,6 +778,14 @@ add_task(function* test_keyed_histogram_recording_enabled() {
"Keyed histogram add should not record when recording is disabled");
});
add_task(function* test_histogramSnapshots() {
let keyed = Telemetry.getKeyedHistogramById("TELEMETRY_TEST_KEYED_COUNT");
keyed.add("a", 1);
// Check that keyed histograms are not returned
Assert.ok(!("TELEMETRY_TEST_KEYED_COUNT#a" in Telemetry.histogramSnapshots));
});
add_task(function* test_datasets() {
// Check that datasets work as expected.

Просмотреть файл

@ -12,8 +12,7 @@ EXPORTS += [
'nsViewManager.h',
]
# nsViewManager.cpp cannot be built in unified mode because it uses PL_ARENA_CONST_ALIGN_MASK.
SOURCES += [
UNIFIED_SOURCES += [
'nsView.cpp',
'nsViewManager.cpp',
]

Просмотреть файл

@ -3,9 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define PL_ARENA_CONST_ALIGN_MASK (sizeof(void*)-1)
#include "plarena.h"
#include "nsAutoPtr.h"
#include "nsViewManager.h"
#include "nsGfxCIID.h"