Merge autoland to mozilla-central. a=merge

This commit is contained in:
Ciure Andrei 2018-01-26 12:02:33 +02:00
commit 64ab3ca728
6 changed files with 78 additions and 32 deletions

View File

@ -436,6 +436,7 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aMa
mSendInterleaved = false;
mPpidFragmentation = false;
mMaxMessageSizeSet = false;
SetMaxMessageSize(aMaxMessageSizeSet, aMaxMessageSize);
if (!sctp_initialized) {
@ -601,6 +602,11 @@ DataChannelConnection::SetMaxMessageSize(bool aMaxMessageSizeSet, uint64_t aMaxM
{
MutexAutoLock lock(mLock); // TODO: Needed?
if (mMaxMessageSizeSet && !aMaxMessageSizeSet) {
// Don't overwrite already set MMS with default values
return;
}
mMaxMessageSizeSet = aMaxMessageSizeSet;
mMaxMessageSize = aMaxMessageSize;

View File

@ -1841,7 +1841,7 @@ class AddonInstall {
if (isUpgrade) {
this.addon = XPIDatabase.updateAddonMetadata(this.existingAddon, this.addon,
file.persistentDescriptor);
file.path);
let state = XPIStates.getAddon(this.installLocation.name, this.addon.id);
if (state) {
state.syncWithDB(this.addon, true);
@ -1850,7 +1850,7 @@ class AddonInstall {
}
} else {
this.addon.active = (this.addon.visible && !this.addon.disabled);
this.addon = XPIDatabase.addAddonMetadata(this.addon, file.persistentDescriptor);
this.addon = XPIDatabase.addAddonMetadata(this.addon, file.path);
XPIStates.addAddon(this.addon);
this.addon.installDate = this.addon.updateDate;
XPIDatabase.saveChanges();

View File

@ -155,7 +155,7 @@ const TOOLKIT_ID = "toolkit@mozilla.org";
const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
XPCOMUtils.defineConstant(this, "DB_SCHEMA", 23);
XPCOMUtils.defineConstant(this, "DB_SCHEMA", 24);
XPCOMUtils.defineLazyPreferenceGetter(this, "ALLOW_NON_MPC", PREF_ALLOW_NON_MPC);
@ -407,10 +407,7 @@ function getRelativePath(file, dir) {
}
/**
* Converts the given opaque descriptor string into an ordinary path
* string. In practice, the path string is always exactly equal to the
* descriptor string, but theoretically may not have been on some legacy
* systems.
* Converts the given opaque descriptor string into an ordinary path string.
*
* @param {string} descriptor
* The opaque descriptor string to convert.
@ -3626,7 +3623,7 @@ this.XPIProvider = {
// WebExtension themes are installed as disabled, fix that here.
addon.userDisabled = false;
addon = XPIDatabase.addAddonMetadata(addon, file.persistentDescriptor);
addon = XPIDatabase.addAddonMetadata(addon, file.path);
XPIStates.addAddon(addon);
XPIDatabase.saveChanges();

View File

@ -0,0 +1,55 @@
Components.utils.import("resource://testing-common/AddonTestUtils.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
const { OS } = Components.utils.import("resource://gre/modules/osfile.jsm", {});
let global = this;
// Test that paths in the extensions database are stored properly
// if they include non-ascii characters (see bug 1428234 for an example of
// a past bug with such paths)
add_task(async function test_non_ascii_path() {
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
const PROFILE_VAR = "XPCSHELL_TEST_PROFILE_DIR";
let profileDir = OS.Path.join(env.get(PROFILE_VAR),
"\u00ce \u00e5m \u00f1\u00f8t \u00e5s\u00e7ii");
env.set(PROFILE_VAR, profileDir);
AddonTestUtils.init(global);
AddonTestUtils.overrideCertDB();
AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
const ID1 = "profile1@tests.mozilla.org";
let xpi1 = await AddonTestUtils.createTempWebExtensionFile({
id: ID1,
manifest: {
applications: {gecko: {id: ID1}},
},
});
const ID2 = "profile2@tests.mozilla.org";
let xpi2 = await AddonTestUtils.createTempWebExtensionFile({
id: ID2,
manifest: {
applications: {gecko: {id: ID2}},
},
});
await AddonTestUtils.manuallyInstall(xpi1);
await AddonTestUtils.promiseStartupManager();
await AddonTestUtils.promiseInstallFile(xpi2);
await AddonTestUtils.promiseShutdownManager();
let dbfile = OS.Path.join(profileDir, "extensions.json");
let raw = new TextDecoder().decode(await OS.File.read(dbfile));
let data = JSON.parse(raw);
Assert.ok(Array.isArray(data.addons), "extensions.json has addons array");
Assert.equal(2, data.addons.length, "extensions.json has 2 addons");
Assert.ok(data.addons[0].path.startsWith(profileDir),
"path property for sideloaded extension has the proper profile directory");
Assert.ok(data.addons[1].path.startsWith(profileDir),
"path property for extension installed at runtime has the proper profile directory");
});

View File

@ -165,6 +165,8 @@ tags = blocklist
[test_corrupt_strictcompat.js]
[test_corruptfile.js]
[test_dataDirectory.js]
[test_db_path.js]
head =
[test_default_providers_pref.js]
[test_dictionary.js]
[test_disable.js]

View File

@ -2472,8 +2472,7 @@ TextInputHandler::HandleCommand(Command aCommand)
// Otherwise, we should adjust Control, Option and Command state since
// editor may behave differently if some of them are active.
bool dispatchFakeKeyPress =
!(currentKeyEvent && currentKeyEvent->IsProperKeyEvent(aCommand) &&
currentKeyEvent->CanDispatchKeyPressEvent());
!(currentKeyEvent && currentKeyEvent->IsProperKeyEvent(aCommand));
WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget);
if (!dispatchFakeKeyPress) {
@ -2482,6 +2481,15 @@ TextInputHandler::HandleCommand(Command aCommand)
currentKeyEvent->InitKeyEvent(this, keypressEvent);
} else {
// Otherwise, we should dispatch "fake" keypress event.
// However, for making it possible to compute edit commands, we need to
// set current native key event to the fake keyboard event even if it's
// not same as what we expect since the native keyboard event caused
// this command.
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
keypressEvent.mNativeKeyEvent = keyEvent;
NS_WARNING_ASSERTION(keypressEvent.mNativeKeyEvent,
"Without native key event, NativeKeyBindings cannot compute aCommand");
switch (aCommand) {
case CommandInsertLineBreak:
case CommandInsertParagraph: {
@ -2493,8 +2501,6 @@ TextInputHandler::HandleCommand(Command aCommand)
// line in HTML editor with default paragraph separator when
// Enter, Shift+Enter or Option+Enter. So, we should not change
// Shift+Enter meaning when there was composition string or not.
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_RETURN;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_Enter;
@ -2511,8 +2517,6 @@ TextInputHandler::HandleCommand(Command aCommand)
case CommandDeleteCharBackward:
case CommandDeleteToBeginningOfLine:
case CommandDeleteWordBackward: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_BACK;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_Backspace;
@ -2528,8 +2532,6 @@ TextInputHandler::HandleCommand(Command aCommand)
}
case CommandDeleteCharForward:
case CommandDeleteWordForward: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_DELETE;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_Delete;
@ -2547,8 +2549,6 @@ TextInputHandler::HandleCommand(Command aCommand)
case CommandSelectWordNext:
case CommandEndLine:
case CommandSelectEndLine: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_RIGHT;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowRight;
@ -2576,8 +2576,6 @@ TextInputHandler::HandleCommand(Command aCommand)
case CommandSelectWordPrevious:
case CommandBeginLine:
case CommandSelectBeginLine: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_LEFT;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowLeft;
@ -2603,8 +2601,6 @@ TextInputHandler::HandleCommand(Command aCommand)
case CommandSelectLinePrevious:
case CommandMoveTop:
case CommandSelectTop: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_UP;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowUp;
@ -2625,8 +2621,6 @@ TextInputHandler::HandleCommand(Command aCommand)
case CommandSelectLineNext:
case CommandMoveBottom:
case CommandSelectBottom: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_DOWN;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_ArrowDown;
@ -2645,8 +2639,6 @@ TextInputHandler::HandleCommand(Command aCommand)
}
case CommandScrollPageUp:
case CommandSelectPageUp: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_PAGE_UP;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_PageUp;
@ -2660,8 +2652,6 @@ TextInputHandler::HandleCommand(Command aCommand)
}
case CommandScrollPageDown:
case CommandSelectPageDown: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_PAGE_DOWN;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_PageDown;
@ -2675,8 +2665,6 @@ TextInputHandler::HandleCommand(Command aCommand)
}
case CommandScrollBottom:
case CommandScrollTop: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
if (aCommand == CommandScrollBottom) {
keypressEvent.mKeyCode = NS_VK_END;
@ -2692,8 +2680,6 @@ TextInputHandler::HandleCommand(Command aCommand)
}
case CommandCancelOperation:
case CommandComplete: {
NSEvent* keyEvent =
currentKeyEvent ? currentKeyEvent->mKeyEvent : nullptr;
nsCocoaUtils::InitInputEvent(keypressEvent, keyEvent);
keypressEvent.mKeyCode = NS_VK_ESCAPE;
keypressEvent.mKeyNameIndex = KEY_NAME_INDEX_Escape;