Merge mozilla-inbound and mozilla-central

This commit is contained in:
Marco Bonardo 2011-06-24 11:40:46 +02:00
commit bf11822e25
13 changed files with 147 additions and 65 deletions

View File

@ -249,7 +249,11 @@ function GroupItem(listOfEls, options) {
this._init($container[0]);
// ___ Children
Array.prototype.forEach.call(listOfEls, function(el) {
// We explicitly set dontArrange=true to prevent the groupItem from
// re-arranging its children after a tabItem has been added. This saves us a
// group.arrange() call per child and therefore some tab.setBounds() calls.
options.dontArrange = true;
listOfEls.forEach(function (el) {
self.add(el, options);
});

View File

@ -4,37 +4,29 @@
function test() {
waitForExplicitFinish();
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
TabView.show();
ok(!TabView.isVisible(), "Tab View is hidden");
showTabView(onTabViewShown);
}
function onTabViewWindowLoaded() {
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
function onTabViewShown() {
let contentWindow = TabView.getContentWindow();
let groupItems = contentWindow.GroupItems.groupItems;
let groupItem = groupItems[0];
let contentWindow = document.getElementById("tab-view").contentWindow;
is(contentWindow.GroupItems.groupItems.length, 1,
"There is one group item on startup");
is(groupItems.length, 1, "There is one group item on startup");
let groupItem = contentWindow.GroupItems.groupItems[0];
groupItem.addSubscriber(groupItem, "groupHidden", function() {
groupItem.removeSubscriber(groupItem, "groupHidden");
let onTabViewHidden = function() {
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
is(contentWindow.GroupItems.groupItems.length, 1,
"There is still one group item");
isnot(groupItem.id, contentWindow.GroupItems.groupItems[0].id,
hideGroupItem(groupItem, function () {
whenTabViewIsHidden(function () {
is(groupItems.length, 1, "There is still one group item");
isnot(groupItem.id, groupItems[0].id,
"The initial group item is not the same as the final group item");
is(gBrowser.tabs.length, 1, "There is only one tab");
ok(!TabView.isVisible(), "Tab View is hidden");
finish();
};
window.addEventListener("tabviewhidden", onTabViewHidden, false);
});
// create a new tab
EventUtils.synthesizeKey("t", { accelKey: true });
});
groupItem.closeAll();
}

View File

@ -22,7 +22,7 @@ function onTabViewLoadedAndShown() {
ok(TabView.isVisible(), "Tab View is visible");
// Establish initial state
contentWindow = document.getElementById("tab-view").contentWindow;
contentWindow = TabView.getContentWindow();
verifyCleanState("start");
// register a clean up for private browsing just in case
@ -50,40 +50,37 @@ function onTabViewLoadedAndShown() {
}
// Create a second tab
gBrowser.loadOneTab("about:robots", { inBackground: false });
gBrowser.addTab("about:robots");
is(gBrowser.tabs.length, 2, "we now have 2 tabs");
registerCleanupFunction(function() {
gBrowser.removeTab(gBrowser.tabs[1]);
});
afterAllTabsLoaded(function() {
showTabView(function() {
// Get normal tab urls
for (let a = 0; a < gBrowser.tabs.length; a++)
normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
// Get normal tab urls
for (let a = 0; a < gBrowser.tabs.length; a++)
normalURLs.push(gBrowser.tabs[a].linkedBrowser.currentURI.spec);
// verify that we're all set up for our test
verifyNormal();
// verify that we're all set up for our test
verifyNormal();
// go into private browsing and make sure Tab View becomes hidden
togglePBAndThen(function() {
whenTabViewIsHidden(function() {
ok(!TabView.isVisible(), "Tab View is no longer visible");
// go into private browsing and make sure Tab View becomes hidden
togglePBAndThen(function() {
whenTabViewIsHidden(function() {
ok(!TabView.isVisible(), "Tab View is no longer visible");
verifyPB();
verifyPB();
// exit private browsing and make sure Tab View is shown again
togglePBAndThen(function() {
whenTabViewIsShown(function() {
ok(TabView.isVisible(), "Tab View is visible again");
verifyNormal();
// exit private browsing and make sure Tab View is shown again
togglePBAndThen(function() {
whenTabViewIsShown(function() {
ok(TabView.isVisible(), "Tab View is visible again");
verifyNormal();
hideTabView(onTabViewHidden);
});
hideTabView(onTabViewHidden);
});
});
});
});
});
});
}

View File

@ -81,19 +81,15 @@ function newWindowWithTabView(shownCallback, loadCallback, width, height) {
let win = window.openDialog(getBrowserURL(), "_blank",
"chrome,all,dialog=no,height=" + winHeight +
",width=" + winWidth);
let onLoad = function() {
win.removeEventListener("load", onLoad, false);
if (typeof loadCallback == "function")
whenWindowLoaded(win, function () {
if (loadCallback)
loadCallback(win);
let onShown = function() {
win.removeEventListener("tabviewshown", onShown, false);
shownCallback(win);
};
win.addEventListener("tabviewshown", onShown, false);
win.TabView.toggle();
}
win.addEventListener("load", onLoad, false);
whenDelayedStartupFinished(win, function () {
showTabView(function () shownCallback(win), win);
});
});
}
// ----------

View File

@ -376,8 +376,13 @@ BrowserGlue.prototype = {
// Browser startup complete. All initial windows have opened.
_onBrowserStartup: function BG__onBrowserStartup() {
// Show about:rights notification, if needed.
if (this._shouldShowRights())
if (this._shouldShowRights()) {
this._showRightsNotification();
} else {
// Only show telemetry notification when about:rights notification is not shown.
this._showTelemetryNotification();
}
// Show update notification, if needed.
if (Services.prefs.prefHasUserValue("app.update.postupdate"))
@ -735,6 +740,72 @@ BrowserGlue.prototype = {
}
},
_showTelemetryNotification: function BG__showTelemetryNotification() {
const PREF_TELEMETRY_PROMPTED = "toolkit.telemetry.prompted";
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
const PREF_TELEMETRY_INFOURL = "toolkit.telemetry.infoURL";
const PREF_TELEMETRY_SERVER_OWNER = "toolkit.telemetry.server_owner";
try {
// If the user hasn't already been prompted, ask if they want to
// send telemetry data.
if (Services.prefs.getBoolPref(PREF_TELEMETRY_ENABLED) ||
Services.prefs.getBoolPref(PREF_TELEMETRY_PROMPTED))
return;
} catch(e) {}
// Stick the notification onto the selected tab of the active browser window.
var win = this.getMostRecentBrowserWindow();
var browser = win.gBrowser; // for closure in notification bar callback
var notifyBox = browser.getNotificationBox();
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var productName = brandBundle.GetStringFromName("brandFullName");
var serverOwner = Services.prefs.getCharPref(PREF_TELEMETRY_SERVER_OWNER);
var telemetryText = browserBundle.formatStringFromName("telemetryText", [productName, serverOwner], 2);
var buttons = [
{
label: browserBundle.GetStringFromName("telemetryYesButtonLabel"),
accessKey: browserBundle.GetStringFromName("telemetryYesButtonAccessKey"),
popup: null,
callback: function(aNotificationBar, aButton) {
Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
}
},
{
label: browserBundle.GetStringFromName("telemetryNoButtonLabel"),
accessKey: browserBundle.GetStringFromName("telemetryNoButtonAccessKey"),
popup: null,
callback: function(aNotificationBar, aButton) {}
}
];
// Set pref to indicate we've shown the notification.
Services.prefs.setBoolPref(PREF_TELEMETRY_PROMPTED, true);
var notification = notifyBox.appendNotification(telemetryText, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
notification.persistence = 3; // arbitrary number, just so bar sticks around for a bit
let XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let link = notification.ownerDocument.createElementNS(XULNS, "label");
link.className = "text-link telemetry-text-link";
link.setAttribute("value", browserBundle.GetStringFromName("telemetryLinkLabel"));
link.addEventListener('click', function() {
// Open the learn more url in a new tab
browser.selectedTab = browser.addTab(Services.prefs.getCharPref(PREF_TELEMETRY_INFOURL));
// Remove the notification on which the user clicked
notification.parentNode.removeNotification(notification, true);
// Add a new notification to that tab, with no "Learn more" link
var notifyBox = browser.getNotificationBox();
notifyBox.appendNotification(telemetryText, "telemetry", null, notifyBox.PRIORITY_INFO_LOW, buttons);
}, false);
let description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
description.appendChild(link);
},
_showPluginUpdatePage: function BG__showPluginUpdatePage() {
Services.prefs.setBoolPref(PREF_PLUGINS_NOTIFYUSER, false);

View File

@ -82,6 +82,10 @@
type="bool"/>
#endif
<preference id="toolkit.telemetry.enabled"
name="toolkit.telemetry.enabled"
type="bool"/>
<!-- Network tab -->
<preference id="browser.cache.disk.capacity" name="browser.cache.disk.capacity" type="int"/>
<preference id="browser.offline-apps.notify" name="browser.offline-apps.notify" type="bool"/>
@ -193,11 +197,11 @@
preference="layout.spellcheckDefault"/>
</groupbox>
#ifdef HAVE_SHELL_SERVICE
<!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="vertical">
<caption label="&systemDefaults.label;"/>
#ifdef HAVE_SHELL_SERVICE
<hbox id="checkDefaultBox" align="center" flex="1">
<checkbox id="alwaysCheckDefault" preference="browser.shell.checkDefaultBrowser"
label="&alwaysCheckDefault.label;" accesskey="&alwaysCheckDefault.accesskey;"
@ -212,8 +216,11 @@
oncommand="gAdvancedPane.updateSubmitCrashes();"
label="&submitCrashes.label;" accesskey="&submitCrashes.accesskey;"/>
#endif
</groupbox>
#endif
<checkbox id="submitTelemetryBox" flex="1"
preference="toolkit.telemetry.enabled"
label="&submitTelemetry.label;" accesskey="&submitTelemetry.accesskey;"/>
</groupbox>
</tabpanel>
<!-- Network -->

View File

@ -2933,8 +2933,7 @@ SessionStoreService.prototype = {
// force session history to update its internal index and call reload
// instead of gotoIndex. See bug 597315.
browser.webNavigation.sessionHistory.getEntryAtIndex(activeIndex, true);
browser.webNavigation.sessionHistory.
QueryInterface(Ci.nsISHistory).reloadCurrentEntry();
browser.webNavigation.sessionHistory.reloadCurrentEntry();
}
catch (ex) {
// ignore page load errors

View File

@ -325,3 +325,13 @@ syncPromoNotification.bookmarks.description=You can access your bookmarks on all
# The final space separates this text from the Learn More link.
syncPromoNotification.passwords.description=You can access your passwords on all your devices with %S.\u0020
syncPromoNotification.learnMoreLinkText=Learn More
# Telemetry prompt
# LOCALIZATION NOTE (telemetryText): %1$S will be replaced by brandFullName,
# and %2$S by the value of the toolkit.telemetry.server_owner preference.
telemetryText = Would you like to help improve %1$S by automatically reporting memory usage, performance, and responsiveness to %2$S?
telemetryLinkLabel = Learn More
telemetryYesButtonLabel = Yes
telemetryYesButtonAccessKey = Y
telemetryNoButtonLabel = No
telemetryNoButtonAccessKey = N

View File

@ -29,6 +29,8 @@
<!ENTITY checkNow.accesskey "N">
<!ENTITY submitCrashes.label "Submit crash reports">
<!ENTITY submitCrashes.accesskey "S">
<!ENTITY submitTelemetry.label "Submit performance data">
<!ENTITY submitTelemetry.accesskey "P">
<!ENTITY networkTab.label "Network">

View File

@ -2167,6 +2167,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
-moz-margin-start: 0; /* override default label margin to match description margin */
}
.telemetry-text-link {
color: #fff;
}
#addons-notification-icon {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
}

View File

@ -276,6 +276,10 @@ pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150);
// Telemetry
pref("toolkit.telemetry.enabled", false);
pref("toolkit.telemetry.server", "https://data.mozilla.com");
// Telemetry server owner. Please change if you set toolkit.telemetry.server to a different server
pref("toolkit.telemetry.server_owner", "Mozilla");
// Information page about telemetry (temporary ; will be about:telemetry in the end)
pref("toolkit.telemetry.infoURL", "http://www.mozilla.com/legal/privacy/firefox.html#telemetry");
// view source
pref("view_source.syntax_highlight", true);

View File

@ -301,14 +301,13 @@ nsresult nsScanner::Append(const nsAString& aBuffer) {
nsresult nsScanner::Append(const char* aBuffer, PRUint32 aLen,
nsIRequest *aRequest)
{
nsresult res=NS_OK;
PRUnichar *unichars, *start;
nsresult res = NS_OK;
if (mUnicodeDecoder) {
PRInt32 unicharBufLen = 0;
mUnicodeDecoder->GetMaxLength(aBuffer, aLen, &unicharBufLen);
nsScannerString::Buffer* buffer = nsScannerString::AllocBuffer(unicharBufLen + 1);
NS_ENSURE_TRUE(buffer,NS_ERROR_OUT_OF_MEMORY);
start = unichars = buffer->DataStart();
PRUnichar *unichars = buffer->DataStart();
PRInt32 totalChars = 0;
PRInt32 unicharLength = unicharBufLen;

View File

@ -454,9 +454,6 @@ LoadDirsIntoArray(nsCOMArray<nsIFile>& aSourceDirs,
}
}
static const char *const kAppendChromeManifests[] =
{ "chrome.manifest", nsnull };
NS_IMETHODIMP
nsXREDirProvider::GetFiles(const char* aProperty, nsISimpleEnumerator** aResult)
{