Merge fx-team to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-08-14 09:20:58 -04:00
commit 353c491013
6 changed files with 62 additions and 20 deletions

View File

@ -697,6 +697,7 @@ BrowserGlue.prototype = {
let buttons = [
{
label: win.gNavigatorBundle.getFormattedString("addonwatch.disable.label", [addon.name]),
accessKey: "", // workaround for bug 1192901
callback: function() {
addon.userDisabled = true;
if (addon.pendingOperations != addon.PENDING_NONE) {

View File

@ -7,6 +7,7 @@ package org.mozilla.gecko;
import java.util.HashSet;
import android.text.TextUtils;
import android.widget.PopupWindow;
import org.json.JSONException;
import org.json.JSONObject;
@ -308,7 +309,13 @@ public class DoorHangerPopup extends AnchoredPopup
return;
}
firstDoorhanger.showTitle(tab.getFavicon(), tab.getBaseDomain());
final String baseDomain = tab.getBaseDomain();
if (TextUtils.isEmpty(baseDomain)) {
firstDoorhanger.hideTitle();
} else {
firstDoorhanger.showTitle(tab.getFavicon(), baseDomain);
}
// Make the popup focusable for accessibility. This gets done here
// so the node can be accessibility focused, but on pre-ICS devices this

View File

@ -631,7 +631,14 @@ public abstract class GeckoApp
} else if ("Share:Text".equals(event)) {
String text = message.getString("text");
GeckoAppShell.openUriExternal(text, "text/plain", "", "", Intent.ACTION_SEND, "");
final Tab tab = Tabs.getInstance().getSelectedTab();
String title = "";
if (tab != null) {
title = tab.getDisplayTitle();
final String url = ReaderModeUtils.stripAboutReaderUrl(tab.getURL());
text += "\n\n" + url;
}
GeckoAppShell.openUriExternal(text, "text/plain", "", "", Intent.ACTION_SEND, title);
// Context: Sharing via chrome list (no explicit session is active)
Telemetry.sendUIEvent(TelemetryContract.Event.SHARE, TelemetryContract.Method.LIST);

View File

@ -8,6 +8,7 @@ Cu.import("resource://gre/modules/FxAccountsClient.jsm");
Cu.import("resource://gre/modules/FxAccountsCommon.js");
Cu.import("resource://gre/modules/FxAccountsOAuthGrantClient.jsm");
Cu.import("resource://services-common/utils.js");
let {AccountState} = Cu.import("resource://gre/modules/FxAccounts.jsm", {});
function promiseNotification(topic) {
return new Promise(resolve => {
@ -20,24 +21,40 @@ function promiseNotification(topic) {
}
// Just enough mocks so we can avoid hawk and storage.
let MockStorage = function() {
this.data = null;
};
MockStorage.prototype = Object.freeze({
set: function (contents) {
this.data = contents;
return Promise.resolve(null);
function MockStorageManager() {
}
MockStorageManager.prototype = {
promiseInitialized: Promise.resolve(),
initialize(accountData) {
this.accountData = accountData;
},
get: function () {
return Promise.resolve(this.data);
},
getOAuthTokens() {
return Promise.resolve(null);
},
setOAuthTokens(contents) {
finalize() {
return Promise.resolve();
},
});
getAccountData() {
return Promise.resolve(this.accountData);
},
updateAccountData(updatedFields) {
for (let [name, value] of Iterator(updatedFields)) {
if (value == null) {
delete this.accountData[name];
} else {
this.accountData[name] = value;
}
}
return Promise.resolve();
},
deleteAccountData() {
this.accountData = null;
return Promise.resolve();
}
}
function MockFxAccountsClient() {
this._email = "nobody@example.com";
@ -62,7 +79,12 @@ function MockFxAccounts(mockGrantClient) {
return new FxAccounts({
fxAccountsClient: new MockFxAccountsClient(),
getAssertion: () => Promise.resolve("assertion"),
signedInUserStorage: new MockStorage(),
newAccountState(credentials) {
// we use a real accountState but mocked storage.
let storage = new MockStorageManager();
storage.initialize(credentials);
return new AccountState(storage);
},
_destroyOAuthToken: function(tokenData) {
// somewhat sad duplication of _destroyOAuthToken, but hard to avoid.
return mockGrantClient.destroyToken(tokenData.token).then( () => {

View File

@ -122,7 +122,8 @@
var button = aButtons[b];
var buttonElem = document.createElementNS(XULNS, "button");
buttonElem.setAttribute("label", button.label);
buttonElem.setAttribute("accesskey", button.accessKey);
if (typeof button.accessKey == "string")
buttonElem.setAttribute("accesskey", button.accessKey);
if (typeof button.type == "string") {
buttonElem.setAttribute("type", button.type);
if ((button.type == "menu-button" || button.type == "menu") &&

View File

@ -4159,7 +4159,11 @@ XREMain::XRE_mainRun()
#ifdef MOZ_CRASHREPORTER
nsCString userAgentLocale;
if (NS_SUCCEEDED(Preferences::GetCString("general.useragent.locale", &userAgentLocale))) {
// Try a localized string first. This pref is always a localized string in
// Fennec, and might be elsewhere, too.
if (NS_SUCCEEDED(Preferences::GetLocalizedCString("general.useragent.locale", &userAgentLocale))) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
} else if (NS_SUCCEEDED(Preferences::GetCString("general.useragent.locale", &userAgentLocale))) {
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
}
#endif