Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2019-01-30 19:06:00 +02:00
Родитель 19bcfc41e1 7555c5cdea
Коммит 7dbbfd497b
17 изменённых файлов: 151 добавлений и 56 удалений

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

@ -320,8 +320,6 @@ def basic_bindgen_cflags(host, target, is_unix, compiler_info, android_cflags):
'compiler': {
'msvc': {
'default': [
# For compatibility with MSVC 2015
'-fms-compatibility-version=19',
# To enable the builtin __builtin_offsetof so that CRT wouldn't
# use reinterpret_cast in offsetof() which is not allowed inside
# static_assert().

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

@ -619,13 +619,6 @@ def check_compiler(compiler, language, target):
elif info.type == 'clang-cl' and info.language_version != cxx14_version:
append_flag('-std=c++14')
# We force clang-cl to emulate Visual C++ 2017 version 15.8.4
msvc_version = '19.15.26726'
if info.type == 'clang-cl' and info.version != msvc_version:
# This flag is a direct clang-cl flag that doesn't need -Xclang,
# add it directly.
flags.append('-fms-compatibility-version=%s' % msvc_version)
# Check compiler target
# --------------------------------------------------------------------
if not info.cpu or info.cpu != target.cpu:

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

@ -819,6 +819,11 @@ constexpr auto kSkipSelfHosted = JS::SavedFrameSelfHosted::Exclude;
return duration.ToMilliseconds();
}
/* static */ void ChromeUtils::ResetLastExternalProtocolIframeAllowed(
GlobalObject& aGlobal) {
PopupBlocker::ResetLastExternalProtocolIframeAllowed();
}
/* static */ void ChromeUtils::RegisterWindowActor(
const GlobalObject& aGlobal, const nsAString& aName,
const WindowActorOptions& aOptions, ErrorResult& aRv) {

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

@ -173,6 +173,8 @@ class ChromeUtils {
static double LastExternalProtocolIframeAllowed(GlobalObject& aGlobal);
static void ResetLastExternalProtocolIframeAllowed(GlobalObject& aGlobal);
static void RegisterWindowActor(const GlobalObject& aGlobal,
const nsAString& aName,
const WindowActorOptions& aOptions,

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

@ -404,6 +404,10 @@ PopupBlocker::PopupControlState PopupBlocker::GetEventPopupControlState(
return sLastAllowedExternalProtocolIFrameTimeStamp;
}
/* static */ void PopupBlocker::ResetLastExternalProtocolIframeAllowed() {
sLastAllowedExternalProtocolIFrameTimeStamp = TimeStamp();
}
} // namespace dom
} // namespace mozilla

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

@ -59,6 +59,9 @@ class PopupBlocker final {
// Returns when the last external protocol iframe has been allowed.
static TimeStamp WhenLastExternalProtocolIframeAllowed();
// Reset the last external protocol iframe timestamp.
static void ResetLastExternalProtocolIframeAllowed();
static void Initialize();
static void Shutdown();
};

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

@ -383,6 +383,12 @@ partial namespace ChromeUtils {
[ChromeOnly]
double lastExternalProtocolIframeAllowed();
/**
* For testing purpose we need to reset this value.
*/
[ChromeOnly]
void resetLastExternalProtocolIframeAllowed();
[ChromeOnly, Throws]
void registerWindowActor(DOMString aName, WindowActorOptions aOptions);
};

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

@ -10,6 +10,11 @@
<div id='foo'><a href='#'>Click here to test this issue</a></div>
<script>
function test_initialize() {
ChromeUtils.resetLastExternalProtocolIframeAllowed();
next();
}
function test_noUserInteraction() {
is(ChromeUtils.getPopupControlState(), "openAbused", "No user-interaction means: abuse state");
ok(!ChromeUtils.isPopupTokenUnused(), "Popup token has not been used yet");
@ -53,6 +58,7 @@ function test_userInteraction() {
}
let tests = [
test_initialize,
test_noUserInteraction,
test_userInteraction,
];

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

@ -16223,10 +16223,15 @@ nsresult QuotaClient::GetDatabaseFilenames(
continue;
}
// Skip Desktop Service Store (.DS_Store) files. These files are only used
// on Mac OS X, but the profile can be shared across different operating
// systems, so we check it on all platforms.
if (leafName.EqualsLiteral(DSSTORE_FILE_NAME)) {
// Skip OS metadata files. These files are only used in different platforms,
// but the profile can be shared across different operating systems, so we
// check it on all platforms.
if (QuotaManager::IsOSMetadata(leafName)) {
continue;
}
// Skip files starting with ".".
if (QuotaManager::IsDotFile(leafName)) {
continue;
}
@ -16310,6 +16315,11 @@ nsresult QuotaClient::GetUsageForDirectoryInternal(nsIFile* aDirectory,
continue;
}
if (QuotaManager::IsOSMetadata(leafName) ||
QuotaManager::IsDotFile(leafName)) {
continue;
}
// Journal files and sqlite-shm files don't count towards usage.
if (StringEndsWith(leafName, journalSuffix) ||
StringEndsWith(leafName, shmSuffix)) {

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

@ -1267,8 +1267,12 @@ void AssertNoUnderflow(T aDest, U aArg) {
MOZ_ASSERT(uint64_t(aDest) >= uint64_t(aArg));
}
bool IsOSMetadata(const nsAString& aFileName) {
return aFileName.EqualsLiteral(DSSTORE_FILE_NAME);
inline bool IsDotFile(const nsAString& aFileName) {
return QuotaManager::IsDotFile(aFileName);
}
inline bool IsOSMetadata(const nsAString& aFileName) {
return QuotaManager::IsOSMetadata(aFileName);
}
bool IsOriginMetadata(const nsAString& aFileName) {
@ -1668,7 +1672,8 @@ int64_t GetLastModifiedTime(nsIFile* aFile, bool aPersistent) {
return rv;
}
if (IsOriginMetadata(leafName) || IsTempMetadata(leafName)) {
if (IsOriginMetadata(leafName) || IsTempMetadata(leafName) ||
IsDotFile(leafName)) {
return NS_OK;
}
@ -2869,6 +2874,19 @@ QuotaManager* QuotaManager::Get() {
// static
bool QuotaManager::IsShuttingDown() { return gShutdown; }
// static
bool QuotaManager::IsOSMetadata(const nsAString& aFileName) {
return aFileName.EqualsLiteral(DSSTORE_FILE_NAME) ||
aFileName.EqualsLiteral(DESKTOP_FILE_NAME) ||
aFileName.LowerCaseEqualsLiteral(DESKTOP_INI_FILE_NAME) ||
aFileName.EqualsLiteral(THUMBS_DB_FILE_NAME);
}
// static
bool QuotaManager::IsDotFile(const nsAString& aFileName) {
return aFileName.First() == char16_t('.');
}
auto QuotaManager::CreateDirectoryLock(
const Nullable<PersistenceType>& aPersistenceType, const nsACString& aGroup,
const OriginScope& aOriginScope, const Nullable<Client::Type>& aClientType,
@ -3763,7 +3781,7 @@ nsresult QuotaManager::InitializeRepository(PersistenceType aPersistenceType) {
CONTINUE_IN_NIGHTLY_RETURN_IN_OTHERS(rv);
}
if (IsOSMetadata(leafName)) {
if (IsOSMetadata(leafName) || IsDotFile(leafName)) {
continue;
}
@ -3880,6 +3898,10 @@ nsresult QuotaManager::InitializeOrigin(PersistenceType aPersistenceType,
continue;
}
if (IsOSMetadata(leafName) || IsDotFile(leafName)) {
continue;
}
UNKNOWN_FILE_WARNING(leafName);
REPORT_TELEMETRY_INIT_ERR(kInternalError, Ori_UnexpectedFile);
RECORD_IN_NIGHTLY(statusKeeper, NS_ERROR_UNEXPECTED);
@ -6616,6 +6638,10 @@ nsresult QuotaUsageRequestBase::GetUsageForOrigin(
continue;
}
if (IsOSMetadata(leafName) || IsDotFile(leafName)) {
continue;
}
UNKNOWN_FILE_WARNING(leafName);
if (!initialized) {
return NS_ERROR_UNEXPECTED;
@ -6743,6 +6769,8 @@ nsresult GetUsageOp::TraverseRepository(QuotaManager* aQuotaManager,
return rv;
}
// Unknown files during getting usages are allowed. Just warn if we find
// them.
if (!IsOSMetadata(leafName)) {
UNKNOWN_FILE_WARNING(leafName);
}

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

@ -24,6 +24,9 @@
#define USING_QUOTA_NAMESPACE using namespace mozilla::dom::quota;
#define DSSTORE_FILE_NAME ".DS_Store"
#define DESKTOP_FILE_NAME ".desktop"
#define DESKTOP_INI_FILE_NAME "desktop.ini"
#define THUMBS_DB_FILE_NAME "Thumbs.db"
#define QM_WARNING(...) \
do { \

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

@ -115,6 +115,10 @@ class QuotaManager final : public BackgroundThreadObject {
// Returns true if we've begun the shutdown process.
static bool IsShuttingDown();
static bool IsOSMetadata(const nsAString& aFileName);
static bool IsDotFile(const nsAString& aFileName);
bool IsOriginInitialized(const nsACString& aOrigin) const {
AssertIsOnIOThread();

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

@ -0,0 +1,55 @@
/**
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/**
* This test is mainly to verify thoes unexpected files are in the white list of
* QuotaManager. They aren't expected in the repository but if there are,
* QuotaManager shouldn't fail to initialize an origin and getting usage, though
* those files aren't managed by QuotaManager.
*/
async function testSteps()
{
const whiteListFiles = [
".dot-file",
"desktop.ini",
"Desktop.ini",
"Thumbs.db"
];
for (let whiteListFile of whiteListFiles) {
info("Testing " + whiteListFile + " in the repository");
info("Creating unknown file");
for (let dir of ["persistenceType dir", "origin dir"]) {
let dirPath =
dir == "persistenceType dir" ? "storage/default/"
: "storage/default/http+++example.com/";
let file = getRelativeFile(dirPath + whiteListFile);
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0644", 8));
}
info("Initializing an origin");
let request = initOrigin(getPrincipal("http://example.com"), "default");
await requestFinished(request);
info("Resetting");
request = reset();
await requestFinished(request);
info("Getting usage");
request = getCurrentUsage(continueToNextStepSync);
await requestFinished(request);
info("Clearing");
request = clear();
await requestFinished(request);
}
}

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

@ -44,3 +44,4 @@ support-files =
[test_tempMetadataCleanup.js]
[test_unknownFiles.js]
[test_version2_1upgrade.js]
[test_whiteListFiles.js]

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

@ -109,7 +109,6 @@ BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent, SharedContext* sc,
maxFixedSlots(0),
maxStackDepth(0),
stackDepth(0),
emitLevel(0),
bodyScopeIndex(UINT32_MAX),
varEmitterScope(nullptr),
innermostNestableControl(nullptr),
@ -2363,7 +2362,12 @@ bool BytecodeEmitter::emitScript(ParseNode* body) {
switchToMain();
if (!emitLexicalScopeBody(scope->scopeBody())) {
ParseNode* scopeBody = scope->scopeBody();
if (!emitLexicalScopeBody(scopeBody, EMIT_LINENOTE)) {
return false;
}
if (!updateSourceCoordNotes(scopeBody->pn_pos.end)) {
return false;
}
@ -2382,10 +2386,10 @@ bool BytecodeEmitter::emitScript(ParseNode* body) {
if (!emitTree(body)) {
return false;
}
}
if (!updateSourceCoordNotes(body->pn_pos.end)) {
return false;
if (!updateSourceCoordNotes(body->pn_pos.end)) {
return false;
}
}
if (!emit1(JSOP_RETRVAL)) {
@ -4485,20 +4489,6 @@ bool BytecodeEmitter::emitCallSiteObject(CallSiteNode* callSiteObj) {
return emitObjectPairOp(objbox1, objbox2, JSOP_CALLSITEOBJ);
}
namespace {
class EmitLevelManager {
BytecodeEmitter* bce;
public:
explicit EmitLevelManager(BytecodeEmitter* bce) : bce(bce) {
bce->emitLevel++;
}
~EmitLevelManager() { bce->emitLevel--; }
};
} /* anonymous namespace */
bool BytecodeEmitter::emitCatch(BinaryNode* catchClause) {
// We must be nested under a try-finally statement.
MOZ_ASSERT(innermostNestableControl->is<TryFinallyControl>());
@ -4723,8 +4713,8 @@ bool BytecodeEmitter::emitHoistedFunctionsInList(ListNode* stmtList) {
return true;
}
bool BytecodeEmitter::emitLexicalScopeBody(ParseNode* body,
EmitLineNumberNote emitLineNote) {
bool BytecodeEmitter::emitLexicalScopeBody(
ParseNode* body, EmitLineNumberNote emitLineNote /* = EMIT_LINENOTE */) {
if (body->isKind(ParseNodeKind::StatementList) &&
body->as<ListNode>().hasTopLevelFunctionDeclarations()) {
// This block contains function statements whose definitions are
@ -4735,7 +4725,7 @@ bool BytecodeEmitter::emitLexicalScopeBody(ParseNode* body,
}
}
// Line notes were updated by emitLexicalScope.
// Line notes were updated by emitLexicalScope or emitScript.
return emitTree(body, ValueUsage::WantValue, emitLineNote);
}
@ -8616,8 +8606,6 @@ bool BytecodeEmitter::emitTree(
return false;
}
EmitLevelManager elm(this);
/* Emit notes to tell the current bytecode's source line number.
However, a couple trees require special treatment; see the
relevant emitter functions for details. */
@ -9131,12 +9119,6 @@ bool BytecodeEmitter::emitTree(
MOZ_ASSERT(0);
}
/* bce->emitLevel == 1 means we're last on the stack, so finish up. */
if (emitLevel == 1) {
if (!updateSourceCoordNotes(pn->pn_pos.end)) {
return false;
}
}
return true;
}

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

@ -156,8 +156,6 @@ struct MOZ_STACK_CLASS BytecodeEmitter {
int32_t stackDepth; /* current stack depth in script frame */
unsigned emitLevel; /* emitTree recursion level */
uint32_t bodyScopeIndex; /* index into scopeList of the body scope */
EmitterScope* varEmitterScope;

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

@ -263,7 +263,6 @@ CLANG_CL_3_9 = (CLANG_BASE('3.9.0') + VS('18.00.00000') + DEFAULT_C11 +
'__STDC_VERSION__': False,
'__cplusplus': '201103L',
},
'-fms-compatibility-version=19.15.26726': VS('19.15.26726')[None],
}
CLANG_CL_PLATFORM_X86 = FakeCompiler(VS_PLATFORM_X86, GCC_PLATFORM_X86[None])
@ -928,17 +927,15 @@ class WindowsToolchainTest(BaseToolchainTest):
language='C++',
)
CLANG_CL_3_9_RESULT = CompilerResult(
flags=['-Xclang', '-std=gnu99',
'-fms-compatibility-version=19.15.26726'],
version='19.15.26726',
version='18.00.00000',
flags=['-Xclang', '-std=gnu99'],
type='clang-cl',
compiler='/usr/bin/clang-cl',
language='C',
)
CLANGXX_CL_3_9_RESULT = CompilerResult(
flags=['-Xclang', '-std=c++14',
'-fms-compatibility-version=19.15.26726'],
version='19.15.26726',
version='18.00.00000',
flags=['-Xclang', '-std=c++14'],
type='clang-cl',
compiler='/usr/bin/clang-cl',
language='C++',