Merge mozilla-central to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2014-01-03 12:52:54 +01:00
Родитель aa3d7fd89b 2e82c27b61
Коммит 5e841bd63d
7 изменённых файлов: 117 добавлений и 19 удалений

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

@ -1,4 +1,4 @@
{ {
"revision": "b61e95024e07f0ad99e20802953fb8b62ae02505", "revision": "2977ae6150d723b2763e9e76da00aa1fb3c31678",
"repo_path": "/integration/gaia-central" "repo_path": "/integration/gaia-central"
} }

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

@ -291,7 +291,9 @@ const CustomizableWidgets = [{
defaultArea: CustomizableUI.AREA_PANEL, defaultArea: CustomizableUI.AREA_PANEL,
onBuild: function(aDocument) { onBuild: function(aDocument) {
const kPanelId = "PanelUI-popup"; const kPanelId = "PanelUI-popup";
let inPanel = (this.currentArea == CustomizableUI.AREA_PANEL); let areaType = CustomizableUI.getAreaType(this.currentArea);
let inPanel = areaType == CustomizableUI.TYPE_MENU_PANEL;
let inToolbar = areaType == CustomizableUI.TYPE_TOOLBAR;
let noautoclose = inPanel ? "true" : null; let noautoclose = inPanel ? "true" : null;
let cls = inPanel ? "panel-combined-button" : "toolbarbutton-1"; let cls = inPanel ? "panel-combined-button" : "toolbarbutton-1";
@ -358,10 +360,14 @@ const CustomizableWidgets = [{
Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomChange", false); Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomChange", false);
Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomReset", false); Services.obs.addObserver(updateZoomResetButton, "browser-fullZoom:zoomReset", false);
if (inPanel && this.currentArea) { if (inPanel) {
let panel = aDocument.getElementById(kPanelId); let panel = aDocument.getElementById(kPanelId);
panel.addEventListener("popupshowing", updateZoomResetButton); panel.addEventListener("popupshowing", updateZoomResetButton);
} else { } else {
if (inToolbar) {
let container = window.gBrowser.tabContainer;
container.addEventListener("TabSelect", updateZoomResetButton);
}
updateZoomResetButton(); updateZoomResetButton();
} }
@ -373,9 +379,13 @@ const CustomizableWidgets = [{
updateCombinedWidgetStyle(node, aArea, true); updateCombinedWidgetStyle(node, aArea, true);
updateZoomResetButton(); updateZoomResetButton();
if (aArea == CustomizableUI.AREA_PANEL) { let areaType = CustomizableUI.getAreaType(aArea);
if (areaType == CustomizableUI.TYPE_MENU_PANEL) {
let panel = aDocument.getElementById(kPanelId); let panel = aDocument.getElementById(kPanelId);
panel.addEventListener("popupshowing", updateZoomResetButton); panel.addEventListener("popupshowing", updateZoomResetButton);
} else if (areaType == CustomizableUI.TYPE_TOOLBAR) {
let container = window.gBrowser.tabContainer;
container.addEventListener("TabSelect", updateZoomResetButton);
} }
}.bind(this), }.bind(this),
@ -383,9 +393,13 @@ const CustomizableWidgets = [{
if (aWidgetId != this.id) if (aWidgetId != this.id)
return; return;
if (aPrevArea == CustomizableUI.AREA_PANEL) { let areaType = CustomizableUI.getAreaType(aPrevArea);
if (areaType == CustomizableUI.TYPE_MENU_PANEL) {
let panel = aDocument.getElementById(kPanelId); let panel = aDocument.getElementById(kPanelId);
panel.removeEventListener("popupshowing", updateZoomResetButton); panel.removeEventListener("popupshowing", updateZoomResetButton);
} else if (areaType == CustomizableUI.TYPE_TOOLBAR) {
let container = window.gBrowser.tabContainer;
container.removeEventListener("TabSelect", updateZoomResetButton);
} }
// When a widget is demoted to the palette ('removed'), it's visual // When a widget is demoted to the palette ('removed'), it's visual
@ -417,6 +431,8 @@ const CustomizableWidgets = [{
Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:zoomReset"); Services.obs.removeObserver(updateZoomResetButton, "browser-fullZoom:zoomReset");
let panel = aDoc.getElementById(kPanelId); let panel = aDoc.getElementById(kPanelId);
panel.removeEventListener("popupshowing", updateZoomResetButton); panel.removeEventListener("popupshowing", updateZoomResetButton);
let container = aDoc.defaultView.gBrowser.tabContainer;
container.removeEventListener("TabSelect", updateZoomResetButton);
}.bind(this), }.bind(this),
onWidgetDrag: function(aWidgetId, aArea) { onWidgetDrag: function(aWidgetId, aArea) {

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

@ -38,6 +38,7 @@ skip-if = true
# Because this test is about the menubar, it can't be run on mac # Because this test is about the menubar, it can't be run on mac
skip-if = os == "mac" skip-if = os == "mac"
[browser_934951_zoom_in_toolbar.js]
[browser_938980_navbar_collapsed.js] [browser_938980_navbar_collapsed.js]
[browser_938995_indefaultstate_nonremovable.js] [browser_938995_indefaultstate_nonremovable.js]
[browser_940013_registerToolbarNode_calls_registerArea.js] [browser_940013_registerToolbarNode_calls_registerArea.js]

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

@ -0,0 +1,68 @@
/* 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/. */
"use strict";
const kTimeoutInMS = 20000;
// Bug 934951 - Zoom controls percentage label doesn't update when it's in the toolbar and you navigate.
add_task(function() {
CustomizableUI.addWidgetToArea("zoom-controls", CustomizableUI.AREA_NAVBAR);
let tab1 = gBrowser.addTab("about:mozilla");
let tab2 = gBrowser.addTab("about:newtab");
gBrowser.selectedTab = tab1;
let zoomResetButton = document.getElementById("zoom-reset-button");
is(parseInt(zoomResetButton.label, 10), 100, "Default zoom is 100% for about:mozilla");
let zoomChangePromise = promiseObserverNotification("browser-fullZoom:zoomChange");
FullZoom.enlarge();
yield zoomChangePromise;
is(parseInt(zoomResetButton.label, 10), 110, "Zoom is changed to 110% for about:mozilla");
let tabSelectPromise = promiseTabSelect();
gBrowser.selectedTab = tab2;
yield tabSelectPromise;
is(parseInt(zoomResetButton.label, 10), 100, "Default zoom is 100% for about:newtab");
gBrowser.selectedTab = tab1;
let zoomResetPromise = promiseObserverNotification("browser-fullZoom:zoomReset");
FullZoom.reset();
yield zoomResetPromise;
is(parseInt(zoomResetButton.label, 10), 100, "Default zoom is 100% for about:mozilla");
CustomizableUI.reset();
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab1);
});
function promiseObserverNotification(aObserver) {
let deferred = Promise.defer();
function notificationCallback(e) {
Services.obs.removeObserver(notificationCallback, aObserver, false);
clearTimeout(timeoutId);
deferred.resolve();
};
let timeoutId = setTimeout(() => {
Services.obs.removeObserver(notificationCallback, aObserver, false);
deferred.reject("Notification '" + aObserver + "' did not happen within 20 seconds.");
}, kTimeoutInMS);
Services.obs.addObserver(notificationCallback, aObserver, false);
return deferred.promise;
}
function promiseTabSelect() {
let deferred = Promise.defer();
let container = window.gBrowser.tabContainer;
let timeoutId = setTimeout(() => {
container.removeEventListener("TabSelect", callback);
deferred.reject("TabSelect did not happen within 20 seconds");
}, kTimeoutInMS);
function callback(e) {
container.removeEventListener("TabSelect", callback);
clearTimeout(timeoutId);
executeSoon(deferred.resolve);
};
container.addEventListener("TabSelect", callback);
return deferred.promise;
}

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

@ -130,12 +130,18 @@ this.BrowserUITelemetry = {
init: function() { init: function() {
UITelemetry.addSimpleMeasureFunction("toolbars", UITelemetry.addSimpleMeasureFunction("toolbars",
this.getToolbarMeasures.bind(this)); this.getToolbarMeasures.bind(this));
Services.obs.addObserver(this, "sessionstore-windows-restored", false);
Services.obs.addObserver(this, "browser-delayed-startup-finished", false); Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
}, },
observe: function(aSubject, aTopic, aData) { observe: function(aSubject, aTopic, aData) {
if (aTopic == "browser-delayed-startup-finished") { switch(aTopic) {
this._registerWindow(aSubject); case "sessionstore-windows-restored":
this._gatherFirstWindowMeasurements();
break;
case "browser-delayed-startup-finished":
this._registerWindow(aSubject);
break;
} }
}, },
@ -200,16 +206,23 @@ this.BrowserUITelemetry = {
}, },
_firstWindowMeasurements: null, _firstWindowMeasurements: null,
_registerWindow: function(aWindow) { _gatherFirstWindowMeasurements: function() {
// We'll gather measurements on the first non-popup window that opens // We'll gather measurements as soon as the session has restored.
// after it has painted. We do this here instead of waiting for // We do this here instead of waiting for UITelemetry to ask for
// UITelemetry to ask for our measurements because at that point // our measurements because at that point all browser windows have
// all browser windows have probably been closed, since the vast // probably been closed, since the vast majority of saved-session
// majority of saved-session pings are gathered during shutdown. // pings are gathered during shutdown.
if (!this._firstWindowMeasurements && aWindow.toolbar.visible) { let win = RecentWindow.getMostRecentBrowserWindow({
this._firstWindowMeasurements = this._getWindowMeasurements(aWindow); private: false,
} allowPopups: false,
});
// If there are no such windows, we're out of luck. :(
this._firstWindowMeasurements = win ? this._getWindowMeasurements(win)
: {};
},
_registerWindow: function(aWindow) {
aWindow.addEventListener("unload", this); aWindow.addEventListener("unload", this);
let document = aWindow.document; let document = aWindow.document;

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

@ -1,4 +1,4 @@
%filter substitution %filter substitution
%define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #tabview-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button %define primaryToolbarButtons #back-button, #forward-button, #home-button, #print-button, #downloads-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-reset-button, #zoom-in-button, #sync-button, #feed-button, #webrtc-status-button, #social-share-button, #open-file-button, #find-button, #developer-button, #preferences-button, #privatebrowsing-button, #save-page-button, #switch-to-metro-button, #add-ons-button, #history-panelmenu, #nav-bar-overflow-button, #PanelUI-menu-button, #characterencoding-button, #email-link-button
%define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]),.overflowedItem) %define inAnyPanel :-moz-any(:not([cui-areatype="toolbar"]),.overflowedItem)

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

@ -88,6 +88,6 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" /> <data android:mimeType="text/plain" />
</intent-filter> </intent-filter>
</activity> </activity>