Merge mozilla-central to autoland. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2019-03-16 12:25:06 +02:00
Родитель fe471b42c6 3f655a7340
Коммит db0b4a6acd
54 изменённых файлов: 177 добавлений и 141 удалений

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.2.67
Current extension version is: 2.2.71
Taken from upstream commit: d587abbc
Taken from upstream commit: 80135378

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
var pdfjsVersion = '2.2.67';
var pdfjsBuild = 'd587abbc';
var pdfjsVersion = '2.2.71';
var pdfjsBuild = '80135378';
var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -196,6 +196,7 @@ exports.createPromiseCapability = createPromiseCapability;
exports.getVerbosityLevel = getVerbosityLevel;
exports.info = info;
exports.isArrayBuffer = isArrayBuffer;
exports.isArrayEqual = isArrayEqual;
exports.isBool = isBool;
exports.isEmptyObj = isEmptyObj;
exports.isNum = isNum;
@ -974,6 +975,16 @@ function isArrayBuffer(v) {
return typeof v === 'object' && v !== null && v.byteLength !== undefined;
}
function isArrayEqual(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
return arr1.every(function (element, index) {
return element === arr2[index];
});
}
function isSpace(ch) {
return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
}
@ -1290,7 +1301,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId,
apiVersion: '2.2.67',
apiVersion: '2.2.71',
source: {
data: source.data,
url: source.url,
@ -1418,8 +1429,7 @@ class PDFDataRangeTransport {
exports.PDFDataRangeTransport = PDFDataRangeTransport;
class PDFDocumentProxy {
constructor(pdfInfo, transport, loadingTask) {
this.loadingTask = loadingTask;
constructor(pdfInfo, transport) {
this._pdfInfo = pdfInfo;
this._transport = transport;
}
@ -1504,6 +1514,10 @@ class PDFDocumentProxy {
return this._transport.loadingParams;
}
get loadingTask() {
return this._transport.loadingTask;
}
}
exports.PDFDocumentProxy = PDFDocumentProxy;
@ -2371,10 +2385,9 @@ class WorkerTransport {
messageHandler.on('GetDoc', function ({
pdfInfo
}) {
this.numPages = pdfInfo.numPages;
this.pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask);
this._numPages = pdfInfo.numPages;
loadingTask._capability.resolve(this.pdfDocument);
loadingTask._capability.resolve(new PDFDocumentProxy(pdfInfo, this));
}, this);
messageHandler.on('PasswordRequest', function (exception) {
this._passwordCapability = (0, _util.createPromiseCapability)();
@ -2671,7 +2684,7 @@ class WorkerTransport {
}
getPage(pageNumber) {
if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) {
if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this._numPages) {
return Promise.reject(new Error('Invalid page request'));
}
@ -3033,9 +3046,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask;
}();
const version = '2.2.67';
const version = '2.2.71';
exports.version = version;
const build = 'd587abbc';
const build = '80135378';
exports.build = build;
/***/ }),

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

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict";
const pdfjsVersion = '2.2.67';
const pdfjsBuild = 'd587abbc';
const pdfjsVersion = '2.2.71';
const pdfjsBuild = '80135378';
const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -378,7 +378,7 @@ var WorkerMessageHandler = {
var WorkerTasks = [];
const verbosity = (0, _util.getVerbosityLevel)();
let apiVersion = docParams.apiVersion;
let workerVersion = '2.2.67';
let workerVersion = '2.2.71';
if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -844,6 +844,7 @@ exports.createPromiseCapability = createPromiseCapability;
exports.getVerbosityLevel = getVerbosityLevel;
exports.info = info;
exports.isArrayBuffer = isArrayBuffer;
exports.isArrayEqual = isArrayEqual;
exports.isBool = isBool;
exports.isEmptyObj = isEmptyObj;
exports.isNum = isNum;
@ -1622,6 +1623,16 @@ function isArrayBuffer(v) {
return typeof v === 'object' && v !== null && v.byteLength !== undefined;
}
function isArrayEqual(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
return arr1.every(function (element, index) {
return element === arr2[index];
});
}
function isSpace(ch) {
return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A;
}
@ -20801,12 +20812,11 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
textContentItem.fontName = font.loadedName;
var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
if (font.isType3Font && textState.fontMatrix !== _util.FONT_IDENTITY_MATRIX && textState.fontSize === 1) {
var glyphHeight = font.bbox[3] - font.bbox[1];
if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
const glyphHeight = font.bbox[3] - font.bbox[1];
if (glyphHeight > 0) {
glyphHeight = glyphHeight * textState.fontMatrix[3];
tsm[3] *= glyphHeight;
tsm[3] *= glyphHeight * textState.fontMatrix[3];
}
}

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

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.2.67
release: version 2.2.71
# The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/

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

@ -223,7 +223,7 @@ nsresult OSFileConstantsService::InitOSFileConstants() {
// Get the umask from the system-info service.
// The property will always be present, but it will be zero on
// non-Unix systems.
// nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM2 so we don't need
// nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM so we don't need
// to initialize the service.
mUserUmask = nsSystemInfo::gUserUmask;

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

@ -1233,9 +1233,9 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp,
}
nsCOMPtr<nsIServiceManager> servMan;
rv = NS_InitXPCOM2(getter_AddRefs(servMan), appDir, &dirprovider);
rv = NS_InitXPCOM(getter_AddRefs(servMan), appDir, &dirprovider);
if (NS_FAILED(rv)) {
printf("NS_InitXPCOM2 failed!\n");
printf("NS_InitXPCOM failed!\n");
return 1;
}

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

@ -57,7 +57,7 @@ int main(int argc, char **argv) {
if (argc < 2) {
fprintf(stderr, "%s [FILE]...\n", argv[0]);
}
nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
nsresult rv = NS_InitXPCOM(nullptr, nullptr, nullptr);
if (NS_FAILED(rv)) return (int)rv;
int res = 0;

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

@ -84,7 +84,7 @@ bool TestKeywords() {
}
int main(void) {
nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
nsresult rv = NS_InitXPCOM(nullptr, nullptr, nullptr);
NS_ENSURE_SUCCESS(rv, 2);
bool testOK = true;

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

@ -1293,8 +1293,8 @@ nsresult ScopedXPCOMStartup::Initialize() {
nsresult rv;
rv = NS_InitXPCOM2(&mServiceManager, gDirServiceProvider->GetAppDir(),
gDirServiceProvider);
rv = NS_InitXPCOM(&mServiceManager, gDirServiceProvider->GetAppDir(),
gDirServiceProvider);
if (NS_FAILED(rv)) {
NS_ERROR("Couldn't start xpcom!");
mServiceManager = nullptr;

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

@ -190,7 +190,7 @@ nsresult XRE_InitEmbedding2(nsIFile* aLibXULDirectory, nsIFile* aAppDirectory,
aAppDirProvider);
if (NS_FAILED(rv)) return rv;
rv = NS_InitXPCOM2(nullptr, aAppDirectory, gDirServiceProvider);
rv = NS_InitXPCOM(nullptr, aAppDirectory, gDirServiceProvider);
if (NS_FAILED(rv)) return rv;
// We do not need to autoregister components here. The CheckCompatibility()

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

@ -67,9 +67,9 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2 {
mTestName = testName;
printf("Running %s tests...\n", mTestName);
nsresult rv = NS_InitXPCOM2(&mServMgr, nullptr, this);
nsresult rv = NS_InitXPCOM(&mServMgr, nullptr, this);
if (NS_FAILED(rv)) {
fail("NS_InitXPCOM2 returned failure code 0x%" PRIx32,
fail("NS_InitXPCOM returned failure code 0x%" PRIx32,
static_cast<uint32_t>(rv));
mServMgr = nullptr;
return;

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

@ -34,7 +34,7 @@ NS_IMPL_ISUPPORTS(LogModulePrefWatcher, nsIObserver)
* If logging after restart is desired, set the logging.config.clear_on_startup
* pref to false, or use the MOZ_LOG_FILE and MOZ_LOG_MODULES env vars.
*/
void ResetExistingPrefs() {
static void ResetExistingPrefs() {
uint32_t count;
char** names;
nsresult rv = Preferences::GetRootBranch()->GetChildList(kLoggingPrefPrefix,
@ -106,7 +106,7 @@ static void LoadPrefValue(const char* aName) {
LogModule::Get(moduleName)->SetLevel(logLevel);
}
void LoadExistingPrefs() {
static void LoadExistingPrefs() {
nsIPrefBranch* root = Preferences::GetRootBranch();
if (!root) {
return;

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

@ -80,7 +80,7 @@ LogLevel ToLogLevel(int32_t aLevel) {
return static_cast<LogLevel>(aLevel);
}
const char* ToLogStr(LogLevel aLevel) {
static const char* ToLogStr(LogLevel aLevel) {
switch (aLevel) {
case LogLevel::Error:
return "E";
@ -127,7 +127,8 @@ class LogFile {
LogFile* mNextToRelease;
};
const char* ExpandPIDMarker(const char* aFilename, char (&buffer)[2048]) {
static const char* ExpandPIDMarker(const char* aFilename,
char (&buffer)[2048]) {
MOZ_ASSERT(aFilename);
static const char kPIDToken[] = "%PID";
const char* pidTokenPtr = strstr(aFilename, kPIDToken);

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

@ -209,9 +209,9 @@ uint32_t gNurseryPurpleBufferEntryCount = 0;
void ClearNurseryPurpleBuffer();
void SuspectUsingNurseryPurpleBuffer(void* aPtr,
nsCycleCollectionParticipant* aCp,
nsCycleCollectingAutoRefCnt* aRefCnt) {
static void SuspectUsingNurseryPurpleBuffer(
void* aPtr, nsCycleCollectionParticipant* aCp,
nsCycleCollectingAutoRefCnt* aRefCnt) {
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");
MOZ_ASSERT(gNurseryPurpleBufferEnabled);
if (gNurseryPurpleBufferEntryCount == NURSERY_PURPLE_BUFFER_SIZE) {

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

@ -66,7 +66,7 @@
# include "mozilla/SandboxInfo.h"
#endif
// Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init.
// Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init.
// Only set to nonzero (potentially) if XP_UNIX. On such systems, the
// system call to discover the appropriate value is not thread-safe,
// so we must call it before going multithreaded, but nsSystemInfo::Init

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

@ -32,8 +32,8 @@ class nsSystemInfo final : public nsHashPropertyBag
nsresult Init();
// Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init.
// See comments above the variable definition and in NS_InitXPCOM2.
// Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init.
// See comments above the variable definition and in NS_InitXPCOM.
static uint32_t gUserUmask;
#ifdef MOZ_WIDGET_ANDROID

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

@ -203,11 +203,6 @@ NS_GetDebug(nsIDebug2** aResult) {
return nsDebugImpl::Create(nullptr, NS_GET_IID(nsIDebug2), (void**)aResult);
}
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory) {
return NS_InitXPCOM2(aResult, aBinDirectory, nullptr);
}
class ICUReporter final : public nsIMemoryReporter,
public CountingAllocatorBase<ICUReporter> {
public:
@ -273,8 +268,8 @@ static bool sInitializedJS = false;
// Note that on OSX, aBinDirectory will point to .app/Contents/Resources/browser
EXPORT_XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager** aResult, nsIFile* aBinDirectory,
nsIDirectoryServiceProvider* aAppFileLocationProvider) {
NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
nsIDirectoryServiceProvider* aAppFileLocationProvider) {
static bool sInitialized = false;
if (sInitialized) {
return NS_ERROR_FAILURE;

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

@ -73,8 +73,8 @@ struct Module;
* initialisation.
*/
XPCOM_API(nsresult)
NS_InitXPCOM2(nsIServiceManager** aResult, nsIFile* aBinDirectory,
nsIDirectoryServiceProvider* aAppFileLocationProvider);
NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
nsIDirectoryServiceProvider* aAppFileLocationProvider);
/**
* Initialize only minimal components of XPCOM. This ensures nsThreadManager,

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

@ -4,8 +4,8 @@
* 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 "nsICategoryManager.h"
#include "nsCategoryManager.h"
#include "nsCategoryManagerUtils.h"
#include "prio.h"
#include "prlock.h"

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

@ -418,13 +418,13 @@ extern mozilla::Module const* const __stop_kPStaticModules __asm(
# error Do not know how to find NSModules.
# endif
mozilla::Module const* const* begin(AllStaticModules& _) {
static mozilla::Module const* const* begin(AllStaticModules& _) {
return &__start_kPStaticModules;
}
#endif
mozilla::Module const* const* end(AllStaticModules& _) {
static mozilla::Module const* const* end(AllStaticModules& _) {
return &__stop_kPStaticModules;
}

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

@ -20,8 +20,8 @@ const int mozilla::Dafsa::kKeyNotFound = -1;
// Read next offset from pos.
// Returns true if an offset could be read, false otherwise.
bool GetNextOffset(const unsigned char** pos, const unsigned char* end,
const unsigned char** offset) {
static bool GetNextOffset(const unsigned char** pos, const unsigned char* end,
const unsigned char** offset) {
if (*pos == end) return false;
// When reading an offset the byte array must always contain at least
@ -52,31 +52,31 @@ bool GetNextOffset(const unsigned char** pos, const unsigned char* end,
}
// Check if byte at offset is last in label.
bool IsEOL(const unsigned char* offset, const unsigned char* end) {
static bool IsEOL(const unsigned char* offset, const unsigned char* end) {
MOZ_ASSERT(offset < end);
return (*offset & 0x80) != 0;
}
// Check if byte at offset matches first character in key.
// This version matches characters not last in label.
bool IsMatch(const unsigned char* offset, const unsigned char* end,
const char* key) {
static bool IsMatch(const unsigned char* offset, const unsigned char* end,
const char* key) {
MOZ_ASSERT(offset < end);
return *offset == *key;
}
// Check if byte at offset matches first character in key.
// This version matches characters last in label.
bool IsEndCharMatch(const unsigned char* offset, const unsigned char* end,
const char* key) {
static bool IsEndCharMatch(const unsigned char* offset,
const unsigned char* end, const char* key) {
MOZ_ASSERT(offset < end);
return *offset == (*key | 0x80);
}
// Read return value at offset.
// Returns true if a return value could be read, false otherwise.
bool GetReturnValue(const unsigned char* offset, const unsigned char* end,
int* return_value) {
static bool GetReturnValue(const unsigned char* offset,
const unsigned char* end, int* return_value) {
MOZ_ASSERT(offset < end);
if ((*offset & 0xE0) == 0x80) {
*return_value = *offset & 0x0F;
@ -88,8 +88,8 @@ bool GetReturnValue(const unsigned char* offset, const unsigned char* end,
// Lookup a domain key in a byte array generated by make_dafsa.py.
// The rule type is returned if key is found, otherwise kKeyNotFound is
// returned.
int LookupString(const unsigned char* graph, size_t length, const char* key,
size_t key_length) {
static int LookupString(const unsigned char* graph, size_t length,
const char* key, size_t key_length) {
const unsigned char* pos = graph;
const unsigned char* end = graph + length;
const unsigned char* offset = pos;

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

@ -192,7 +192,7 @@ void AddOriginMetadataToFile(const CFStringRef filePath, const CFURLRef sourceUR
}
// Can be called off of the main thread.
CFStringRef GetQuarantinePropKey() {
static CFStringRef GetQuarantinePropKey() {
if (nsCocoaFeatures::OnYosemiteOrLater()) {
return kCFURLQuarantinePropertiesKey;
}
@ -200,8 +200,8 @@ CFStringRef GetQuarantinePropKey() {
}
// Can be called off of the main thread.
CFMutableDictionaryRef CreateQuarantineDictionary(const CFURLRef aFileURL,
const bool aCreateProps) {
static CFMutableDictionaryRef CreateQuarantineDictionary(const CFURLRef aFileURL,
const bool aCreateProps) {
// The properties key changed in 10.10:
CFDictionaryRef quarantineProps = NULL;
if (aCreateProps) {

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

@ -40,7 +40,7 @@
/* This location is similar to NS_OS_CURRENT_PROCESS_DIR, however,
* NS_XPCOM_CURRENT_PROCESS_DIR can be overriden by passing a "bin
* directory" to NS_InitXPCOM2().
* directory" to NS_InitXPCOM().
*/
#define NS_XPCOM_CURRENT_PROCESS_DIR "XCurProcD"

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

@ -22,6 +22,7 @@
#include "nsIClassInfoImpl.h"
#include "nsAlgorithm.h"
#include "nsMemory.h"
#include "nsPipe.h"
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"

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

@ -24,6 +24,7 @@
#include "mozilla/ipc/InputStreamUtils.h"
#include "mozilla/ReentrantMonitor.h"
#include "nsIIPCSerializableInputStream.h"
#include "XPCOMModule.h"
using namespace mozilla::ipc;
using mozilla::Maybe;

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

@ -62,7 +62,7 @@ using namespace mozilla;
// - No duplicates in the first VALS_LEN results, which is useful for ensuring
// the tables get to a particular size, and also for guaranteeing lookups
// that fail.
uintptr_t MyRand() {
static uintptr_t MyRand() {
static uintptr_t s = 0;
s = s * 1103515245 + 12345;
return s;
@ -82,7 +82,8 @@ struct Params {
// benchmark against.
//
// Keep this in sync with all the other Bench_*() functions.
void Bench_Cpp_unordered_set(const Params* aParams, void** aVals, size_t aLen) {
static void Bench_Cpp_unordered_set(const Params* aParams, void** aVals,
size_t aLen) {
std::unordered_set<void*> hs;
for (size_t j = 0; j < aParams->mNumInserts; j++) {
@ -122,7 +123,8 @@ void Bench_Cpp_unordered_set(const Params* aParams, void** aVals, size_t aLen) {
}
// Keep this in sync with all the other Bench_*() functions.
void Bench_Cpp_PLDHashTable(const Params* aParams, void** aVals, size_t aLen) {
static void Bench_Cpp_PLDHashTable(const Params* aParams, void** aVals,
size_t aLen) {
PLDHashTable hs(PLDHashTable::StubOps(), sizeof(PLDHashEntryStub));
for (size_t j = 0; j < aParams->mNumInserts; j++) {
@ -163,7 +165,8 @@ void Bench_Cpp_PLDHashTable(const Params* aParams, void** aVals, size_t aLen) {
}
// Keep this in sync with all the other Bench_*() functions.
void Bench_Cpp_MozHashSet(const Params* aParams, void** aVals, size_t aLen) {
static void Bench_Cpp_MozHashSet(const Params* aParams, void** aVals,
size_t aLen) {
mozilla::HashSet<void*, mozilla::DefaultHasher<void*>, MallocAllocPolicy> hs;
for (size_t j = 0; j < aParams->mNumInserts; j++) {

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

@ -101,7 +101,7 @@ int main(int argc, char *argv[]) {
nsresult rv;
{
nsCOMPtr<nsIServiceManager> servMan;
rv = NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
rv = NS_InitXPCOM(getter_AddRefs(servMan), nullptr, nullptr);
if (NS_FAILED(rv)) return -1;
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
NS_ASSERTION(registrar, "Null nsIComponentRegistrar");

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

@ -82,9 +82,9 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2 {
mTestName = testName;
printf("Running %s tests...\n", mTestName);
nsresult rv = NS_InitXPCOM2(&mServMgr, nullptr, this);
nsresult rv = NS_InitXPCOM(&mServMgr, nullptr, this);
if (NS_FAILED(rv)) {
fail("NS_InitXPCOM2 returned failure code 0x%" PRIx32,
fail("NS_InitXPCOM returned failure code 0x%" PRIx32,
static_cast<uint32_t>(rv));
mServMgr = nullptr;
return;

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

@ -8,10 +8,9 @@
// Gee this seems simple! It's for testing for memory leaks with Purify.
void main(int argc, char* argv[]) {
nsresult rv;
nsIServiceManager* servMgr;
rv = NS_InitXPCOM2(&servMgr, nullptr, nullptr);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
nsresult rv = NS_InitXPCOM(&servMgr, nullptr, nullptr);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
// try loading a component and releasing it to see if it leaks
if (argc > 1 && argv[1] != nullptr) {
@ -34,5 +33,5 @@ void main(int argc, char* argv[]) {
}
rv = NS_ShutdownXPCOM(servMgr);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
}

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

@ -51,7 +51,7 @@ int main(int argc, char** argv) {
int count = 1;
if (argc > 1) count = atoi(argv[1]);
if (NS_FAILED(NS_InitXPCOM2(nullptr, nullptr, nullptr))) return -1;
if (NS_FAILED(NS_InitXPCOM(nullptr, nullptr, nullptr))) return -1;
while (count--) {
for (const Test* t = tests; t->name != nullptr; ++t) {

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

@ -111,7 +111,7 @@ TEST(Atoms, Invalid) {
#define SECOND_ATOM_STR "second static atom. @World!"
#define THIRD_ATOM_STR "third static atom?!"
bool isStaticAtom(nsAtom* atom) {
static bool isStaticAtom(nsAtom* atom) {
// Don't use logic && in order to ensure that all addrefs/releases are always
// run, even if one of the tests fail. This allows us to run this code on a
// non-static atom without affecting its refcount.

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

@ -84,7 +84,7 @@ nsresult IFoo::QueryInterface(const nsIID& aIID, void** aResult) {
return status;
}
nsresult CreateIFoo(void** result)
static nsresult CreateIFoo(void** result)
// a typical factory function (that calls AddRef)
{
auto* foop = new IFoo;
@ -95,14 +95,14 @@ nsresult CreateIFoo(void** result)
return NS_OK;
}
void set_a_IFoo(nsCOMPtr<IFoo>* result) {
static void set_a_IFoo(nsCOMPtr<IFoo>* result) {
// Various places in this file do a static_cast to nsISupports* in order to
// make the QI non-trivial, to avoid hitting a static assert.
nsCOMPtr<IFoo> foop(do_QueryInterface(static_cast<nsISupports*>(new IFoo)));
*result = foop;
}
nsCOMPtr<IFoo> return_a_IFoo() {
static nsCOMPtr<IFoo> return_a_IFoo() {
nsCOMPtr<IFoo> foop(do_QueryInterface(static_cast<nsISupports*>(new IFoo)));
return foop;
}
@ -161,7 +161,7 @@ nsresult IBar::QueryInterface(const nsID& aIID, void** aResult) {
return status;
}
nsresult CreateIBar(void** result)
static nsresult CreateIBar(void** result)
// a typical factory function (that calls AddRef)
{
auto* barp = new IBar;
@ -172,11 +172,11 @@ nsresult CreateIBar(void** result)
return NS_OK;
}
void AnIFooPtrPtrContext(IFoo**) {}
static void AnIFooPtrPtrContext(IFoo**) {}
void AVoidPtrPtrContext(void**) {}
static void AVoidPtrPtrContext(void**) {}
void AnISupportsPtrPtrContext(nsISupports**) {}
static void AnISupportsPtrPtrContext(nsISupports**) {}
} // namespace TestCOMPtr
@ -260,7 +260,7 @@ TEST(COMPtr, AddRefAndRelease) {
ASSERT_EQ(IBar::total_destructions_, 1);
}
void Comparison() {
TEST(COMPtr, Comparison) {
IFoo::total_constructions_ = 0;
IFoo::total_destructions_ = 0;
@ -295,7 +295,7 @@ void Comparison() {
ASSERT_EQ(IFoo::total_destructions_, 2);
}
void DontAddRef() {
TEST(COMPtr, DontAddRef) {
{
auto* raw_foo1p = new IFoo;
raw_foo1p->AddRef();

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

@ -14,7 +14,7 @@ namespace TestCRT {
// The return from strcmp etc is only defined to be postive, zero or
// negative. The magnitude of a non-zero return is irrelevant.
int sign(int val) {
static int sign(int val) {
if (val == 0) {
return 0;
} else {

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

@ -69,7 +69,7 @@ NS_IMPL_ISUPPORTS(nsTestService, nsITestService, nsISupportsWeakReference)
}
static NS_DEFINE_CID(kTestServiceCID, NS_TEST_SERVICE_CID);
void JustTestingCompilation() {
inline void JustTestingCompilation() {
/*
* NOTE: This does NOT demonstrate how these functions are
* intended to be used. They are intended for filling in out

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

@ -59,7 +59,7 @@ class TESTNAME(DeadlockDetectorTest) : public ::testing::Test {
unsigned int mOldSleepDuration;
};
void DisableCrashReporter() {
static void DisableCrashReporter() {
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
@ -71,7 +71,7 @@ void DisableCrashReporter() {
// Single-threaded sanity tests
// Stupidest possible deadlock.
int Sanity_Child() {
static int Sanity_Child() {
DisableCrashReporter();
MUTEX m1("dd.sanity.m1");
@ -92,7 +92,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(SanityDeathTest)) {
}
// Slightly less stupid deadlock.
int Sanity2_Child() {
static int Sanity2_Child() {
DisableCrashReporter();
MUTEX m1("dd.sanity2.m1");
@ -156,7 +156,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity3DeathTest))
}
#endif
int Sanity4_Child() {
static int Sanity4_Child() {
DisableCrashReporter();
mozilla::ReentrantMonitor m1("dd.sanity4.m1");
@ -179,7 +179,7 @@ TEST_F(TESTNAME(DeadlockDetectorTest), TESTNAME(Sanity4DeathTest)) {
ASSERT_DEATH_IF_SUPPORTED(Sanity4_Child(), regex);
}
int Sanity5_Child() {
static int Sanity5_Child() {
DisableCrashReporter();
mozilla::RecursiveMutex m1("dd.sanity4.m1");
@ -300,7 +300,7 @@ static void ContentionNoDeadlock_thread(void* arg) {
}
}
int ContentionNoDeadlock_Child() {
static int ContentionNoDeadlock_Child() {
const size_t kMutexCount = 4;
PRThread* threads[3];

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

@ -37,7 +37,7 @@ struct EntityNode {
uint32_t mUnicode;
};
EntityNode gEntities[] = {
static const EntityNode gEntities[] = {
{"nbsp", 160}, {"iexcl", 161}, {"cent", 162}, {"pound", 163},
{"curren", 164}, {"yen", 165}, {"brvbar", 166}, {"sect", 167},
{"uml", 168}, {"copy", 169}, {"ordf", 170}, {"laquo", 171},
@ -85,8 +85,8 @@ static uint32_t nsTIterPrintRemove(nsTHashtable<EntityToUnicodeEntry>& hash) {
return n;
}
void testTHashtable(nsTHashtable<EntityToUnicodeEntry>& hash,
uint32_t numEntries) {
static void testTHashtable(nsTHashtable<EntityToUnicodeEntry>& hash,
uint32_t numEntries) {
uint32_t i;
for (i = 0; i < numEntries; ++i) {
EntityToUnicodeEntry* entry = hash.PutEntry(gEntities[i].mStr);
@ -202,7 +202,7 @@ nsresult IFoo::GetString(nsACString& aString) {
return NS_OK;
}
nsresult CreateIFoo(IFoo** result)
static nsresult CreateIFoo(IFoo** result)
// a typical factory function (that calls AddRef)
{
auto* foop = new IFoo();

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

@ -22,7 +22,7 @@ namespace TestMoveString {
typedef mozilla::detail::StringDataFlags Df;
void SetAsOwned(nsACString& aStr, const char* aValue) {
static void SetAsOwned(nsACString& aStr, const char* aValue) {
size_t len = strlen(aValue);
char* data = new char[len + 1];
memcpy(data, aValue, len + 1);
@ -31,13 +31,13 @@ void SetAsOwned(nsACString& aStr, const char* aValue) {
EXPECT_STREQ(aStr.BeginReading(), aValue);
}
void ExpectTruncated(const nsACString& aStr) {
static void ExpectTruncated(const nsACString& aStr) {
EXPECT_EQ(aStr.Length(), uint32_t(0));
EXPECT_STREQ(aStr.BeginReading(), "");
EXPECT_EQ(aStr.GetDataFlags(), Df::TERMINATED);
}
void ExpectNew(const nsACString& aStr) {
static void ExpectNew(const nsACString& aStr) {
EXPECT_EQ(aStr.Length(), strlen(NEW_VAL));
EXPECT_TRUE(aStr.EqualsASCII(NEW_VAL));
}

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

@ -49,7 +49,7 @@ struct Convertable {
};
// Helper to create a StringStructMap key.
nsCString MakeStringKey(char aKey) {
static nsCString MakeStringKey(char aKey) {
nsCString key;
key.Append(aKey);
return key;

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

@ -103,7 +103,7 @@ TEST(MultiplexInputStream, Seek_SET) {
ASSERT_EQ(0, strncmp(readBuf, "The qu", count));
}
already_AddRefed<nsIInputStream> CreateStreamHelper() {
static already_AddRefed<nsIInputStream> CreateStreamHelper() {
nsCOMPtr<nsIMultiplexInputStream> multiplexStream =
do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1");

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

@ -59,9 +59,9 @@ class ReadSegmentsData {
char* mBuffer;
};
nsresult ReadSegmentsFunction(nsIInputStream* aInStr, void* aClosure,
const char* aBuffer, uint32_t aOffset,
uint32_t aCount, uint32_t* aCountWritten) {
static nsresult ReadSegmentsFunction(nsIInputStream* aInStr, void* aClosure,
const char* aBuffer, uint32_t aOffset,
uint32_t aCount, uint32_t* aCountWritten) {
ReadSegmentsData* data = static_cast<ReadSegmentsData*>(aClosure);
if (aInStr != data->mStream) return NS_ERROR_FAILURE;
memcpy(&data->mBuffer[aOffset], aBuffer, aCount);

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

@ -237,7 +237,7 @@ TEST(NsDeque, TestPushFront) {
<< "verify pushfront 3";
}
void CheckIfQueueEmpty(nsDeque& d) {
static void CheckIfQueueEmpty(nsDeque& d) {
EXPECT_EQ(0u, d.GetSize()) << "Size should be 0";
EXPECT_EQ(nullptr, d.Pop()) << "Invalid operation should return nullptr";
EXPECT_EQ(nullptr, d.PopFront()) << "Invalid operation should return nullptr";

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

@ -102,7 +102,7 @@ void Foo::VirtualMemberFunction(int aArg1, int* aArgPtr, int& aArgRef) {}
void Foo::VirtualConstMemberFunction(int aArg1, int* aArgPtr,
int& aArgRef) const {}
nsresult CreateFoo(void** result)
static nsresult CreateFoo(void** result)
// a typical factory function (that calls AddRef)
{
auto* foop = new Foo;
@ -113,14 +113,14 @@ nsresult CreateFoo(void** result)
return NS_OK;
}
void set_a_Foo(RefPtr<Foo>* result) {
static void set_a_Foo(RefPtr<Foo>* result) {
assert(result);
RefPtr<Foo> foop(do_QueryObject(new Foo));
*result = foop;
}
RefPtr<Foo> return_a_Foo() {
static RefPtr<Foo> return_a_Foo() {
RefPtr<Foo> foop(do_QueryObject(new Foo));
return foop;
}
@ -388,8 +388,8 @@ class ObjectForConstPtr {
#undef NS_INLINE_DECL_THREADSAFE_MUTABLE_REFCOUNTING
namespace TestNsRefPtr {
void AnFooPtrPtrContext(Foo**) {}
void AVoidPtrPtrContext(void**) {}
static void AnFooPtrPtrContext(Foo**) {}
static void AVoidPtrPtrContext(void**) {}
} // namespace TestNsRefPtr
TEST(nsRefPtr, RefPtrCompilationTests) {

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

@ -30,7 +30,7 @@ extern unsigned int _gdb_sleep_duration;
// up when running this test locally, which is surprising and annoying.
// - On ASAN builds, because ASAN alters the way a MOZ_CRASHing process
// terminates, which makes it harder to test if the right thing has occurred.
void TestCrashyOperation(void (*aCrashyOperation)()) {
static void TestCrashyOperation(void (*aCrashyOperation)()) {
#if defined(XP_UNIX) && defined(DEBUG) && !defined(MOZ_ASAN)
// We're about to trigger a crash. When it happens don't pause to allow GDB
// to be attached.
@ -87,19 +87,19 @@ void TestCrashyOperation(void (*aCrashyOperation)()) {
#endif
}
void InitCapacityOk_InitialLengthTooBig() {
static void InitCapacityOk_InitialLengthTooBig() {
PLDHashTable t(PLDHashTable::StubOps(), sizeof(PLDHashEntryStub),
PLDHashTable::kMaxInitialLength + 1);
}
void InitCapacityOk_InitialEntryStoreTooBig() {
static void InitCapacityOk_InitialEntryStoreTooBig() {
// Try the smallest disallowed power-of-two entry store size, which is 2^32
// bytes (which overflows to 0). (Note that the 2^23 *length* gets converted
// to a 2^24 *capacity*.)
PLDHashTable t(PLDHashTable::StubOps(), (uint32_t)1 << 8, (uint32_t)1 << 23);
}
void InitCapacityOk_EntrySizeTooBig() {
static void InitCapacityOk_EntrySizeTooBig() {
// Try the smallest disallowed entry size, which is 256 bytes.
PLDHashTable t(PLDHashTable::StubOps(), 256);
}

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

@ -95,7 +95,7 @@ class nsReceiver final : public nsIRunnable {
NS_IMPL_ISUPPORTS(nsReceiver, nsIRunnable)
nsresult TestPipe(nsIInputStream* in, nsIOutputStream* out) {
static nsresult TestPipe(nsIInputStream* in, nsIOutputStream* out) {
RefPtr<nsReceiver> receiver = new nsReceiver(in);
if (!receiver) return NS_ERROR_OUT_OF_MEMORY;
@ -209,7 +209,7 @@ class nsShortReader final : public nsIRunnable {
NS_IMPL_ISUPPORTS(nsShortReader, nsIRunnable)
nsresult TestShortWrites(nsIInputStream* in, nsIOutputStream* out) {
static nsresult TestShortWrites(nsIInputStream* in, nsIOutputStream* out) {
RefPtr<nsShortReader> receiver = new nsShortReader(in);
if (!receiver) return NS_ERROR_OUT_OF_MEMORY;
@ -351,7 +351,7 @@ TEST(Pipes, ChainedPipes) {
////////////////////////////////////////////////////////////////////////////////
void RunTests(uint32_t segSize, uint32_t segCount) {
static void RunTests(uint32_t segSize, uint32_t segCount) {
nsresult rv;
nsCOMPtr<nsIInputStream> in;
nsCOMPtr<nsIOutputStream> out;

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

@ -108,8 +108,9 @@ class NonSeekableStringStream final : public nsIAsyncInputStream {
NS_IMPL_ISUPPORTS(NonSeekableStringStream, nsIInputStream, nsIAsyncInputStream)
// Helper function for creating a seekable nsIInputStream + a SlicedInputStream.
SlicedInputStream* CreateSeekableStreams(uint32_t aSize, uint64_t aStart,
uint64_t aLength, nsCString& aBuffer) {
static SlicedInputStream* CreateSeekableStreams(uint32_t aSize, uint64_t aStart,
uint64_t aLength,
nsCString& aBuffer) {
aBuffer.SetLength(aSize);
for (uint32_t i = 0; i < aSize; ++i) {
aBuffer.BeginWriting()[i] = i % 10;
@ -122,9 +123,10 @@ SlicedInputStream* CreateSeekableStreams(uint32_t aSize, uint64_t aStart,
// Helper function for creating a non-seekable nsIInputStream + a
// SlicedInputStream.
SlicedInputStream* CreateNonSeekableStreams(uint32_t aSize, uint64_t aStart,
uint64_t aLength,
nsCString& aBuffer) {
static SlicedInputStream* CreateNonSeekableStreams(uint32_t aSize,
uint64_t aStart,
uint64_t aLength,
nsCString& aBuffer) {
aBuffer.SetLength(aSize);
for (uint32_t i = 0; i < aSize; ++i) {
aBuffer.BeginWriting()[i] = i % 10;

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

@ -468,7 +468,7 @@ class Strings : public ::testing::Test {
nsCString mViThousandUtf8;
};
void test_assign_helper(const nsACString& in, nsACString& _retval) {
static void test_assign_helper(const nsACString& in, nsACString& _retval) {
_retval = in;
}

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

@ -57,7 +57,7 @@ struct nsTArray_CopyChooser<TestTArray::Movable> {
namespace TestTArray {
const nsTArray<int>& DummyArray() {
static const nsTArray<int>& DummyArray() {
static nsTArray<int> sArray;
if (sArray.IsEmpty()) {
const int data[] = {4, 1, 2, 8};
@ -69,7 +69,7 @@ const nsTArray<int>& DummyArray() {
// This returns an invalid nsTArray with a huge length in order to test that
// fallible operations actually fail.
#ifdef DEBUG
const nsTArray<int>& FakeHugeArray() {
static const nsTArray<int>& FakeHugeArray() {
static nsTArray<int> sArray;
if (sArray.IsEmpty()) {
sArray.AppendElement();

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

@ -93,7 +93,7 @@ struct RunnableQueue : nsISerialEventTarget {
NS_IMPL_ISUPPORTS(RunnableQueue, nsIEventTarget, nsISerialEventTarget)
void Enqueue(nsIEventTarget* target, function<void()>&& aCallable) {
static void Enqueue(nsIEventTarget* target, function<void()>&& aCallable) {
nsresult rv =
target->Dispatch(NS_NewRunnableFunction("TEQ GTest", move(aCallable)));
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(rv));

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

@ -116,7 +116,7 @@ TEST(UTF, Hash16) {
* This tests the handling of a non-ascii character at various locations in a
* UTF-16 string that is being converted to UTF-8.
*/
void NonASCII16_helper(const size_t aStrSize) {
static void NonASCII16_helper(const size_t aStrSize) {
const size_t kTestSize = aStrSize;
const size_t kMaxASCII = 0x80;
const char16_t kUTF16Char = 0xC9;
@ -154,7 +154,7 @@ void NonASCII16_helper(const size_t aStrSize) {
// First add the leading ASCII chars.
expected.Append(asciiCString.BeginReading(), i);
// Now append the UTF-8 surrogate pair we expect the UTF-16 unicode char to
// Now append the UTF-8 pair we expect the UTF-16 unicode char to
// be converted to.
for (auto& c : kUTF8Surrogates) {
expected.Append(c);
@ -167,6 +167,15 @@ void NonASCII16_helper(const size_t aStrSize) {
}
}
TEST(UTF, NonASCII16) {
// Test with various string sizes to catch any special casing.
NonASCII16_helper(1);
NonASCII16_helper(8);
NonASCII16_helper(16);
NonASCII16_helper(32);
NonASCII16_helper(512);
}
TEST(UTF, UTF8CharEnumerator) {
const char* p =
"\x61\xC0\xC2\xC2\x80\xE0\x80\x80\xE0\xA0\x80\xE1\x80\x80\xED\xBF\xBF\xED"

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

@ -32,7 +32,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prevInstance, LPSTR lpszCmdLine,
{ // Needed to scope all nsCOMPtr within XPCOM Init and Shutdown
nsresult rv;
nsCOMPtr<nsIServiceManager> servMan;
rv = NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
rv = NS_InitXPCOM(getter_AddRefs(servMan), nullptr, nullptr);
if (NS_FAILED(rv)) {
ErrorBox("Failed to initialize xpcom.");
return -1;

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

@ -83,7 +83,7 @@ void BlockingResourceBase::GetStackTrace(AcquisitionState& aState) {
* contexts into strings, all info is written to stderr, but only
* some info is written into |aOut|
*/
bool PrintCycle(
static bool PrintCycle(
const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle,
nsACString& aOut) {
NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");

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

@ -38,17 +38,18 @@ static const uint64_t kMicrosecondsPerSecond = 1000000LL;
static const uint64_t kNanosecondsPerMicrosecond = 1000LL;
static const uint64_t kCPUCheckInterval = kMicrosecondsPerSecond / 2LL;
uint64_t GetMicroseconds(timeval time) {
static uint64_t GetMicroseconds(timeval time) {
return ((uint64_t)time.tv_sec) * kMicrosecondsPerSecond +
(uint64_t)time.tv_usec;
}
uint64_t GetMicroseconds(mach_timespec_t time) {
static uint64_t GetMicroseconds(mach_timespec_t time) {
return ((uint64_t)time.tv_sec) * kMicrosecondsPerSecond +
((uint64_t)time.tv_nsec) / kNanosecondsPerMicrosecond;
}
Result<CPUStats, CPUUsageWatcherError> GetProcessCPUStats(int32_t numCPUs) {
static Result<CPUStats, CPUUsageWatcherError> GetProcessCPUStats(
int32_t numCPUs) {
CPUStats result = {};
rusage usage;
int32_t rusageResult = getrusage(RUSAGE_SELF, &usage);
@ -77,7 +78,7 @@ Result<CPUStats, CPUUsageWatcherError> GetProcessCPUStats(int32_t numCPUs) {
return result;
}
Result<CPUStats, CPUUsageWatcherError> GetGlobalCPUStats() {
static Result<CPUStats, CPUUsageWatcherError> GetGlobalCPUStats() {
CPUStats result = {};
host_cpu_load_info_data_t loadInfo;
mach_msg_type_number_t loadInfoCount = HOST_CPU_LOAD_INFO_COUNT;

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

@ -4,6 +4,7 @@
* 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 "ThreadDelay.h"
#include "mozilla/Assertions.h"
#include "mozilla/ChaosMode.h"

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

@ -193,7 +193,7 @@ nsresult NS_NewTimerWithFuncCallback(nsITimer** aTimer,
//
static mozilla::LazyLogModule sTimerFiringsLog("TimerFirings");
mozilla::LogModule* GetTimerFiringsLog() { return sTimerFiringsLog; }
static mozilla::LogModule* GetTimerFiringsLog() { return sTimerFiringsLog; }
#include <math.h>