summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/autoconf/icu.m42
-rw-r--r--devtools/client/shared/curl.js12
-rw-r--r--dom/media/mediasource/ContainerParser.cpp57
-rw-r--r--dom/media/mp3/MP3Demuxer.cpp5
-rw-r--r--dom/media/webaudio/AudioBuffer.cpp4
-rw-r--r--dom/media/webm/WebMBufferedParser.cpp15
-rw-r--r--dom/media/webm/WebMBufferedParser.h17
-rw-r--r--js/src/jit/AliasAnalysisShared.cpp1
-rw-r--r--js/src/jit/MIR.h5
-rw-r--r--modules/libjar/nsZipArchive.cpp3
-rw-r--r--netwerk/sctp/datachannel/DataChannel.cpp7
-rwxr-xr-xnetwerk/sctp/src/netinet/sctp_input.c22
-rw-r--r--storage/TelemetryVFS.cpp879
-rw-r--r--storage/moz.build1
-rw-r--r--storage/mozStorageConnection.cpp10
-rw-r--r--storage/mozStorageService.cpp20
-rw-r--r--storage/mozStorageService.h3
-rw-r--r--storage/test/unit/test_telemetry_vfs.js30
-rw-r--r--storage/test/unit/xpcshell.ini1
-rw-r--r--toolkit/components/moz.build3
-rw-r--r--toolkit/components/telemetry/Histograms.json259
-rw-r--r--toolkit/components/telemetry/histogram-whitelists.json78
-rw-r--r--xpfe/appshell/nsXULWindow.cpp12
23 files changed, 96 insertions, 1350 deletions
diff --git a/build/autoconf/icu.m4 b/build/autoconf/icu.m4
index b5111598c..090d6c0a2 100644
--- a/build/autoconf/icu.m4
+++ b/build/autoconf/icu.m4
@@ -38,7 +38,7 @@ if test -n "$USE_ICU"; then
dnl We also don't do it on Windows because sometimes the file goes
dnl missing -- possibly due to overzealous antivirus software? --
dnl which prevents the browser from starting up :(
- if test -z "$JS_STANDALONE" -a "$OS_TARGET" != WINNT -a "$MOZ_WIDGET_TOOLKIT" != "android"; then
+ if test -z "$JS_STANDALONE"; then
MOZ_ICU_DATA_ARCHIVE=1
else
MOZ_ICU_DATA_ARCHIVE=
diff --git a/devtools/client/shared/curl.js b/devtools/client/shared/curl.js
index d9abf506a..5ce9e96bb 100644
--- a/devtools/client/shared/curl.js
+++ b/devtools/client/shared/curl.js
@@ -91,7 +91,7 @@ const Curl = {
if (utils.isUrlEncodedRequest(data) ||
["PUT", "POST", "PATCH"].includes(data.method)) {
postDataText = data.postDataText;
- addPostData("--data");
+ addPostData("--data-raw");
addPostData(utils.writePostDataTextParams(postDataText));
ignoredHeaders.add("content-length");
} else if (multipartRequest) {
@@ -400,7 +400,12 @@ const CurlUtils = {
* Credit: Google DevTools
*/
escapeStringWin: function (str) {
- /* Replace quote by double quote (but not by \") because it is
+ /*
+ Replace dollar sign because of commands (e.g $(cmd.exe)) in
+ powershell when using double quotes.
+ Useful details http://www.rlmueller.net/PowerShellEscape.htm
+
+ Replace quote by double quote (but not by \") because it is
recognized by both cmd.exe and MS Crt arguments parser.
Replace % by "%" because it could be expanded to an environment
@@ -414,7 +419,8 @@ const CurlUtils = {
Replace new line outside of quotes since cmd.exe doesn't let
to do it inside.
*/
- return "\"" + str.replace(/"/g, "\"\"")
+ return "\"" + str.replace(/\$/g, "`$")
+ .replace(/"/g, "\"\"")
.replace(/%/g, "\"%\"")
.replace(/\\/g, "\\\\")
.replace(/[\r\n]+/g, "\"^$&\"") + "\"";
diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp
index b4dcfde8a..9711d4fb6 100644
--- a/dom/media/mediasource/ContainerParser.cpp
+++ b/dom/media/mediasource/ContainerParser.cpp
@@ -127,58 +127,37 @@ public:
MediaResult IsInitSegmentPresent(MediaByteBuffer* aData) override
{
ContainerParser::IsInitSegmentPresent(aData);
- // XXX: This is overly primitive, needs to collect data as it's appended
- // to the SB and handle, rather than assuming everything is present in a
- // single aData segment.
- // 0x1a45dfa3 // EBML
- // ...
- // DocType == "webm"
- // ...
- // 0x18538067 // Segment (must be "unknown" size or contain a value large
- // enough to include the Segment Information and Tracks
- // elements that follow)
- // 0x1549a966 // -> Segment Info
- // 0x1654ae6b // -> One or more Tracks
-
- // 0x1a45dfa3 // EBML
if (aData->Length() < 4) {
return NS_ERROR_NOT_AVAILABLE;
}
- if ((*aData)[0] == 0x1a && (*aData)[1] == 0x45 && (*aData)[2] == 0xdf &&
- (*aData)[3] == 0xa3) {
- return NS_OK;
+ WebMBufferedParser parser(0);
+ nsTArray<WebMTimeDataOffset> mapping;
+ ReentrantMonitor dummy("dummy");
+ bool result = parser.Append(aData->Elements(), aData->Length(), mapping,
+ dummy);
+ if (!result) {
+ return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content"));
}
- return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content"));
+ return parser.mInitEndOffset > 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE;
}
MediaResult IsMediaSegmentPresent(MediaByteBuffer* aData) override
{
ContainerParser::IsMediaSegmentPresent(aData);
- // XXX: This is overly primitive, needs to collect data as it's appended
- // to the SB and handle, rather than assuming everything is present in a
- // single aData segment.
- // 0x1a45dfa3 // EBML
- // ...
- // DocType == "webm"
- // ...
- // 0x18538067 // Segment (must be "unknown" size)
- // 0x1549a966 // -> Segment Info
- // 0x1654ae6b // -> One or more Tracks
-
- // 0x1f43b675 // Cluster
if (aData->Length() < 4) {
return NS_ERROR_NOT_AVAILABLE;
}
- if ((*aData)[0] == 0x1f && (*aData)[1] == 0x43 && (*aData)[2] == 0xb6 &&
- (*aData)[3] == 0x75) {
- return NS_OK;
- }
- // 0x1c53bb6b // Cues
- if ((*aData)[0] == 0x1c && (*aData)[1] == 0x53 && (*aData)[2] == 0xbb &&
- (*aData)[3] == 0x6b) {
- return NS_OK;
+
+ WebMBufferedParser parser(0);
+ nsTArray<WebMTimeDataOffset> mapping;
+ ReentrantMonitor dummy("dummy");
+ parser.AppendMediaSegmentOnly();
+ bool result = parser.Append(aData->Elements(), aData->Length(), mapping,
+ dummy);
+ if (!result) {
+ return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content"));
}
- return MediaResult(NS_ERROR_FAILURE, RESULT_DETAIL("Invalid webm content"));
+ return parser.GetClusterOffset() >= 0 ? NS_OK : NS_ERROR_NOT_AVAILABLE;
}
MediaResult ParseStartAndEndTimestamps(MediaByteBuffer* aData,
diff --git a/dom/media/mp3/MP3Demuxer.cpp b/dom/media/mp3/MP3Demuxer.cpp
index 5a98cabfe..ccc515afb 100644
--- a/dom/media/mp3/MP3Demuxer.cpp
+++ b/dom/media/mp3/MP3Demuxer.cpp
@@ -396,7 +396,10 @@ MP3TrackDemuxer::Duration(int64_t aNumFrames) const {
MediaByteRange
MP3TrackDemuxer::FindFirstFrame() {
- static const int MIN_SUCCESSIVE_FRAMES = 4;
+ // This check is meant to avoid invalid frames from broken streams, but
+ // small MP3 files and streams with odd header data can break this. Lowering
+ // the value to 3 seems to help significantly.
+ static const int MIN_SUCCESSIVE_FRAMES = 3;
MediaByteRange candidateFrame = FindNextFrame();
int numSuccFrames = candidateFrame.Length() > 0;
diff --git a/dom/media/webaudio/AudioBuffer.cpp b/dom/media/webaudio/AudioBuffer.cpp
index e7eba2d48..39fe8c735 100644
--- a/dom/media/webaudio/AudioBuffer.cpp
+++ b/dom/media/webaudio/AudioBuffer.cpp
@@ -254,6 +254,7 @@ void
AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannelNumber,
uint32_t aStartInChannel, ErrorResult& aRv)
{
+ JS::AutoCheckCannotGC nogc;
aDestination.ComputeLengthAndData();
uint32_t length = aDestination.Length();
@@ -265,7 +266,6 @@ AudioBuffer::CopyFromChannel(const Float32Array& aDestination, uint32_t aChannel
return;
}
- JS::AutoCheckCannotGC nogc;
JSObject* channelArray = mJSChannels[aChannelNumber];
const float* sourceData = nullptr;
if (channelArray) {
@@ -296,6 +296,7 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
uint32_t aChannelNumber, uint32_t aStartInChannel,
ErrorResult& aRv)
{
+ JS::AutoCheckCannotGC nogc;
aSource.ComputeLengthAndData();
uint32_t length = aSource.Length();
@@ -312,7 +313,6 @@ AudioBuffer::CopyToChannel(JSContext* aJSContext, const Float32Array& aSource,
return;
}
- JS::AutoCheckCannotGC nogc;
JSObject* channelArray = mJSChannels[aChannelNumber];
if (JS_GetTypedArrayLength(channelArray) != mLength) {
// The array's buffer was detached.
diff --git a/dom/media/webm/WebMBufferedParser.cpp b/dom/media/webm/WebMBufferedParser.cpp
index 21154ab4b..979308cf0 100644
--- a/dom/media/webm/WebMBufferedParser.cpp
+++ b/dom/media/webm/WebMBufferedParser.cpp
@@ -113,6 +113,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength,
} else {
mClusterEndOffset = -1;
}
+ mGotClusterTimecode = false;
mState = READ_ELEMENT_ID;
break;
case BLOCKGROUP_ID:
@@ -121,6 +122,11 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength,
case SIMPLEBLOCK_ID:
/* FALLTHROUGH */
case BLOCK_ID:
+ if (!mGotClusterTimecode) {
+ WEBM_DEBUG("The Timecode element must appear before any Block or "
+ "SimpleBlock elements in a Cluster");
+ return false;
+ }
mBlockSize = mElement.mSize.mValue;
mBlockTimecode = 0;
mBlockTimecodeLength = BLOCK_TIMECODE_LENGTH;
@@ -164,6 +170,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength,
break;
case READ_TIMECODESCALE:
if (!mGotTimecodeScale) {
+ WEBM_DEBUG("Should get the SegmentInfo first");
return false;
}
mTimecodeScale = mVInt.mValue;
@@ -171,6 +178,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength,
break;
case READ_CLUSTER_TIMECODE:
mClusterTimecode = mVInt.mValue;
+ mGotClusterTimecode = true;
mState = READ_ELEMENT_ID;
break;
case READ_BLOCK_TIMECODE:
@@ -190,6 +198,7 @@ bool WebMBufferedParser::Append(const unsigned char* aBuffer, uint32_t aLength,
// Don't insert invalid negative timecodes.
if (mBlockTimecode >= 0 || mClusterTimecode >= uint16_t(abs(mBlockTimecode))) {
if (!mGotTimecodeScale) {
+ WEBM_DEBUG("Should get the TimecodeScale first");
return false;
}
uint64_t absTimecode = mClusterTimecode + mBlockTimecode;
@@ -266,6 +275,12 @@ WebMBufferedParser::EndSegmentOffset(int64_t aOffset)
return mBlockEndOffset;
}
+int64_t
+WebMBufferedParser::GetClusterOffset() const
+{
+ return mClusterOffset;
+}
+
// SyncOffsetComparator and TimeComparator are slightly confusing, in that
// the nsTArray they're used with (mTimeMapping) is sorted by mEndOffset and
// these comparators are used on the other fields of WebMTimeDataOffset.
diff --git a/dom/media/webm/WebMBufferedParser.h b/dom/media/webm/WebMBufferedParser.h
index bc3de4ba0..4245561fc 100644
--- a/dom/media/webm/WebMBufferedParser.h
+++ b/dom/media/webm/WebMBufferedParser.h
@@ -67,7 +67,7 @@ struct WebMBufferedParser
, mVIntLeft(0)
, mBlockSize(0)
, mClusterTimecode(0)
- , mClusterOffset(0)
+ , mClusterOffset(-1)
, mClusterEndOffset(-1)
, mBlockOffset(0)
, mBlockTimecode(0)
@@ -75,6 +75,7 @@ struct WebMBufferedParser
, mSkipBytes(0)
, mTimecodeScale(1000000)
, mGotTimecodeScale(false)
+ , mGotClusterTimecode(false)
{
if (mStartOffset != 0) {
mState = FIND_CLUSTER_SYNC;
@@ -86,6 +87,12 @@ struct WebMBufferedParser
return mTimecodeScale;
}
+ // Use this function when we would only feed media segment for the parser.
+ void AppendMediaSegmentOnly()
+ {
+ mGotTimecodeScale = true;
+ }
+
// If this parser is not expected to parse a segment info, it must be told
// the appropriate timecode scale to use from elsewhere.
void SetTimecodeScale(uint32_t aTimecodeScale) {
@@ -114,6 +121,9 @@ struct WebMBufferedParser
// This allows to determine the end of the interval containg aOffset.
int64_t EndSegmentOffset(int64_t aOffset);
+ // Return the Cluster offset, return -1 if we can't find the Cluster.
+ int64_t GetClusterOffset() const;
+
// The offset at which this parser started parsing. Used to merge
// adjacent parsers, in which case the later parser adopts the earlier
// parser's mStartOffset.
@@ -231,7 +241,7 @@ private:
// Start offset of the cluster currently being parsed. Used as the sync
// point offset for the offset-to-time mapping as each block timecode is
- // been parsed.
+ // been parsed. -1 if unknown.
int64_t mClusterOffset;
// End offset of the cluster currently being parsed. -1 if unknown.
@@ -260,6 +270,9 @@ private:
// True if we read the timecode scale from the segment info or have
// confirmed that the default value is to be used.
bool mGotTimecodeScale;
+
+ // True if we've read the cluster time code.
+ bool mGotClusterTimecode;
};
class WebMBufferedState final
diff --git a/js/src/jit/AliasAnalysisShared.cpp b/js/src/jit/AliasAnalysisShared.cpp
index 99c23d2a3..21a479bf8 100644
--- a/js/src/jit/AliasAnalysisShared.cpp
+++ b/js/src/jit/AliasAnalysisShared.cpp
@@ -134,6 +134,7 @@ GetObject(const MDefinition* ins)
case MDefinition::Op_SetArgumentsObjectArg:
case MDefinition::Op_GetFrameArgument:
case MDefinition::Op_SetFrameArgument:
+ case MDefinition::Op_CreateThis:
case MDefinition::Op_CompareExchangeTypedArrayElement:
case MDefinition::Op_AtomicExchangeTypedArrayElement:
case MDefinition::Op_AtomicTypedArrayElementBinop:
diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h
index 81662a9be..a7daea081 100644
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -5007,9 +5007,10 @@ class MCreateThis
TRIVIAL_NEW_WRAPPERS
NAMED_OPERANDS((0, getCallee), (1, getNewTarget))
- // Although creation of |this| modifies global state, it is safely repeatable.
+ // Performs a property read from |newTarget| if |newTarget| is a JSFunction
+ // with an own |.prototype| property.
AliasSet getAliasSet() const override {
- return AliasSet::None();
+ return AliasSet::Load(AliasSet::Any);
}
bool possiblyCalls() const override {
return true;
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index 841503ebf..2f12af5f0 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -217,16 +217,17 @@ nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret,
#else
handle->mNSPRFileDesc = fd.forget();
#endif
- handle->mMap = map;
handle->mFile.Init(file);
handle->mTotalLen = (uint32_t) size;
handle->mFileStart = buf;
rv = handle->findDataStart();
if (NS_FAILED(rv)) {
PR_MemUnmap(buf, (uint32_t) size);
+ handle->mFileStart = nullptr;
PR_CloseFileMap(map);
return rv;
}
+ handle->mMap = map;
handle.forget(ret);
return NS_OK;
}
diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp
index 19be43d1c..4797353ca 100644
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -354,6 +354,13 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUs
usrsctp_sysctl_set_sctp_blackhole(2);
// ECN is currently not supported by the Firefox code
usrsctp_sysctl_set_sctp_ecn_enable(0);
+
+ // Disabling authentication and dynamic address reconfiguration as neither
+ // of them are used for data channel and only result in additional code
+ // paths being used.
+ usrsctp_sysctl_set_sctp_asconf_enable(0);
+ usrsctp_sysctl_set_sctp_auth_enable(0);
+
sctp_initialized = true;
RefPtr<DataChannelShutdown> shutdown = new DataChannelShutdown();
diff --git a/netwerk/sctp/src/netinet/sctp_input.c b/netwerk/sctp/src/netinet/sctp_input.c
index 54f2f9ba3..1301b430c 100755
--- a/netwerk/sctp/src/netinet/sctp_input.c
+++ b/netwerk/sctp/src/netinet/sctp_input.c
@@ -2073,7 +2073,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
int init_offset, initack_offset, initack_limit;
int retval;
int error = 0;
- uint8_t auth_chunk_buf[SCTP_PARAM_BUFFER_SIZE];
+ uint8_t auth_chunk_buf[SCTP_CHUNK_BUFFER_SIZE];
#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
@@ -2264,8 +2264,12 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, int offset,
if (auth_skipped) {
struct sctp_auth_chunk *auth;
- auth = (struct sctp_auth_chunk *)
- sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf);
+ if (auth_len <= SCTP_CHUNK_BUFFER_SIZE) {
+ auth = (struct sctp_auth_chunk *)
+ sctp_m_getptr(m, auth_offset, auth_len, auth_chunk_buf);
+ } else {
+ auth = NULL;
+ }
if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, auth_offset)) {
/* auth HMAC failed, dump the assoc and packet */
SCTPDBG(SCTP_DEBUG_AUTH1,
@@ -4655,11 +4659,15 @@ sctp_process_control(struct mbuf *m, int iphlen, int *offset, int length,
if (auth_skipped && (stcb != NULL)) {
struct sctp_auth_chunk *auth;
- auth = (struct sctp_auth_chunk *)
- sctp_m_getptr(m, auth_offset,
+ if (auth_len <= SCTP_CHUNK_BUFFER_SIZE) {
+ auth = (struct sctp_auth_chunk *)
+ sctp_m_getptr(m, auth_offset,
auth_len, chunk_buf);
- got_auth = 1;
- auth_skipped = 0;
+ got_auth = 1;
+ auth_skipped = 0;
+ } else {
+ auth = NULL;
+ }
if ((auth == NULL) || sctp_handle_auth(stcb, auth, m,
auth_offset)) {
/* auth HMAC failed so dump it */
diff --git a/storage/TelemetryVFS.cpp b/storage/TelemetryVFS.cpp
deleted file mode 100644
index eb102a046..000000000
--- a/storage/TelemetryVFS.cpp
+++ /dev/null
@@ -1,879 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
- * 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 <string.h>
-#include "mozilla/Telemetry.h"
-#include "mozilla/Preferences.h"
-#include "sqlite3.h"
-#include "nsThreadUtils.h"
-#include "mozilla/dom/quota/PersistenceType.h"
-#include "mozilla/dom/quota/QuotaManager.h"
-#include "mozilla/dom/quota/QuotaObject.h"
-#include "mozilla/IOInterposer.h"
-
-// The last VFS version for which this file has been updated.
-#define LAST_KNOWN_VFS_VERSION 3
-
-// The last io_methods version for which this file has been updated.
-#define LAST_KNOWN_IOMETHODS_VERSION 3
-
-/**
- * This preference is a workaround to allow users/sysadmins to identify
- * that the profile exists on an NFS share whose implementation
- * is incompatible with SQLite's default locking implementation.
- * Bug 433129 attempted to automatically identify such file-systems,
- * but a reliable way was not found and it was determined that the fallback
- * locking is slower than POSIX locking, so we do not want to do it by default.
-*/
-#define PREF_NFS_FILESYSTEM "storage.nfs_filesystem"
-
-namespace {
-
-using namespace mozilla;
-using namespace mozilla::dom::quota;
-
-struct Histograms {
- const char *name;
- const Telemetry::ID readB;
- const Telemetry::ID writeB;
- const Telemetry::ID readMS;
- const Telemetry::ID writeMS;
- const Telemetry::ID syncMS;
-};
-
-#define SQLITE_TELEMETRY(FILENAME, HGRAM) \
- { FILENAME, \
- Telemetry::MOZ_SQLITE_ ## HGRAM ## _READ_B, \
- Telemetry::MOZ_SQLITE_ ## HGRAM ## _WRITE_B, \
- Telemetry::MOZ_SQLITE_ ## HGRAM ## _READ_MS, \
- Telemetry::MOZ_SQLITE_ ## HGRAM ## _WRITE_MS, \
- Telemetry::MOZ_SQLITE_ ## HGRAM ## _SYNC_MS \
- }
-
-Histograms gHistograms[] = {
- SQLITE_TELEMETRY("places.sqlite", PLACES),
- SQLITE_TELEMETRY("cookies.sqlite", COOKIES),
- SQLITE_TELEMETRY("webappsstore.sqlite", WEBAPPS),
- SQLITE_TELEMETRY(nullptr, OTHER)
-};
-#undef SQLITE_TELEMETRY
-
-/** RAII class for measuring how long io takes on/off main thread
- */
-class IOThreadAutoTimer {
-public:
- /**
- * IOThreadAutoTimer measures time spent in IO. Additionally it
- * automatically determines whether IO is happening on the main
- * thread and picks an appropriate histogram.
- *
- * @param id takes a telemetry histogram id. The id+1 must be an
- * equivalent histogram for the main thread. Eg, MOZ_SQLITE_OPEN_MS
- * is followed by MOZ_SQLITE_OPEN_MAIN_THREAD_MS.
- *
- * @param aOp optionally takes an IO operation to report through the
- * IOInterposer. Filename will be reported as NULL, and reference will be
- * either "sqlite-mainthread" or "sqlite-otherthread".
- */
- explicit IOThreadAutoTimer(Telemetry::ID aId,
- IOInterposeObserver::Operation aOp = IOInterposeObserver::OpNone)
- : start(TimeStamp::Now()),
- id(aId),
- op(aOp)
- {
- }
-
- /**
- * This constructor is for when we want to report an operation to
- * IOInterposer but do not require a telemetry probe.
- *
- * @param aOp IO Operation to report through the IOInterposer.
- */
- explicit IOThreadAutoTimer(IOInterposeObserver::Operation aOp)
- : start(TimeStamp::Now()),
- id(Telemetry::HistogramCount),
- op(aOp)
- {
- }
-
- ~IOThreadAutoTimer()
- {
- // We don't report SQLite I/O on Windows because we have a comprehensive
- // mechanism for intercepting I/O on that platform that captures a superset
- // of the data captured here.
- }
-
-private:
- const TimeStamp start;
- const Telemetry::ID id;
- IOInterposeObserver::Operation op;
-};
-
-struct telemetry_file {
- // Base class. Must be first
- sqlite3_file base;
-
- // histograms pertaining to this file
- Histograms *histograms;
-
- // quota object for this file
- RefPtr<QuotaObject> quotaObject;
-
- // The chunk size for this file. See the documentation for
- // sqlite3_file_control() and FCNTL_CHUNK_SIZE.
- int fileChunkSize;
-
- // This contains the vfs that actually does work
- sqlite3_file pReal[1];
-};
-
-const char*
-DatabasePathFromWALPath(const char *zWALName)
-{
- /**
- * Do some sketchy pointer arithmetic to find the parameter key. The WAL
- * filename is in the middle of a big allocated block that contains:
- *
- * - Random Values
- * - Main Database Path
- * - \0
- * - Multiple URI components consisting of:
- * - Key
- * - \0
- * - Value
- * - \0
- * - \0
- * - Journal Path
- * - \0
- * - WAL Path (zWALName)
- * - \0
- *
- * Because the main database path is preceded by a random value we have to be
- * careful when trying to figure out when we should terminate this loop.
- */
- MOZ_ASSERT(zWALName);
-
- nsDependentCSubstring dbPath(zWALName, strlen(zWALName));
-
- // Chop off the "-wal" suffix.
- NS_NAMED_LITERAL_CSTRING(kWALSuffix, "-wal");
- MOZ_ASSERT(StringEndsWith(dbPath, kWALSuffix));
-
- dbPath.Rebind(zWALName, dbPath.Length() - kWALSuffix.Length());
- MOZ_ASSERT(!dbPath.IsEmpty());
-
- // We want to scan to the end of the key/value URI pairs. Skip the preceding
- // null and go to the last char of the journal path.
- const char* cursor = zWALName - 2;
-
- // Make sure we just skipped a null.
- MOZ_ASSERT(!*(cursor + 1));
-
- // Walk backwards over the journal path.
- while (*cursor) {
- cursor--;
- }
-
- // There should be another null here.
- cursor--;
- MOZ_ASSERT(!*cursor);
-
- // Back up one more char to the last char of the previous string. It may be
- // the database path or it may be a key/value URI pair.
- cursor--;
-
-#ifdef DEBUG
- {
- // Verify that we just walked over the journal path. Account for the two
- // nulls we just skipped.
- const char *journalStart = cursor + 3;
-
- nsDependentCSubstring journalPath(journalStart,
- strlen(journalStart));
-
- // Chop off the "-journal" suffix.
- NS_NAMED_LITERAL_CSTRING(kJournalSuffix, "-journal");
- MOZ_ASSERT(StringEndsWith(journalPath, kJournalSuffix));
-
- journalPath.Rebind(journalStart,
- journalPath.Length() - kJournalSuffix.Length());
- MOZ_ASSERT(!journalPath.IsEmpty());
-
- // Make sure that the database name is a substring of the journal name.
- MOZ_ASSERT(journalPath == dbPath);
- }
-#endif
-
- // Now we're either at the end of the key/value URI pairs or we're at the
- // end of the database path. Carefully walk backwards one character at a
- // time to do this safely without running past the beginning of the database
- // path.
- const char *const dbPathStart = dbPath.BeginReading();
- const char *dbPathCursor = dbPath.EndReading() - 1;
- bool isDBPath = true;
-
- while (true) {
- MOZ_ASSERT(*dbPathCursor, "dbPathCursor should never see a null char!");
-
- if (isDBPath) {
- isDBPath = dbPathStart <= dbPathCursor &&
- *dbPathCursor == *cursor &&
- *cursor;
- }
-
- if (!isDBPath) {
- // This isn't the database path so it must be a value. Scan past it and
- // the key also.
- for (size_t stringCount = 0; stringCount < 2; stringCount++) {
- // Scan past the string to the preceding null character.
- while (*cursor) {
- cursor--;
- }
-
- // Back up one more char to the last char of preceding string.
- cursor--;
- }
-
- // Reset and start again.
- dbPathCursor = dbPath.EndReading() - 1;
- isDBPath = true;
-
- continue;
- }
-
- MOZ_ASSERT(isDBPath);
- MOZ_ASSERT(*cursor);
-
- if (dbPathStart == dbPathCursor) {
- // Found the full database path, we're all done.
- MOZ_ASSERT(nsDependentCString(cursor) == dbPath);
- return cursor;
- }
-
- // Change the cursors and go through the loop again.
- cursor--;
- dbPathCursor--;
- }
-
- MOZ_CRASH("Should never get here!");
-}
-
-already_AddRefed<QuotaObject>
-GetQuotaObjectFromNameAndParameters(const char *zName,
- const char *zURIParameterKey)
-{
- MOZ_ASSERT(zName);
- MOZ_ASSERT(zURIParameterKey);
-
- const char *persistenceType =
- sqlite3_uri_parameter(zURIParameterKey, "persistenceType");
- if (!persistenceType) {
- return nullptr;
- }
-
- const char *group = sqlite3_uri_parameter(zURIParameterKey, "group");
- if (!group) {
- NS_WARNING("SQLite URI had 'persistenceType' but not 'group'?!");
- return nullptr;
- }
-
- const char *origin = sqlite3_uri_parameter(zURIParameterKey, "origin");
- if (!origin) {
- NS_WARNING("SQLite URI had 'persistenceType' and 'group' but not "
- "'origin'?!");
- return nullptr;
- }
-
- QuotaManager *quotaManager = QuotaManager::Get();
- MOZ_ASSERT(quotaManager);
-
- return quotaManager->GetQuotaObject(
- PersistenceTypeFromText(nsDependentCString(persistenceType)),
- nsDependentCString(group),
- nsDependentCString(origin),
- NS_ConvertUTF8toUTF16(zName));
-}
-
-void
-MaybeEstablishQuotaControl(const char *zName,
- telemetry_file *pFile,
- int flags)
-{
- MOZ_ASSERT(pFile);
- MOZ_ASSERT(!pFile->quotaObject);
-
- if (!(flags & (SQLITE_OPEN_URI | SQLITE_OPEN_WAL))) {
- return;
- }
-
- MOZ_ASSERT(zName);
-
- const char *zURIParameterKey = (flags & SQLITE_OPEN_WAL) ?
- DatabasePathFromWALPath(zName) :
- zName;
-
- MOZ_ASSERT(zURIParameterKey);
-
- pFile->quotaObject =
- GetQuotaObjectFromNameAndParameters(zName, zURIParameterKey);
-}
-
-/*
-** Close a telemetry_file.
-*/
-int
-xClose(sqlite3_file *pFile)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- { // Scope for IOThreadAutoTimer
- IOThreadAutoTimer ioTimer(IOInterposeObserver::OpClose);
- rc = p->pReal->pMethods->xClose(p->pReal);
- }
- if( rc==SQLITE_OK ){
- delete p->base.pMethods;
- p->base.pMethods = nullptr;
- p->quotaObject = nullptr;
-#ifdef DEBUG
- p->fileChunkSize = 0;
-#endif
- }
- return rc;
-}
-
-/*
-** Read data from a telemetry_file.
-*/
-int
-xRead(sqlite3_file *pFile, void *zBuf, int iAmt, sqlite_int64 iOfst)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- IOThreadAutoTimer ioTimer(p->histograms->readMS, IOInterposeObserver::OpRead);
- int rc;
- rc = p->pReal->pMethods->xRead(p->pReal, zBuf, iAmt, iOfst);
- // sqlite likes to read from empty files, this is normal, ignore it.
- return rc;
-}
-
-/*
-** Return the current file-size of a telemetry_file.
-*/
-int
-xFileSize(sqlite3_file *pFile, sqlite_int64 *pSize)
-{
- IOThreadAutoTimer ioTimer(IOInterposeObserver::OpStat);
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xFileSize(p->pReal, pSize);
- return rc;
-}
-
-/*
-** Write data to a telemetry_file.
-*/
-int
-xWrite(sqlite3_file *pFile, const void *zBuf, int iAmt, sqlite_int64 iOfst)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- IOThreadAutoTimer ioTimer(p->histograms->writeMS, IOInterposeObserver::OpWrite);
- int rc;
- if (p->quotaObject) {
- MOZ_ASSERT(INT64_MAX - iOfst >= iAmt);
- if (!p->quotaObject->MaybeUpdateSize(iOfst + iAmt, /* aTruncate */ false)) {
- return SQLITE_FULL;
- }
- }
- rc = p->pReal->pMethods->xWrite(p->pReal, zBuf, iAmt, iOfst);
- if (p->quotaObject && rc != SQLITE_OK) {
- NS_WARNING("xWrite failed on a quota-controlled file, attempting to "
- "update its current size...");
- sqlite_int64 currentSize;
- if (xFileSize(pFile, &currentSize) == SQLITE_OK) {
- p->quotaObject->MaybeUpdateSize(currentSize, /* aTruncate */ true);
- }
- }
- return rc;
-}
-
-/*
-** Truncate a telemetry_file.
-*/
-int
-xTruncate(sqlite3_file *pFile, sqlite_int64 size)
-{
- IOThreadAutoTimer ioTimer(Telemetry::MOZ_SQLITE_TRUNCATE_MS);
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- if (p->quotaObject) {
- if (p->fileChunkSize > 0) {
- // Round up to the smallest multiple of the chunk size that will hold all
- // the data.
- size =
- ((size + p->fileChunkSize - 1) / p->fileChunkSize) * p->fileChunkSize;
- }
- if (!p->quotaObject->MaybeUpdateSize(size, /* aTruncate */ true)) {
- return SQLITE_FULL;
- }
- }
- rc = p->pReal->pMethods->xTruncate(p->pReal, size);
- if (p->quotaObject) {
- if (rc == SQLITE_OK) {
-#ifdef DEBUG
- // Make sure xTruncate set the size exactly as we calculated above.
- sqlite_int64 newSize;
- MOZ_ASSERT(xFileSize(pFile, &newSize) == SQLITE_OK);
- MOZ_ASSERT(newSize == size);
-#endif
- } else {
- NS_WARNING("xTruncate failed on a quota-controlled file, attempting to "
- "update its current size...");
- if (xFileSize(pFile, &size) == SQLITE_OK) {
- p->quotaObject->MaybeUpdateSize(size, /* aTruncate */ true);
- }
- }
- }
- return rc;
-}
-
-/*
-** Sync a telemetry_file.
-*/
-int
-xSync(sqlite3_file *pFile, int flags)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- IOThreadAutoTimer ioTimer(p->histograms->syncMS, IOInterposeObserver::OpFSync);
- return p->pReal->pMethods->xSync(p->pReal, flags);
-}
-
-/*
-** Lock a telemetry_file.
-*/
-int
-xLock(sqlite3_file *pFile, int eLock)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xLock(p->pReal, eLock);
- return rc;
-}
-
-/*
-** Unlock a telemetry_file.
-*/
-int
-xUnlock(sqlite3_file *pFile, int eLock)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xUnlock(p->pReal, eLock);
- return rc;
-}
-
-/*
-** Check if another file-handle holds a RESERVED lock on a telemetry_file.
-*/
-int
-xCheckReservedLock(sqlite3_file *pFile, int *pResOut)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc = p->pReal->pMethods->xCheckReservedLock(p->pReal, pResOut);
- return rc;
-}
-
-/*
-** File control method. For custom operations on a telemetry_file.
-*/
-int
-xFileControl(sqlite3_file *pFile, int op, void *pArg)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- // Hook SQLITE_FCNTL_SIZE_HINT for quota-controlled files and do the necessary
- // work before passing to the SQLite VFS.
- if (op == SQLITE_FCNTL_SIZE_HINT && p->quotaObject) {
- sqlite3_int64 hintSize = *static_cast<sqlite3_int64*>(pArg);
- sqlite3_int64 currentSize;
- rc = xFileSize(pFile, &currentSize);
- if (rc != SQLITE_OK) {
- return rc;
- }
- if (hintSize > currentSize) {
- rc = xTruncate(pFile, hintSize);
- if (rc != SQLITE_OK) {
- return rc;
- }
- }
- }
- rc = p->pReal->pMethods->xFileControl(p->pReal, op, pArg);
- // Grab the file chunk size after the SQLite VFS has approved.
- if (op == SQLITE_FCNTL_CHUNK_SIZE && rc == SQLITE_OK) {
- p->fileChunkSize = *static_cast<int*>(pArg);
- }
-#ifdef DEBUG
- if (op == SQLITE_FCNTL_SIZE_HINT && p->quotaObject && rc == SQLITE_OK) {
- sqlite3_int64 hintSize = *static_cast<sqlite3_int64*>(pArg);
- if (p->fileChunkSize > 0) {
- hintSize =
- ((hintSize + p->fileChunkSize - 1) / p->fileChunkSize) *
- p->fileChunkSize;
- }
- sqlite3_int64 currentSize;
- MOZ_ASSERT(xFileSize(pFile, &currentSize) == SQLITE_OK);
- MOZ_ASSERT(currentSize >= hintSize);
- }
-#endif
- return rc;
-}
-
-/*
-** Return the sector-size in bytes for a telemetry_file.
-*/
-int
-xSectorSize(sqlite3_file *pFile)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xSectorSize(p->pReal);
- return rc;
-}
-
-/*
-** Return the device characteristic flags supported by a telemetry_file.
-*/
-int
-xDeviceCharacteristics(sqlite3_file *pFile)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xDeviceCharacteristics(p->pReal);
- return rc;
-}
-
-/*
-** Shared-memory operations.
-*/
-int
-xShmLock(sqlite3_file *pFile, int ofst, int n, int flags)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- return p->pReal->pMethods->xShmLock(p->pReal, ofst, n, flags);
-}
-
-int
-xShmMap(sqlite3_file *pFile, int iRegion, int szRegion, int isWrite, void volatile **pp)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xShmMap(p->pReal, iRegion, szRegion, isWrite, pp);
- return rc;
-}
-
-void
-xShmBarrier(sqlite3_file *pFile){
- telemetry_file *p = (telemetry_file *)pFile;
- p->pReal->pMethods->xShmBarrier(p->pReal);
-}
-
-int
-xShmUnmap(sqlite3_file *pFile, int delFlag){
- telemetry_file *p = (telemetry_file *)pFile;
- int rc;
- rc = p->pReal->pMethods->xShmUnmap(p->pReal, delFlag);
- return rc;
-}
-
-int
-xFetch(sqlite3_file *pFile, sqlite3_int64 iOff, int iAmt, void **pp)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- MOZ_ASSERT(p->pReal->pMethods->iVersion >= 3);
- return p->pReal->pMethods->xFetch(p->pReal, iOff, iAmt, pp);
-}
-
-int
-xUnfetch(sqlite3_file *pFile, sqlite3_int64 iOff, void *pResOut)
-{
- telemetry_file *p = (telemetry_file *)pFile;
- MOZ_ASSERT(p->pReal->pMethods->iVersion >= 3);
- return p->pReal->pMethods->xUnfetch(p->pReal, iOff, pResOut);
-}
-
-int
-xOpen(sqlite3_vfs* vfs, const char *zName, sqlite3_file* pFile,
- int flags, int *pOutFlags)
-{
- IOThreadAutoTimer ioTimer(Telemetry::MOZ_SQLITE_OPEN_MS,
- IOInterposeObserver::OpCreateOrOpen);
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- int rc;
- telemetry_file *p = (telemetry_file *)pFile;
- Histograms *h = nullptr;
- // check if the filename is one we are probing for
- for(size_t i = 0;i < sizeof(gHistograms)/sizeof(gHistograms[0]);i++) {
- h = &gHistograms[i];
- // last probe is the fallback probe
- if (!h->name)
- break;
- if (!zName)
- continue;
- const char *match = strstr(zName, h->name);
- if (!match)
- continue;
- char c = match[strlen(h->name)];
- // include -wal/-journal too
- if (!c || c == '-')
- break;
- }
- p->histograms = h;
-
- MaybeEstablishQuotaControl(zName, p, flags);
-
- rc = orig_vfs->xOpen(orig_vfs, zName, p->pReal, flags, pOutFlags);
- if( rc != SQLITE_OK )
- return rc;
- if( p->pReal->pMethods ){
- sqlite3_io_methods *pNew = new sqlite3_io_methods;
- const sqlite3_io_methods *pSub = p->pReal->pMethods;
- memset(pNew, 0, sizeof(*pNew));
- // If the io_methods version is higher than the last known one, you should
- // update this VFS adding appropriate IO methods for any methods added in
- // the version change.
- pNew->iVersion = pSub->iVersion;
- MOZ_ASSERT(pNew->iVersion <= LAST_KNOWN_IOMETHODS_VERSION);
- pNew->xClose = xClose;
- pNew->xRead = xRead;
- pNew->xWrite = xWrite;
- pNew->xTruncate = xTruncate;
- pNew->xSync = xSync;
- pNew->xFileSize = xFileSize;
- pNew->xLock = xLock;
- pNew->xUnlock = xUnlock;
- pNew->xCheckReservedLock = xCheckReservedLock;
- pNew->xFileControl = xFileControl;
- pNew->xSectorSize = xSectorSize;
- pNew->xDeviceCharacteristics = xDeviceCharacteristics;
- if (pNew->iVersion >= 2) {
- // Methods added in version 2.
- pNew->xShmMap = pSub->xShmMap ? xShmMap : 0;
- pNew->xShmLock = pSub->xShmLock ? xShmLock : 0;
- pNew->xShmBarrier = pSub->xShmBarrier ? xShmBarrier : 0;
- pNew->xShmUnmap = pSub->xShmUnmap ? xShmUnmap : 0;
- }
- if (pNew->iVersion >= 3) {
- // Methods added in version 3.
- // SQLite 3.7.17 calls these methods without checking for nullptr first,
- // so we always define them. Verify that we're not going to call
- // nullptrs, though.
- MOZ_ASSERT(pSub->xFetch);
- pNew->xFetch = xFetch;
- MOZ_ASSERT(pSub->xUnfetch);
- pNew->xUnfetch = xUnfetch;
- }
- pFile->pMethods = pNew;
- }
- return rc;
-}
-
-int
-xDelete(sqlite3_vfs* vfs, const char *zName, int syncDir)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- int rc;
- RefPtr<QuotaObject> quotaObject;
-
- if (StringEndsWith(nsDependentCString(zName), NS_LITERAL_CSTRING("-wal"))) {
- const char *zURIParameterKey = DatabasePathFromWALPath(zName);
- MOZ_ASSERT(zURIParameterKey);
-
- quotaObject = GetQuotaObjectFromNameAndParameters(zName, zURIParameterKey);
- }
-
- rc = orig_vfs->xDelete(orig_vfs, zName, syncDir);
- if (rc == SQLITE_OK && quotaObject) {
- MOZ_ALWAYS_TRUE(quotaObject->MaybeUpdateSize(0, /* aTruncate */ true));
- }
-
- return rc;
-}
-
-int
-xAccess(sqlite3_vfs *vfs, const char *zName, int flags, int *pResOut)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xAccess(orig_vfs, zName, flags, pResOut);
-}
-
-int
-xFullPathname(sqlite3_vfs *vfs, const char *zName, int nOut, char *zOut)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xFullPathname(orig_vfs, zName, nOut, zOut);
-}
-
-void*
-xDlOpen(sqlite3_vfs *vfs, const char *zFilename)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xDlOpen(orig_vfs, zFilename);
-}
-
-void
-xDlError(sqlite3_vfs *vfs, int nByte, char *zErrMsg)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- orig_vfs->xDlError(orig_vfs, nByte, zErrMsg);
-}
-
-void
-(*xDlSym(sqlite3_vfs *vfs, void *pHdle, const char *zSym))(void){
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xDlSym(orig_vfs, pHdle, zSym);
-}
-
-void
-xDlClose(sqlite3_vfs *vfs, void *pHandle)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- orig_vfs->xDlClose(orig_vfs, pHandle);
-}
-
-int
-xRandomness(sqlite3_vfs *vfs, int nByte, char *zOut)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xRandomness(orig_vfs, nByte, zOut);
-}
-
-int
-xSleep(sqlite3_vfs *vfs, int microseconds)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xSleep(orig_vfs, microseconds);
-}
-
-int
-xCurrentTime(sqlite3_vfs *vfs, double *prNow)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xCurrentTime(orig_vfs, prNow);
-}
-
-int
-xGetLastError(sqlite3_vfs *vfs, int nBuf, char *zBuf)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xGetLastError(orig_vfs, nBuf, zBuf);
-}
-
-int
-xCurrentTimeInt64(sqlite3_vfs *vfs, sqlite3_int64 *piNow)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xCurrentTimeInt64(orig_vfs, piNow);
-}
-
-static
-int
-xSetSystemCall(sqlite3_vfs *vfs, const char *zName, sqlite3_syscall_ptr pFunc)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xSetSystemCall(orig_vfs, zName, pFunc);
-}
-
-static
-sqlite3_syscall_ptr
-xGetSystemCall(sqlite3_vfs *vfs, const char *zName)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xGetSystemCall(orig_vfs, zName);
-}
-
-static
-const char *
-xNextSystemCall(sqlite3_vfs *vfs, const char *zName)
-{
- sqlite3_vfs *orig_vfs = static_cast<sqlite3_vfs*>(vfs->pAppData);
- return orig_vfs->xNextSystemCall(orig_vfs, zName);
-}
-
-} // namespace
-
-namespace mozilla {
-namespace storage {
-
-sqlite3_vfs* ConstructTelemetryVFS()
-{
-#if defined(XP_WIN)
-#define EXPECTED_VFS "win32"
-#define EXPECTED_VFS_NFS "win32"
-#else
-#define EXPECTED_VFS "unix"
-#define EXPECTED_VFS_NFS "unix-excl"
-#endif
-
- bool expected_vfs;
- sqlite3_vfs *vfs;
- if (Preferences::GetBool(PREF_NFS_FILESYSTEM)) {
- vfs = sqlite3_vfs_find(EXPECTED_VFS_NFS);
- expected_vfs = (vfs != nullptr);
- }
- else {
- vfs = sqlite3_vfs_find(nullptr);
- expected_vfs = vfs->zName && !strcmp(vfs->zName, EXPECTED_VFS);
- }
- if (!expected_vfs) {
- return nullptr;
- }
-
- sqlite3_vfs *tvfs = new ::sqlite3_vfs;
- memset(tvfs, 0, sizeof(::sqlite3_vfs));
- // If the VFS version is higher than the last known one, you should update
- // this VFS adding appropriate methods for any methods added in the version
- // change.
- tvfs->iVersion = vfs->iVersion;
- MOZ_ASSERT(vfs->iVersion <= LAST_KNOWN_VFS_VERSION);
- tvfs->szOsFile = sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile;
- tvfs->mxPathname = vfs->mxPathname;
- tvfs->zName = "telemetry-vfs";
- tvfs->pAppData = vfs;
- tvfs->xOpen = xOpen;
- tvfs->xDelete = xDelete;
- tvfs->xAccess = xAccess;
- tvfs->xFullPathname = xFullPathname;
- tvfs->xDlOpen = xDlOpen;
- tvfs->xDlError = xDlError;
- tvfs->xDlSym = xDlSym;
- tvfs->xDlClose = xDlClose;
- tvfs->xRandomness = xRandomness;
- tvfs->xSleep = xSleep;
- tvfs->xCurrentTime = xCurrentTime;
- tvfs->xGetLastError = xGetLastError;
- if (tvfs->iVersion >= 2) {
- // Methods added in version 2.
- tvfs->xCurrentTimeInt64 = xCurrentTimeInt64;
- }
- if (tvfs->iVersion >= 3) {
- // Methods added in version 3.
- tvfs->xSetSystemCall = xSetSystemCall;
- tvfs->xGetSystemCall = xGetSystemCall;
- tvfs->xNextSystemCall = xNextSystemCall;
- }
- return tvfs;
-}
-
-already_AddRefed<QuotaObject>
-GetQuotaObjectForFile(sqlite3_file *pFile)
-{
- MOZ_ASSERT(pFile);
-
- telemetry_file *p = (telemetry_file *)pFile;
- RefPtr<QuotaObject> result = p->quotaObject;
- return result.forget();
-}
-
-} // namespace storage
-} // namespace mozilla
diff --git a/storage/moz.build b/storage/moz.build
index 2d30a85ec..f0e754bdc 100644
--- a/storage/moz.build
+++ b/storage/moz.build
@@ -71,7 +71,6 @@ UNIFIED_SOURCES += [
'mozStorageStatementRow.cpp',
'SQLCollations.cpp',
'StorageBaseStatementInternal.cpp',
- 'TelemetryVFS.cpp',
'VacuumManager.cpp',
]
diff --git a/storage/mozStorageConnection.cpp b/storage/mozStorageConnection.cpp
index e6c357185..40a71c28b 100644
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -1991,10 +1991,6 @@ Connection::EnableModule(const nsACString& aModuleName)
return NS_ERROR_FAILURE;
}
-// Implemented in TelemetryVFS.cpp
-already_AddRefed<QuotaObject>
-GetQuotaObjectForFile(sqlite3_file *pFile);
-
NS_IMETHODIMP
Connection::GetQuotaObjects(QuotaObject** aDatabaseQuotaObject,
QuotaObject** aJournalQuotaObject)
@@ -2015,8 +2011,6 @@ Connection::GetQuotaObjects(QuotaObject** aDatabaseQuotaObject,
return convertResultCode(srv);
}
- RefPtr<QuotaObject> databaseQuotaObject = GetQuotaObjectForFile(file);
-
srv = ::sqlite3_file_control(mDBConn,
nullptr,
SQLITE_FCNTL_JOURNAL_POINTER,
@@ -2025,10 +2019,6 @@ Connection::GetQuotaObjects(QuotaObject** aDatabaseQuotaObject,
return convertResultCode(srv);
}
- RefPtr<QuotaObject> journalQuotaObject = GetQuotaObjectForFile(file);
-
- databaseQuotaObject.forget(aDatabaseQuotaObject);
- journalQuotaObject.forget(aJournalQuotaObject);
return NS_OK;
}
diff --git a/storage/mozStorageService.cpp b/storage/mozStorageService.cpp
index 8c6f65232..56c10a4d0 100644
--- a/storage/mozStorageService.cpp
+++ b/storage/mozStorageService.cpp
@@ -253,7 +253,6 @@ int32_t Service::sDefaultPageSize = PREF_TS_PAGESIZE_DEFAULT;
Service::Service()
: mMutex("Service::mMutex")
-, mSqliteVFS(nullptr)
, mRegistrationMutex("Service::mRegistrationMutex")
, mConnections()
{
@@ -264,13 +263,9 @@ Service::~Service()
mozilla::UnregisterWeakMemoryReporter(this);
mozilla::UnregisterStorageSQLiteDistinguishedAmount();
- int rc = sqlite3_vfs_unregister(mSqliteVFS);
- if (rc != SQLITE_OK)
- NS_WARNING("Failed to unregister sqlite vfs wrapper.");
-
// Shutdown the sqlite3 API. Warn if shutdown did not turn out okay, but
// there is nothing actionable we can do in that case.
- rc = ::sqlite3_shutdown();
+ int rc = ::sqlite3_shutdown();
if (rc != SQLITE_OK)
NS_WARNING("sqlite3 did not shutdown cleanly.");
@@ -278,8 +273,6 @@ Service::~Service()
NS_ASSERTION(shutdownObserved, "Shutdown was not observed!");
gService = nullptr;
- delete mSqliteVFS;
- mSqliteVFS = nullptr;
}
void
@@ -372,8 +365,6 @@ Service::shutdown()
NS_IF_RELEASE(sXPConnect);
}
-sqlite3_vfs *ConstructTelemetryVFS();
-
#ifdef MOZ_STORAGE_MEMORY
namespace {
@@ -481,15 +472,6 @@ Service::initialize()
if (rc != SQLITE_OK)
return convertResultCode(rc);
- mSqliteVFS = ConstructTelemetryVFS();
- if (mSqliteVFS) {
- rc = sqlite3_vfs_register(mSqliteVFS, 1);
- if (rc != SQLITE_OK)
- return convertResultCode(rc);
- } else {
- NS_WARNING("Failed to register telemetry VFS");
- }
-
// Register for xpcom-shutdown so we can cleanup after ourselves. The
// observer service can only be used on the main thread.
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
diff --git a/storage/mozStorageService.h b/storage/mozStorageService.h
index effd330b1..d3c1d74d8 100644
--- a/storage/mozStorageService.h
+++ b/storage/mozStorageService.h
@@ -19,7 +19,6 @@
class nsIMemoryReporter;
class nsIXPConnect;
-struct sqlite3_vfs;
namespace mozilla {
namespace storage {
@@ -136,8 +135,6 @@ private:
* synchronizing access to mLocaleCollation.
*/
Mutex mMutex;
-
- sqlite3_vfs *mSqliteVFS;
/**
* Protects mConnections.
diff --git a/storage/test/unit/test_telemetry_vfs.js b/storage/test/unit/test_telemetry_vfs.js
deleted file mode 100644
index 0822fe3e7..000000000
--- a/storage/test/unit/test_telemetry_vfs.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Make sure that there are telemetry entries created by sqlite io
-
-function run_sql(d, sql) {
- var stmt = d.createStatement(sql);
- stmt.execute();
- stmt.finalize();
-}
-
-function new_file(name)
-{
- var file = dirSvc.get("ProfD", Ci.nsIFile);
- file.append(name);
- return file;
-}
-function run_test()
-{
- const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
- let read_hgram = Telemetry.getHistogramById("MOZ_SQLITE_OTHER_READ_B");
- let old_sum = read_hgram.snapshot().sum;
- const file = new_file("telemetry.sqlite");
- var d = getDatabase(file);
- run_sql(d, "CREATE TABLE bloat(data varchar)");
- run_sql(d, "DROP TABLE bloat");
- do_check_true(read_hgram.snapshot().sum > old_sum);
-}
-
diff --git a/storage/test/unit/xpcshell.ini b/storage/test/unit/xpcshell.ini
index e93c7d5b9..f9075a595 100644
--- a/storage/test/unit/xpcshell.ini
+++ b/storage/test/unit/xpcshell.ini
@@ -41,6 +41,5 @@ fail-if = os == "android"
[test_storage_value_array.js]
[test_unicode.js]
[test_vacuum.js]
-[test_telemetry_vfs.js]
# Bug 676981: test fails consistently on Android
# fail-if = os == "android"
diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
index 8c72e4b17..9e74395ac 100644
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -83,8 +83,7 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
DIRS += ['filepicker']
if CONFIG['MOZ_TOOLKIT_SEARCH'] and not CONFIG['MC_BASILISK'] \
- and not CONFIG['HYPE_ICEWEASEL'] \
- and not CONFIG['HYPE_ICEDOVE']:
+ and not CONFIG['HYPE_ICEWEASEL']:
DIRS += ['search']
if CONFIG['MOZ_URL_CLASSIFIER']:
diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json
index f61a67efc..2d90166a6 100644
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3704,265 +3704,6 @@
"n_values": 30,
"description": "Flash object instances count on page"
},
- "MOZ_SQLITE_OPEN_MS": {
- "expires_in_version": "default",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite open() (ms)"
- },
- "MOZ_SQLITE_OPEN_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite open() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_TRUNCATE_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite truncate() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_TRUNCATE_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite truncate() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_OTHER_READ_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_OTHER_READ_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_PLACES_READ_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_PLACES_READ_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on cookie DB open with readahead (ms)"
- },
- "MOZ_SQLITE_COOKIES_READ_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_COOKIES_READ_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_WEBAPPS_READ_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_WEBAPPS_READ_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite read() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_OTHER_WRITE_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_OTHER_WRITE_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_PLACES_WRITE_MS": {
- "expires_in_version": "default",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms)"
- },
- "MOZ_SQLITE_PLACES_WRITE_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_COOKIES_WRITE_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_COOKIES_WRITE_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_WEBAPPS_WRITE_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_WEBAPPS_WRITE_MAIN_THREAD_MS": {
- "expires_in_version": "40",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite write() (ms) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_OTHER_SYNC_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_OTHER_SYNC_MAIN_THREAD_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_PLACES_SYNC_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_PLACES_SYNC_MAIN_THREAD_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_COOKIES_SYNC_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_COOKIES_SYNC_MAIN_THREAD_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_WEBAPPS_SYNC_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_WEBAPPS_SYNC_MAIN_THREAD_MS": {
- "expires_in_version": "never",
- "kind": "exponential",
- "high": 3000,
- "n_buckets": 10,
- "description": "Time spent on SQLite fsync() (ms)"
- },
- "MOZ_SQLITE_OTHER_READ_B": {
- "expires_in_version": "default",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite read() (bytes)"
- },
- "MOZ_SQLITE_PLACES_READ_B": {
- "expires_in_version": "40",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite read() (bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_COOKIES_READ_B": {
- "expires_in_version": "40",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite read() (bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_WEBAPPS_READ_B": {
- "expires_in_version": "40",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite read() (bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_PLACES_WRITE_B": {
- "expires_in_version": "40",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite write (bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_COOKIES_WRITE_B": {
- "expires_in_version": "40",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite write (bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_WEBAPPS_WRITE_B": {
- "expires_in_version": "40",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite write (bytes) *** No longer needed (bug 1156565). Delete histogram and accumulation code! ***"
- },
- "MOZ_SQLITE_OTHER_WRITE_B": {
- "expires_in_version": "default",
- "kind": "linear",
- "high": 32768,
- "n_buckets": 3,
- "description": "SQLite write (bytes)"
- },
"MOZ_STORAGE_ASYNC_REQUESTS_MS": {
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
"expires_in_version": "40",
diff --git a/toolkit/components/telemetry/histogram-whitelists.json b/toolkit/components/telemetry/histogram-whitelists.json
index 529d9f4d5..5cd7c3145 100644
--- a/toolkit/components/telemetry/histogram-whitelists.json
+++ b/toolkit/components/telemetry/histogram-whitelists.json
@@ -392,43 +392,6 @@
"MEDIA_WMF_DECODE_ERROR",
"MIXED_CONTENT_PAGE_LOAD",
"MIXED_CONTENT_UNBLOCK_COUNTER",
- "MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS",
- "MOZ_SQLITE_COOKIES_READ_B",
- "MOZ_SQLITE_COOKIES_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_COOKIES_READ_MS",
- "MOZ_SQLITE_COOKIES_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_COOKIES_SYNC_MS",
- "MOZ_SQLITE_COOKIES_WRITE_B",
- "MOZ_SQLITE_COOKIES_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_COOKIES_WRITE_MS",
- "MOZ_SQLITE_OPEN_MAIN_THREAD_MS",
- "MOZ_SQLITE_OPEN_MS",
- "MOZ_SQLITE_OTHER_READ_B",
- "MOZ_SQLITE_OTHER_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_OTHER_READ_MS",
- "MOZ_SQLITE_OTHER_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_OTHER_SYNC_MS",
- "MOZ_SQLITE_OTHER_WRITE_B",
- "MOZ_SQLITE_OTHER_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_OTHER_WRITE_MS",
- "MOZ_SQLITE_PLACES_READ_B",
- "MOZ_SQLITE_PLACES_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_PLACES_READ_MS",
- "MOZ_SQLITE_PLACES_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_PLACES_SYNC_MS",
- "MOZ_SQLITE_PLACES_WRITE_B",
- "MOZ_SQLITE_PLACES_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_PLACES_WRITE_MS",
- "MOZ_SQLITE_TRUNCATE_MAIN_THREAD_MS",
- "MOZ_SQLITE_TRUNCATE_MS",
- "MOZ_SQLITE_WEBAPPS_READ_B",
- "MOZ_SQLITE_WEBAPPS_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_WEBAPPS_READ_MS",
- "MOZ_SQLITE_WEBAPPS_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_WEBAPPS_SYNC_MS",
- "MOZ_SQLITE_WEBAPPS_WRITE_B",
- "MOZ_SQLITE_WEBAPPS_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_WEBAPPS_WRITE_MS",
"NETWORK_CACHE_METADATA_FIRST_READ_SIZE",
"NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS",
"NETWORK_CACHE_METADATA_SECOND_READ_TIME_MS",
@@ -1232,43 +1195,6 @@
"MIXED_CONTENT_HSTS",
"MIXED_CONTENT_PAGE_LOAD",
"MIXED_CONTENT_UNBLOCK_COUNTER",
- "MOZ_SQLITE_COOKIES_OPEN_READAHEAD_MS",
- "MOZ_SQLITE_COOKIES_READ_B",
- "MOZ_SQLITE_COOKIES_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_COOKIES_READ_MS",
- "MOZ_SQLITE_COOKIES_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_COOKIES_SYNC_MS",
- "MOZ_SQLITE_COOKIES_WRITE_B",
- "MOZ_SQLITE_COOKIES_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_COOKIES_WRITE_MS",
- "MOZ_SQLITE_OPEN_MAIN_THREAD_MS",
- "MOZ_SQLITE_OPEN_MS",
- "MOZ_SQLITE_OTHER_READ_B",
- "MOZ_SQLITE_OTHER_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_OTHER_READ_MS",
- "MOZ_SQLITE_OTHER_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_OTHER_SYNC_MS",
- "MOZ_SQLITE_OTHER_WRITE_B",
- "MOZ_SQLITE_OTHER_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_OTHER_WRITE_MS",
- "MOZ_SQLITE_PLACES_READ_B",
- "MOZ_SQLITE_PLACES_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_PLACES_READ_MS",
- "MOZ_SQLITE_PLACES_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_PLACES_SYNC_MS",
- "MOZ_SQLITE_PLACES_WRITE_B",
- "MOZ_SQLITE_PLACES_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_PLACES_WRITE_MS",
- "MOZ_SQLITE_TRUNCATE_MAIN_THREAD_MS",
- "MOZ_SQLITE_TRUNCATE_MS",
- "MOZ_SQLITE_WEBAPPS_READ_B",
- "MOZ_SQLITE_WEBAPPS_READ_MAIN_THREAD_MS",
- "MOZ_SQLITE_WEBAPPS_READ_MS",
- "MOZ_SQLITE_WEBAPPS_SYNC_MAIN_THREAD_MS",
- "MOZ_SQLITE_WEBAPPS_SYNC_MS",
- "MOZ_SQLITE_WEBAPPS_WRITE_B",
- "MOZ_SQLITE_WEBAPPS_WRITE_MAIN_THREAD_MS",
- "MOZ_SQLITE_WEBAPPS_WRITE_MS",
"MOZ_STORAGE_ASYNC_REQUESTS_MS",
"MOZ_STORAGE_ASYNC_REQUESTS_SUCCESS",
"NETWORK_CACHE_METADATA_FIRST_READ_SIZE",
@@ -1885,7 +1811,6 @@
"WEAVE_CONFIGURED",
"NEWTAB_PAGE_ENABLED",
"GRADIENT_DURATION",
- "MOZ_SQLITE_OPEN_MS",
"SHOULD_TRANSLATION_UI_APPEAR",
"NEWTAB_PAGE_LIFE_SPAN",
"FX_TOTAL_TOP_VISITS",
@@ -1902,7 +1827,6 @@
"FX_NEW_WINDOW_MS",
"PDF_VIEWER_TIME_TO_VIEW_MS",
"SSL_OCSP_MAY_FETCH",
- "MOZ_SQLITE_OTHER_READ_B",
"CHECK_JAVA_ENABLED",
"TRANSLATION_OPPORTUNITIES",
"FX_SESSION_RESTORE_CONTENT_COLLECT_DATA_LONGEST_OP_MS",
@@ -1928,11 +1852,9 @@
"FX_SESSION_RESTORE_DOM_STORAGE_SIZE_ESTIMATE_CHARS",
"DATA_STORAGE_ENTRIES",
"TRANSLATED_PAGES_BY_LANGUAGE",
- "MOZ_SQLITE_OTHER_WRITE_B",
"LOCALDOMSTORAGE_SHUTDOWN_DATABASE_MS",
"SSL_CERT_VERIFICATION_ERRORS",
"FX_SESSION_RESTORE_NUMBER_OF_WINDOWS_RESTORED",
- "MOZ_SQLITE_PLACES_WRITE_MS",
"FX_THUMBNAILS_BG_CAPTURE_CANVAS_DRAW_TIME_MS",
"FX_SESSION_RESTORE_STARTUP_INIT_SESSION_MS",
"FX_SESSION_RESTORE_WRITE_FILE_MS",
diff --git a/xpfe/appshell/nsXULWindow.cpp b/xpfe/appshell/nsXULWindow.cpp
index 8f2d9fde5..585085065 100644
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -455,6 +455,8 @@ NS_IMETHODIMP nsXULWindow::Destroy()
if (mDestroying)
return NS_OK;
+ nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
+
mozilla::AutoRestore<bool> guard(mDestroying);
mDestroying = true;
@@ -467,16 +469,6 @@ NS_IMETHODIMP nsXULWindow::Destroy()
if (parentWindow)
parentWindow->RemoveChildWindow(this);
- // let's make sure the window doesn't get deleted out from under us
- // while we are trying to close....this can happen if the docshell
- // we close ends up being the last owning reference to this xulwindow
-
- // XXXTAB This shouldn't be an issue anymore because the ownership model
- // only goes in one direction. When webshell container is fully removed
- // try removing this...
-
- nsCOMPtr<nsIXULWindow> placeHolder = this;
-
// Remove modality (if any) and hide while destroying. More than
// a convenience, the hide prevents user interaction with the partially
// destroyed window. This is especially necessary when the eldest window