mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 22:38:35 +00:00
5a6524c1db
- partly import Bug 1201597 - Part 0: Make saveHeapSnapshot return the file path rather than take it as a parameter; r=bholley (85652707) - partly import Bug 1201597 - Part 2: Add an IPDL subprotocol for opening core dump files to (f9c9b2b7) - Bug 1184426 - Unprefix RTCIceCandidatePairStats.priority (formerly mozPriority). r=bwc, r=smaug (3381192783) - Bug 1211793 - Remove unnecessary creation of "MediaDecoder" log module. r=gerald. (ed090bfe9c) - Bug 1215532. Make sure the exposure set of the generated iterator interface matches that of the iterable it's created for, and that IterableIterator is exposed everywhere. r=qdot (d580e5a3dc) - Bug 1215755. Change the Web IDL parser to just put a next() method initerator interfaces instead of using an additional IterableIterator interface. Fix up the other test failures in test_interface_maplikesetlikeiterable.py while I'm here. r=qdot (568f46851e) - Bug 961329 - Implement JS::ubi::DominatorTree; r=sfink (b0cee6e886) - Bug 1194991 - Part a: rewrite test_const.py to simplify adding new tests; r=khuey (510c69e81e) - Bug 1194991 - Part b: coerce WebIDL constants to the correct type; r=khuey (8076a19ff9) - Bug 1186142 - Make selector arg optional on PeerConnection.getStats(). r=bz (58041a2533) - Bug 1215519 - Switch to DOMTimeStamp for RTCCertificate. r=bz (0bfba3a6ac) - Bug 1152538 - RTCIdentityAssertion is a dictionary, r=smaug (b0c525ab44) - Bug 1214867 - Add HeapSnapshot.prototype.creationTime; r=bholley (d533dfb5be) - Bug 1225588 - Expose DominatorTree to JavaScript; r=sfink,bz (bed975d820) - Bug 1223512 - Validate that every edge referent is in the heap snapshot; r=shu (170fdfac5e) - Bug 1218597 - Limit the number of stack frames serialized in core dumps; r=froydnj (3d69d6515f) - Bug 1153294 - Exposing Document.documentLoadGroup to Chrome JS, r=sicking (4b1f6fcfc3) - Bug 1221292 - move nondeterministicGetWeakMapKeys to ThreadSafeChromeUtils; r=bz (7c528633b5) - Bug 1223954 - don't use implicitJSContext for readHeapSnapshot and saveHeapSnapshot; r=bz (22f6ebf124) - Bug 1204155 - Account for OOM in CryptoKey::SetSymKey() r=mt (d8e5713ad1) - Bug 1204155 - Check if we're OOM when calling SECKEY_CopyPrivateKey() and SECKEY_CopyPublicKey() r=mt (8f1a9143ce) - Bug 1001691 - Make GenerateAsymmetricKeyTask::mKeyPair a UniquePtr so that we can explicitly release it on the main thread r=mt (40fa47ffae) - Bug 1213937 - Make WebRTC certificates SHA-256 only, r=drno (c1e3d2fd23) - Bug 1158886 - Correct public key argument names for CryptoKey::PublicKeyToSpki() and ::PublicKeyToJwk() r=rbarnes (f70b95a51d) - Bug 901698 - Implement OCSP-must-staple; r=keeler (4abe7c7616) - Bug 1213203 - AsymmetricSignVerifyTask::DoCrypto() creates unused SGN Context r=mt (afef1029de) - Bug 1188750 - CryptoKey::ReadStructuredClone() needs to ensure NSS is initialized before trying to deserialize a key r=keeler (12c4d54ece) - Bug 1001691 - Implement WebCrypto thread pool r=bz (60cfa74a56) - Bug 1001691 - Use thread pool for WebCrypto operations r=bz (dd61402a0c) - Bug 1207090 - Expose TCPSocket to chrome contexts. r=bz (e17fd13133) - Bug 1210330 - TCPSocket data event should be an ArrayBuffer in non-e10s case too. r=jdm (6bf1210377) - Bug 1219476 (part 1) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (da793ddf99) - Bug 1219476 (part 2) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (d87f0ea067) - Bug 1219476 (part 3) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (5715cffabf) - Bug 1219476 (part 4) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (7f203f36de) - Bug 1219476 (part 5) - Replace PRLogModuleInfo usage with LazyLogModule in gfx/. r=erahm. (65d1438d2e) - Bug 1211360 - Don't snap for non-translation 3D transform. r=roc (e11c2b9104) - Bug 1198996 - Ensure layer local opacity is clamped to 0..1 range. r=Bas (9b90e4348a) - Bug 1222661 - Replace ToUnknown(obj) and FromUnknown(obj) with obj.ToUnknown*() and FromUnknown*(obj). r=nical (6da1eeedab)
96 lines
3.3 KiB
JavaScript
96 lines
3.3 KiB
JavaScript
/* 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/. */
|
|
|
|
// Heap snapshots are always saved in the temp directory, and have a regular
|
|
// naming convention. This module provides helpers for working with heap
|
|
// snapshot files in a safe manner. Because we attempt to avoid unnecessary
|
|
// copies of the heap snapshot files by checking the local filesystem for a heap
|
|
// snapshot file with the given snapshot id, we want to ensure that we are only
|
|
// attempting to open heap snapshot files and not `~/.ssh/id_rsa`, for
|
|
// example. Therefore, the RDP only talks about snapshot ids, or transfering the
|
|
// bulk file data. A file path can be recovered from a snapshot id, which allows
|
|
// one to check for the presence of the heap snapshot file on the local file
|
|
// system, but we don't have to worry about opening arbitrary files.
|
|
//
|
|
// The heap snapshot file path conventions permits the following forms:
|
|
//
|
|
// $TEMP_DIRECTORY/XXXXXXXXXX.fxsnapshot
|
|
// $TEMP_DIRECTORY/XXXXXXXXXX-XXXXX.fxsnapshot
|
|
//
|
|
// Where the strings of "X" are zero or more digits.
|
|
|
|
"use strict";
|
|
|
|
const { Ci } = require("chrome");
|
|
loader.lazyRequireGetter(this, "FileUtils",
|
|
"resource://gre/modules/FileUtils.jsm", true);
|
|
loader.lazyRequireGetter(this, "OS", "resource://gre/modules/osfile.jsm", true);
|
|
|
|
function getHeapSnapshotFileTemplate() {
|
|
return OS.Path.join(OS.Constants.Path.tmpDir, `${Date.now()}.fxsnapshot`);
|
|
}
|
|
|
|
/**
|
|
* Get a unique temp file path for a new heap snapshot. The file is guaranteed
|
|
* not to exist before this call.
|
|
*
|
|
* @returns String
|
|
*/
|
|
exports.getNewUniqueHeapSnapshotTempFilePath = function () {
|
|
let file = new FileUtils.File(getHeapSnapshotFileTemplate());
|
|
// The call to createUnique will append "-N" after the leaf name (but before
|
|
// the extension) until a new file is found and create it. This guarantees we
|
|
// won't accidentally choose the same file twice.
|
|
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
|
|
return file.path;
|
|
};
|
|
|
|
function isValidSnapshotFileId(snapshotId) {
|
|
return /^\d+(\-\d+)?$/.test(snapshotId);
|
|
}
|
|
|
|
/**
|
|
* Get the file path for the given snapshot id.
|
|
*
|
|
* @param {String} snapshotId
|
|
*
|
|
* @returns String | null
|
|
*/
|
|
exports.getHeapSnapshotTempFilePath = function (snapshotId) {
|
|
// Don't want anyone sneaking "../../../.." strings into the snapshot id and
|
|
// trying to make us open arbitrary files.
|
|
if (!isValidSnapshotFileId(snapshotId)) {
|
|
return null;
|
|
}
|
|
return OS.Path.join(OS.Constants.Path.tmpDir, snapshotId + ".fxsnapshot");
|
|
};
|
|
|
|
/**
|
|
* Return true if we have the heap snapshot file for the given snapshot id on
|
|
* the local file system. False is returned otherwise.
|
|
*
|
|
* @returns Promise<Boolean>
|
|
*/
|
|
exports.haveHeapSnapshotTempFile = function (snapshotId) {
|
|
const path = exports.getHeapSnapshotTempFilePath(snapshotId);
|
|
if (!path) {
|
|
return Promise.resolve(false);
|
|
}
|
|
|
|
return OS.File.stat(path).then(() => true,
|
|
() => false);
|
|
};
|
|
|
|
/**
|
|
* Given a heap snapshot's file path, extricate the snapshot id.
|
|
*
|
|
* @param {String} path
|
|
*
|
|
* @returns String
|
|
*/
|
|
exports.getSnapshotIdFromPath = function (path) {
|
|
return path.slice(OS.Constants.Path.tmpDir.length + 1,
|
|
path.length - ".fxsnapshot".length);
|
|
};
|