Merge fx-team to central, a=merge

This commit is contained in:
Wes Kocher 2016-08-15 14:49:11 -07:00
Родитель d602abb016 f806b3f7de
Коммит 03b3c20a6e
60 изменённых файлов: 608 добавлений и 366 удалений

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

@ -194,14 +194,14 @@ var FullZoom = {
this._ignorePendingZoomAccesses(browser);
if (!aURI || (aIsTabSwitch && !this.siteSpecific)) {
this._notifyOnLocationChange();
this._notifyOnLocationChange(browser);
return;
}
// Avoid the cps roundtrip and apply the default/global pref.
if (aURI.spec == "about:blank") {
this._applyPrefToZoom(undefined, browser,
this._notifyOnLocationChange.bind(this));
this._notifyOnLocationChange.bind(this, browser));
return;
}
@ -209,7 +209,7 @@ var FullZoom = {
if (!aIsTabSwitch && browser.isSyntheticDocument) {
ZoomManager.setZoomForBrowser(browser, 1);
// _ignorePendingZoomAccesses already called above, so no need here.
this._notifyOnLocationChange();
this._notifyOnLocationChange(browser);
return;
}
@ -218,7 +218,7 @@ var FullZoom = {
let pref = this._cps2.getCachedByDomainAndName(aURI.spec, this.name, ctxt);
if (pref) {
this._applyPrefToZoom(pref.value, browser,
this._notifyOnLocationChange.bind(this));
this._notifyOnLocationChange.bind(this, browser));
return;
}
@ -229,11 +229,11 @@ var FullZoom = {
handleResult: function (resultPref) { value = resultPref.value; },
handleCompletion: function () {
if (!token.isCurrent) {
this._notifyOnLocationChange();
this._notifyOnLocationChange(browser);
return;
}
this._applyPrefToZoom(value, browser,
this._notifyOnLocationChange.bind(this));
this._notifyOnLocationChange.bind(this, browser));
}.bind(this)
});
},
@ -291,7 +291,7 @@ var FullZoom = {
if (token.isCurrent) {
ZoomManager.setZoomForBrowser(browser, value === undefined ? 1 : value);
this._ignorePendingZoomAccesses(browser);
Services.obs.notifyObservers(null, "browser-fullZoom:zoomReset", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
}
});
this._removePref(browser);
@ -359,7 +359,7 @@ var FullZoom = {
* @param browser The zoom of this browser will be saved. Required.
*/
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
Services.obs.notifyObservers(null, "browser-fullZoom:zoomChange", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
if (!this.siteSpecific ||
gInPrintPreviewMode ||
browser.isSyntheticDocument)
@ -380,7 +380,7 @@ var FullZoom = {
* @param browser The zoom of this browser will be removed. Required.
*/
_removePref: function FullZoom__removePref(browser) {
Services.obs.notifyObservers(null, "browser-fullZoom:zoomReset", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
if (browser.isSyntheticDocument)
return;
let ctxt = this._loadContextFromBrowser(browser);
@ -517,9 +517,9 @@ var FullZoom = {
* The notification is always asynchronous so that observers are guaranteed a
* consistent behavior.
*/
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange() {
_notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
this._executeSoon(function () {
Services.obs.notifyObservers(null, "browser-fullZoom:location-change", "");
Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
});
},

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

@ -714,22 +714,20 @@ var gHistorySwipeAnimation = {
// The forward page should be pushed offscreen all the way to the right.
this._positionBox(this._nextBox, 1);
} else {
} else if (this._canGoForward) {
// The intention is to go forward. If there is a page to go forward to,
// it should slide in from the right (LTR) or left (RTL).
// Otherwise, the current page should slide to the left (LTR) or
// right (RTL) and the backdrop should appear in the background.
// For the backdrop to be visible in that case, the previous page needs
// to be hidden (if it exists).
if (this._canGoForward) {
this._nextBox.collapsed = false;
let offset = this.isLTR ? 1 : -1;
this._positionBox(this._curBox, 0);
this._positionBox(this._nextBox, offset + aVal);
} else {
this._prevBox.collapsed = true;
this._positionBox(this._curBox, aVal / dampValue);
}
this._nextBox.collapsed = false;
let offset = this.isLTR ? 1 : -1;
this._positionBox(this._curBox, 0);
this._positionBox(this._nextBox, offset + aVal);
} else {
this._prevBox.collapsed = true;
this._positionBox(this._curBox, aVal / dampValue);
}
},

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

@ -55,11 +55,9 @@ var TabsInTitlebar = {
delete this._disallowed[condition];
this._update(true);
}
} else {
if (!(condition in this._disallowed)) {
this._disallowed[condition] = null;
this._update(true);
}
} else if (!(condition in this._disallowed)) {
this._disallowed[condition] = null;
this._update(true);
}
},
@ -298,11 +296,11 @@ function updateTitlebarDisplay() {
}
document.documentElement.setAttribute("drawtitle", "true");
}
} else { // not OS X
if (TabsInTitlebar.enabled)
document.documentElement.setAttribute("chromemargin", "0,2,2,2");
else
document.documentElement.removeAttribute("chromemargin");
} else if (TabsInTitlebar.enabled) {
// not OS X
document.documentElement.setAttribute("chromemargin", "0,2,2,2");
} else {
document.documentElement.removeAttribute("chromemargin");
}
}

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

@ -4108,10 +4108,8 @@ function updateCharacterEncodingMenuState()
if (charsetMenu) {
charsetMenu.removeAttribute("disabled");
}
} else {
if (charsetMenu) {
charsetMenu.setAttribute("disabled", "true");
}
} else if (charsetMenu) {
charsetMenu.setAttribute("disabled", "true");
}
}
@ -7827,9 +7825,8 @@ var MousePosTracker = {
if (hover) {
if (listener.onMouseEnter)
listener.onMouseEnter();
} else {
if (listener.onMouseLeave)
listener.onMouseLeave();
} else if (listener.onMouseLeave) {
listener.onMouseLeave();
}
}
};

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

@ -782,6 +782,10 @@
class="urlbar-icon"
hidden="true"
onclick="ReaderParent.buttonClick(event);"/>
<toolbarbutton id="urlbar-zoom-button"
onclick="FullZoom.reset();"
tooltiptext="&urlbar.zoomReset.tooltip;"
hidden="true"/>
</hbox>
<hbox id="userContext-icons" hidden="true">
<label id="userContext-label"/>

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

@ -75,11 +75,9 @@ function onLoad() {
// Hide the reset button is it's not supported.
document.documentElement.getButton("extra1").hidden = true;
}
} else {
if (!ResetProfile.resetSupported()) {
// Hide the reset button and text if it's not supported.
document.documentElement.getButton("extra1").hidden = true;
document.getElementById("resetProfileInstead").hidden = true;
}
} else if (!ResetProfile.resetSupported()) {
// Hide the reset button and text if it's not supported.
document.documentElement.getButton("extra1").hidden = true;
document.getElementById("resetProfileInstead").hidden = true;
}
}

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

@ -154,9 +154,9 @@ add_task(function* searchWith() {
"Search with " + Services.search.currentEngine.name,
"Sanity check: first result's action text");
// Tab to the first one-off. Now the first result and the first one-off
// Alt+Down to the first one-off. Now the first result and the first one-off
// should both be selected.
EventUtils.synthesizeKey("VK_TAB", {})
EventUtils.synthesizeKey("VK_DOWN", { altKey: true })
assertState(0, 0, typedValue);
let engineName = gURLBar.popup.oneOffSearchButtons.selectedButton.engine.name;
@ -196,8 +196,8 @@ add_task(function* oneOffReturn() {
assertState(0, -1, typedValue);
// Tab to select the first one-off.
EventUtils.synthesizeKey("VK_TAB", {})
// Alt+Down to select the first one-off.
EventUtils.synthesizeKey("VK_DOWN", { altKey: true })
assertState(0, 0, typedValue);
let resultsPromise = promiseSearchResultsLoaded();

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

@ -1297,6 +1297,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
class="search-one-offs"
compact="true"
includecurrentengine="true"
disabletab="true"
flex="1"/>
</xul:hbox>
</content>

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

@ -4325,31 +4325,26 @@ OverflowableToolbar.prototype = {
// fire afterwards; that's ok!
}
// If it used to be overflowed...
else {
else if (!nowOverflowed) {
// ... and isn't anymore, let's remove our bookkeeping:
if (!nowOverflowed) {
this._collapsed.delete(aNode.id);
aNode.removeAttribute("cui-anchorid");
aNode.removeAttribute("overflowedItem");
CustomizableUIInternal.notifyListeners("onWidgetUnderflow", aNode, this._target);
this._collapsed.delete(aNode.id);
aNode.removeAttribute("cui-anchorid");
aNode.removeAttribute("overflowedItem");
CustomizableUIInternal.notifyListeners("onWidgetUnderflow", aNode, this._target);
if (!this._collapsed.size) {
this._toolbar.removeAttribute("overflowing");
CustomizableUI.removeListener(this);
}
if (!this._collapsed.size) {
this._toolbar.removeAttribute("overflowing");
CustomizableUI.removeListener(this);
}
} else if (aNode.previousSibling) {
// but if it still is, it must have changed places. Bookkeep:
else {
if (aNode.previousSibling) {
let prevId = aNode.previousSibling.id;
let minSize = this._collapsed.get(prevId);
this._collapsed.set(aNode.id, minSize);
} else {
// If it's now the first item in the overflow list,
// maybe we can return it:
this._moveItemsBackToTheirOrigin();
}
}
let prevId = aNode.previousSibling.id;
let minSize = this._collapsed.get(prevId);
this._collapsed.set(aNode.id, minSize);
} else {
// If it's now the first item in the overflow list,
// maybe we can return it:
this._moveItemsBackToTheirOrigin();
}
},

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

@ -61,6 +61,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
["TabGroupsMigrator", "resource:///modules/TabGroupsMigrator.jsm"],
["Task", "resource://gre/modules/Task.jsm"],
["UITour", "resource:///modules/UITour.jsm"],
["URLBarZoom", "resource:///modules/URLBarZoom.jsm"],
["WebChannel", "resource://gre/modules/WebChannel.jsm"],
["WindowsRegistry", "resource://gre/modules/WindowsRegistry.jsm"],
["webrtcUI", "resource:///modules/webrtcUI.jsm"],
@ -690,6 +691,7 @@ BrowserGlue.prototype = {
LoginManagerParent.init();
ReaderParent.init();
URLBarZoom.init();
SelfSupportBackend.init();

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

@ -481,10 +481,9 @@ PlacesViewBase.prototype = {
if (aPopup._startMarker.nextSibling != statusMenuitem)
aPopup.insertBefore(statusMenuitem, aPopup._startMarker.nextSibling);
}
else {
else if (aPopup._statusMenuitem.parentNode == aPopup) {
// The livemark has finished loading.
if (aPopup._statusMenuitem.parentNode == aPopup)
aPopup.removeChild(aPopup._statusMenuitem);
aPopup.removeChild(aPopup._statusMenuitem);
}
},

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

@ -979,9 +979,8 @@ var gEditItemOverlay = {
if (curTagIndex == -1)
tags.push(tagCheckbox.label);
}
else {
if (curTagIndex != -1)
tags.splice(curTagIndex, 1);
else if (curTagIndex != -1) {
tags.splice(curTagIndex, 1);
}
this._element("tagsField").value = tags.join(", ");
this._updateTags();

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

@ -232,13 +232,11 @@ function nextTest() {
test.run();
});
}
else {
else if (wasCollapsed) {
// Collapse the personal toolbar if needed.
if (wasCollapsed) {
promiseSetToolbarVisibility(toolbar, false).then(finish);
} else {
finish();
}
promiseSetToolbarVisibility(toolbar, false).then(finish);
} else {
finish();
}
}

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

@ -1749,7 +1749,8 @@
if (event.keyCode == KeyEvent.DOM_VK_TAB &&
!event.altKey &&
!event.ctrlKey &&
!event.metaKey) {
!event.metaKey &&
this.getAttribute("disabletab") != "true") {
stopEvent = this.advanceSelection(!event.shiftKey, false, true);
}

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

@ -267,10 +267,8 @@ var PKT_SAVED_OVERLAY = function (options)
inputwrapper.find('.pkt_ext_tag_input').tokenInput('remove',{name:selected.find('p').text()});
}
}
else {
if ($(e.target).parent().hasClass('token-input-input-token')) {
e.stopImmediatePropagation();
}
else if ($(e.target).parent().hasClass('token-input-input-token')) {
e.stopImmediatePropagation();
}
});
};

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

@ -231,6 +231,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY urlbar.openHistoryPopup.tooltip "Show history">
<!ENTITY urlbar.zoomReset.tooltip "Reset zoom level">
<!ENTITY searchItem.title "Search">
<!-- Toolbar items -->

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

@ -270,6 +270,10 @@ tabHistory.goForward=Go forward to this page
# URL Bar
pasteAndGo.label=Paste & Go
# LOCALIZATION NOTE(urlbar-zoom-button.label): %S is the current zoom level,
# %% will be displayed as a single % character (% is commonly used to define
# format specifiers, so it needs to be escaped).
urlbar-zoom-button.label = %S%%
# Block autorefresh
refreshBlocked.goButton=Allow

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

@ -716,13 +716,11 @@ PluginContent.prototype = {
overlay.addEventListener("click", this, true);
}
plugin.reload(true);
} else {
if (this.canActivatePlugin(plugin)) {
if (overlay) {
overlay.removeEventListener("click", this, true);
}
plugin.playPlugin();
} else if (this.canActivatePlugin(plugin)) {
if (overlay) {
overlay.removeEventListener("click", this, true);
}
plugin.playPlugin();
}
}
}
@ -1026,17 +1024,15 @@ PluginContent.prototype = {
.getInterface(Ci.nsIDOMWindowUtils);
let event = new this.content.CustomEvent("PluginCrashReporterDisplayed", {bubbles: true});
winUtils.dispatchEventToChromeOnly(plugin, event);
} else {
} else if (!doc.mozNoPluginCrashedNotification) {
// If another plugin on the page was large enough to show our UI, we don't
// want to show a notification bar.
if (!doc.mozNoPluginCrashedNotification) {
this.global.sendAsyncMessage("PluginContent:ShowPluginCrashedNotification",
{ messageString: message, pluginID: runID });
// Remove the notification when the page is reloaded.
doc.defaultView.top.addEventListener("unload", event => {
this.hideNotificationBar("plugin-crashed");
}, false);
}
this.global.sendAsyncMessage("PluginContent:ShowPluginCrashedNotification",
{ messageString: message, pluginID: runID });
// Remove the notification when the page is reloaded.
doc.defaultView.top.addEventListener("unload", event => {
this.hideNotificationBar("plugin-crashed");
}, false);
}
},

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

@ -0,0 +1,51 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* 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";
this.EXPORTED_SYMBOLS = [ "URLBarZoom" ];
Components.utils.import("resource://gre/modules/Services.jsm");
var URLBarZoom = {
init: function(aWindow) {
// Register ourselves with the service so we know when the zoom prefs change.
Services.obs.addObserver(updateZoomButton, "browser-fullZoom:zoomChange", false);
Services.obs.addObserver(updateZoomButton, "browser-fullZoom:zoomReset", false);
Services.obs.addObserver(updateZoomButton, "browser-fullZoom:location-change", false);
},
}
function updateZoomButton(aSubject, aTopic) {
let win = aSubject.ownerDocument.defaultView;
let customizableZoomControls = win.document.getElementById("zoom-controls");
let zoomResetButton = win.document.getElementById("urlbar-zoom-button");
let zoomFactor = Math.round(win.ZoomManager.zoom * 100);
// Ensure that zoom controls haven't already been added to browser in Customize Mode
if (customizableZoomControls &&
customizableZoomControls.getAttribute("cui-areatype") == "toolbar") {
zoomResetButton.hidden = true;
return;
}
if (zoomFactor != 100) {
// Check if zoom button is visible and update label if it is
if (zoomResetButton.hidden) {
zoomResetButton.hidden = false;
}
// Only allow pulse animation for zoom changes, not tab switching
if (aTopic != "browser-fullZoom:location-change") {
zoomResetButton.setAttribute("animate", "true");
} else {
zoomResetButton.removeAttribute("animate");
}
zoomResetButton.setAttribute("label",
win.gNavigatorBundle.getFormattedString("urlbar-zoom-button.label", [zoomFactor]));
// Hide button if zoom is at 100%
} else {
zoomResetButton.hidden = true;
}
}

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

@ -45,6 +45,7 @@ EXTRA_JS_MODULES += [
'Social.jsm',
'TabGroupsMigrator.jsm',
'TransientPrefs.jsm',
'URLBarZoom.jsm',
'webrtcUI.jsm',
]

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

@ -24,3 +24,4 @@ support-files =
[browser_taskbar_preview.js]
skip-if = os != "win"
[browser_UsageTelemetry.js]
[browser_urlBar_zoom.js]

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

@ -0,0 +1,73 @@
/* 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";
var initialPageZoom = ZoomManager.zoom;
const kTimeoutInMS = 20000;
add_task(function* () {
info("Confirm whether the browser zoom is set to the default level");
is(initialPageZoom, 1, "Page zoom is set to default (100%)");
let zoomResetButton = document.getElementById("urlbar-zoom-button");
is(zoomResetButton.hidden, true, "Zoom reset button is currently hidden");
info("Change zoom and confirm zoom button appears");
let labelUpdatePromise = BrowserTestUtils.waitForAttribute("label", zoomResetButton);
FullZoom.enlarge();
yield labelUpdatePromise;
info("Zoom increased to " + Math.floor(ZoomManager.zoom * 100) + "%");
is(zoomResetButton.hidden, false, "Zoom reset button is now visible");
let pageZoomLevel = Math.floor(ZoomManager.zoom * 100);
let expectedZoomLevel = 110;
let buttonZoomLevel = parseInt(zoomResetButton.getAttribute("label"), 10);
is(buttonZoomLevel, expectedZoomLevel, ("Button label updated successfully to " + Math.floor(ZoomManager.zoom * 100) + "%"));
let zoomResetPromise = promiseObserverNotification("browser-fullZoom:zoomReset");
zoomResetButton.click();
yield zoomResetPromise;
pageZoomLevel = Math.floor(ZoomManager.zoom * 100);
expectedZoomLevel = 100;
is(pageZoomLevel, expectedZoomLevel, "Clicking zoom button successfully resets browser zoom to 100%");
is(zoomResetButton.hidden, true, "Zoom reset button returns to being hidden");
});
add_task(function* () {
info("Confirm that URL bar zoom button doesn't appear when customizable zoom widget is added to toolbar");
CustomizableUI.addWidgetToArea("zoom-controls", CustomizableUI.AREA_NAVBAR);
let zoomCustomizableWidget = document.getElementById("zoom-reset-button");
let zoomResetButton = document.getElementById("urlbar-zoom-button");
let zoomChangePromise = promiseObserverNotification("browser-fullZoom:zoomChange");
FullZoom.enlarge();
yield zoomChangePromise;
is(zoomResetButton.hidden, true, "URL zoom button remains hidden despite zoom increase");
is(parseInt(zoomCustomizableWidget.label, 10), 110, "Customizable zoom widget's label has updated to " + zoomCustomizableWidget.label);
});
add_task(function* asyncCleanup() {
// reset zoom level and customizable widget
ZoomManager.zoom = initialPageZoom;
is(ZoomManager.zoom, 1, "Zoom level was restored");
if (document.getElementById("zoom-controls")) {
CustomizableUI.removeWidgetFromArea("zoom-controls", CustomizableUI.AREA_NAVBAR);
ok(!document.getElementById("zoom-controls"),"Customizable zoom widget removed from toolbar");
}
});
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;
}

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

@ -954,6 +954,43 @@ toolbaritem[cui-areatype="menu-panel"] > :-moz-any(@nestedButtons@) > .toolbarbu
height: 16px;
}
/* ::::: URL Bar Zoom Reset Button ::::: */
@keyframes urlbar-zoom-reset-pulse {
0% {
transform: scale(0);
}
100% {
transform: scale(1.5);
}
}
#urlbar-zoom-button {
-moz-appearance: none;
margin: 0 3px;
font-size: .8em;
padding: 0 8px;
border-radius: 1em;
background-color: hsla(0,0%,0%,.05);
border: 1px solid ThreeDLightShadow;
}
#urlbar-zoom-button[animate="true"] {
animation-name: urlbar-zoom-reset-pulse;
animation-duration: 250ms;
}
#urlbar-zoom-button:hover:active {
background-color: hsla(0,0%,0%,.1);
}
#urlbar-zoom-button > .toolbarbutton-text {
display: -moz-box;
}
#urlbar-zoom-button > .toolbarbutton-icon {
display: none;
}
#urlbar-search-footer {
border-top: 1px solid var(--panel-separator-color);
background-color: hsla(210,4%,10%,.07);

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

@ -1662,6 +1662,41 @@ toolbar .toolbarbutton-1 > .toolbarbutton-menubutton-button {
height: 16px;
}
/* ::::: URL Bar Zoom Reset Button ::::: */
@keyframes urlbar-zoom-reset-pulse {
0% {
transform: scale(0);
}
100% {
transform: scale(1.5);
}
}
#urlbar-zoom-button {
margin: 0 3px;
font-size: .8em;
padding: 0 8px;
border-radius: 1em;
background-color: hsla(0,0%,0%,.05);
border: 1px solid hsla(0,0%,0%,.1);
}
#urlbar-zoom-button[animate="true"] {
animation-name: urlbar-zoom-reset-pulse;
animation-duration: 250ms;
}
#urlbar-zoom-button:hover:active {
background-color: hsla(0,0%,0%,.1);
}
#urlbar-zoom-button > .toolbarbutton-text {
display: -moz-box;
}
#urlbar-zoom-button > .toolbarbutton-icon {
display: none;
}
#urlbar-search-footer {
border-top: 1px solid var(--panel-separator-color);
background-color: hsla(210,4%,10%,.07);

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

@ -1386,6 +1386,43 @@ html|*.urlbar-input:-moz-lwtheme::-moz-placeholder,
height: 16px;
}
/* ::::: URL Bar Zoom Reset Button ::::: */
@keyframes urlbar-zoom-reset-pulse {
0% {
transform: scale(0);
}
100% {
transform: scale(1.5);
}
}
#urlbar-zoom-button {
-moz-appearance: none;
margin: 0 3px;
font-size: .8em;
padding: 0 8px;
border-radius: 1em;
background-color: hsla(0,0%,0%,.05);
border: 1px solid ThreeDLightShadow;
}
#urlbar-zoom-button[animate="true"] {
animation-name: urlbar-zoom-reset-pulse;
animation-duration: 250ms;
}
#urlbar-zoom-button:hover:active {
background-color: hsla(0,0%,0%,.1);
}
#urlbar-zoom-button > .toolbarbutton-text {
display: -moz-box;
}
#urlbar-zoom-button > .toolbarbutton-icon {
display: none;
}
.search-go-container {
padding: 2px 2px;
}

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

@ -466,7 +466,8 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
initialize: function () {
dumpn("Initializing the RequestsMenuView");
this.widget = new SideMenuWidget($("#requests-menu-contents"));
let widgetParentEl = $("#requests-menu-contents");
this.widget = new SideMenuWidget(widgetParentEl);
this._splitter = $("#network-inspector-view-splitter");
this._summary = $("#requests-menu-network-summary-button");
this._summary.setAttribute("label", L10N.getStr("networkMenu.empty"));
@ -475,7 +476,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, {
// Create a tooltip for the newly appended network request item.
this.tooltip = new HTMLTooltip(NetMonitorController._toolbox, { type: "arrow" });
this.tooltip.startTogglingOnHover(this.widget, this._onHover, {
this.tooltip.startTogglingOnHover(widgetParentEl, this._onHover, {
toggleDelay: REQUESTS_TOOLTIP_TOGGLE_DELAY,
interactive: true
});

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

@ -38,6 +38,12 @@ add_task(function* test() {
info("Checking the image thumbnail after a reload.");
yield showTooltipAndVerify(RequestsMenu.tooltip, RequestsMenu.items[6]);
info("Checking if the image thumbnail is hidden when mouse leaves the menu widget");
let requestsMenuEl = $("#requests-menu-contents");
let onHidden = RequestsMenu.tooltip.once("hidden");
EventUtils.synthesizeMouse(requestsMenuEl, 0, 0, {type: "mouseout"}, monitor.panelWin);
yield onHidden;
yield teardown(monitor);
finish();

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

@ -121,6 +121,7 @@ skip-if = e10s # Bug 1221911, bug 1222289, frequent e10s timeouts
[browser_html_tooltip_arrow-01.js]
[browser_html_tooltip_arrow-02.js]
[browser_html_tooltip_consecutive-show.js]
[browser_html_tooltip_hover.js]
[browser_html_tooltip_offset.js]
[browser_html_tooltip_rtl.js]
[browser_html_tooltip_variable-height.js]

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

@ -0,0 +1,63 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/* import-globals-from helper_html_tooltip.js */
"use strict";
/**
* Test the TooltipToggle helper class for HTMLTooltip
*/
const HTML_NS = "http://www.w3.org/1999/xhtml";
const TEST_URI = `data:text/xml;charset=UTF-8,<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="chrome://devtools/skin/variables.css"?>
<?xml-stylesheet href="chrome://devtools/skin/tooltips.css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="theme-light" title="Tooltip hover test">
<vbox id="container" flex="1">
<hbox id="box1" flex="1"><label>test1</label></hbox>
<hbox id="box2" flex="1"><label>test2</label></hbox>
<hbox id="box3" flex="1"><label>test3</label></hbox>
<hbox id="box4" flex="1"><label>test4</label></hbox>
</vbox>
</window>`;
const {HTMLTooltip} = require("devtools/client/shared/widgets/HTMLTooltip");
loadHelperScript("helper_html_tooltip.js");
add_task(function* () {
let [,, doc] = yield createHost("bottom", TEST_URI);
let width = 100, height = 50;
let tooltipContent = doc.createElementNS(HTML_NS, "div");
tooltipContent.textContent = "tooltip";
let tooltip = new HTMLTooltip({doc}, {useXulWrapper: false});
tooltip.setContent(tooltipContent, {width, height});
let container = doc.getElementById("container");
tooltip.startTogglingOnHover(container, () => true);
info("Hover on each of the 4 boxes, expect the tooltip to appear");
function* showAndCheck(boxId, position) {
info(`Show tooltip on ${boxId}`);
let box = doc.getElementById(boxId);
let shown = tooltip.once("shown");
EventUtils.synthesizeMouseAtCenter(box, { type: "mousemove" }, doc.defaultView);
yield shown;
checkTooltipGeometry(tooltip, box, {position, width, height});
}
yield showAndCheck("box1", "bottom");
yield showAndCheck("box2", "bottom");
yield showAndCheck("box3", "top");
yield showAndCheck("box4", "top");
info("Move out of the container");
let hidden = tooltip.once("hidden");
EventUtils.synthesizeMouseAtCenter(container, { type: "mouseout" }, doc.defaultView);
yield hidden;
info("Destroy the tooltip and finish");
tooltip.destroy();
});

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

@ -80,7 +80,7 @@
"no-empty-pattern": 2,
// No assiging to exception variable
// "no-ex-assign": 2,
"no-ex-assign": 2,
// No using !! where casting to boolean is already happening
// "no-extra-boolean-cast": 2,
@ -98,7 +98,7 @@
"no-irregular-whitespace": 2,
// No single if block inside an else block
// "no-lonely-if": 2,
"no-lonely-if": 2,
// No mixing spaces and tabs in indent
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],

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

@ -256,10 +256,8 @@ function onAlertBeforeUnload() {
if (alertWindow.screenY > window.screenY) {
alertWindow.moveTo(alertWindow.screenX, alertWindow.screenY - heightDelta);
}
} else {
if (window.screenY > alertWindow.screenY) {
alertWindow.moveTo(alertWindow.screenX, alertWindow.screenY + heightDelta);
}
} else if (window.screenY > alertWindow.screenY) {
alertWindow.moveTo(alertWindow.screenX, alertWindow.screenY + heightDelta);
}
}
}

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

@ -775,10 +775,9 @@ function processPath(path)
}
++curFileStart;
}
} else {
} else if (!processPathEntry(path, fileArray)) {
// If we didn't start with a quote, assume we just have a single file.
if (!processPathEntry(path, fileArray))
return false;
return false;
}
return fileArray;

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

@ -509,7 +509,12 @@ this.Download.prototype = {
this.progress = 100;
this.succeeded = true;
this.hasPartialData = false;
} catch (ex) {
} catch (originalEx) {
// We may choose a different exception to propagate in the code below,
// or wrap the original one. We do this mutation in a different variable
// because of the "no-ex-assign" ESLint rule.
let ex = originalEx;
// Fail with a generic status code on cancellation, so that the caller
// is forced to actually check the status properties to see if the
// download was canceled or failed because of other reasons.

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

@ -1211,10 +1211,8 @@ var Microformats; // jshint ignore:line
if (out.properties.indexOf(propName) === -1) {
out.properties.push([propName,'v1']);
}
} else {
if (out.properties.indexOf(propName) === -1) {
out.properties.push([propName,'v1']);
}
} else if (out.properties.indexOf(propName) === -1) {
out.properties.push([propName,'v1']);
}
}
}
@ -3403,12 +3401,10 @@ var Microformats; // jshint ignore:line
// time zone offset
if (this.z) {
out += this.tzZulu;
} else {
if (this.tzH && this.tzH > -1 && this.tzH < 25) {
out += this.tzPN + this.tzH;
if (this.tzM > -1 && this.tzM < 61) {
out += this.tzsep + this.tzM;
}
} else if (this.tzH && this.tzH > -1 && this.tzH < 25) {
out += this.tzPN + this.tzH;
if (this.tzM > -1 && this.tzM < 61) {
out += this.tzsep + this.tzM;
}
}
}

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

@ -127,14 +127,12 @@ this.InsecurePasswordUtils = {
} else {
passwordSafety = 2;
}
} else if (isFormSubmitSecure) {
passwordSafety = 3;
} else if (isFormSubmitHTTP) {
passwordSafety = 4;
} else {
if (isFormSubmitSecure) {
passwordSafety = 3;
} else if (isFormSubmitHTTP) {
passwordSafety = 4;
} else {
passwordSafety = 5;
}
passwordSafety = 5;
}
Services.telemetry.getHistogramById("PWMGR_LOGIN_PAGE_SAFETY").add(passwordSafety);

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

@ -387,17 +387,15 @@ var LoginManagerContent = {
// We update the FormLike so it (most important .elements) is fresh when the task eventually
// runs since changes to the elements could affect our field heuristics.
this._formLikeByRootElement.set(formLike.rootElement, formLike);
} else if (window.document.readyState == "complete") {
log("Arming the DeferredTask we just created since document.readyState == 'complete'");
deferredTask.arm();
} else {
if (window.document.readyState == "complete") {
log("Arming the DeferredTask we just created since document.readyState == 'complete'");
window.addEventListener("DOMContentLoaded", function armPasswordAddedTask() {
window.removeEventListener("DOMContentLoaded", armPasswordAddedTask);
log("Arming the onDOMInputPasswordAdded DeferredTask due to DOMContentLoaded");
deferredTask.arm();
} else {
window.addEventListener("DOMContentLoaded", function armPasswordAddedTask() {
window.removeEventListener("DOMContentLoaded", armPasswordAddedTask);
log("Arming the onDOMInputPasswordAdded DeferredTask due to DOMContentLoaded");
deferredTask.arm();
});
}
});
}
},
@ -787,16 +785,15 @@ var LoginManagerContent = {
log("(form ignored -- all 3 pw fields differ)");
return [null, null, null];
}
} else { // pwFields.length == 2
if (pw1 == pw2) {
// Treat as if 1 pw field
newPasswordField = pwFields[0].element;
oldPasswordField = null;
} else {
// Just assume that the 2nd password is the new password
oldPasswordField = pwFields[0].element;
newPasswordField = pwFields[1].element;
}
} else if (pw1 == pw2) {
// pwFields.length == 2
// Treat as if 1 pw field
newPasswordField = pwFields[0].element;
oldPasswordField = null;
} else {
// Just assume that the 2nd password is the new password
oldPasswordField = pwFields[0].element;
newPasswordField = pwFields[1].element;
}
log("Password field (new) id/name is: ", newPasswordField.id, " / ", newPasswordField.name);

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

@ -182,13 +182,11 @@ this.AddonWatcher = {
// Wait a little before displaying another one.
continue;
}
} else {
} else if (now - alerts.latestNotificationTimeStamp <= delayBetweenFreezeAlerts) {
// Even in case of freeze, we want to avoid needlessly spamming the user.
if (now - alerts.latestNotificationTimeStamp <= delayBetweenFreezeAlerts) {
// We have already displayed an alert for this add-on recently.
// Wait a little before displaying another one.
continue;
}
// We have already displayed an alert for this add-on recently.
// Wait a little before displaying another one.
continue;
}
// Ok, time to inform the user.

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

@ -22,12 +22,10 @@ function checkDouble(element, maxVal)
value = value.replace(/[^\.|^0-9]/g,"");
if (!value) {
element.value = "";
} else if (value > maxVal) {
element.value = maxVal;
} else {
if (value > maxVal) {
element.value = maxVal;
} else {
element.value = value;
}
element.value = value;
}
}
}

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

@ -241,20 +241,17 @@ CommonDialog.prototype = {
this.ui.infoBody.focus();
else
button.focus();
} else {
} else if (this.args.promptType == "promptPassword") {
// When the prompt is initialized, focus and select the textbox
// contents. Afterwards, only focus the textbox.
if (this.args.promptType == "promptPassword") {
if (isInitialLoad)
this.ui.password1Textbox.select();
else
this.ui.password1Textbox.focus();
} else {
if (isInitialLoad)
this.ui.loginTextbox.select();
else
this.ui.loginTextbox.focus();
}
if (isInitialLoad)
this.ui.password1Textbox.select();
else
this.ui.password1Textbox.focus();
} else if (isInitialLoad) {
this.ui.loginTextbox.select();
} else {
this.ui.loginTextbox.focus();
}
},

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

@ -423,11 +423,9 @@ function dbCreateAsyncStatement(aQuery, aParams, aBindingArrays) {
}
bindingArray.addParams(bindingParams);
}
} else {
if (aParams) {
for (let field in aParams) {
stmt.params[field] = aParams[field];
}
} else if (aParams) {
for (let field in aParams) {
stmt.params[field] = aParams[field];
}
}

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

@ -271,9 +271,8 @@ TimerManager.prototype = {
this._timer.initWithCallback(this, interval,
Ci.nsITimer.TYPE_REPEATING_SLACK);
this.lastTimerReset = Date.now();
} else {
if (Date.now() + interval < this.lastTimerReset + this._timer.delay)
this._timer.delay = Math.max(this.lastTimerReset + interval - Date.now(), 0);
} else if (Date.now() + interval < this.lastTimerReset + this._timer.delay) {
this._timer.delay = Math.max(this.lastTimerReset + interval - Date.now(), 0);
}
},

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

@ -189,10 +189,8 @@ ViewSourceBrowser.prototype = {
// If we're dealing with a remote browser, then the browser
// for view source needs to be remote as well.
this.updateBrowserRemoteness(browser.isRemoteBrowser);
} else {
if (outerWindowID) {
throw new Error("Must supply the browser if passing the outerWindowID");
}
} else if (outerWindowID) {
throw new Error("Must supply the browser if passing the outerWindowID");
}
this.sendAsyncMessage("ViewSource:LoadSource",

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

@ -648,21 +648,19 @@ var ViewSourceContent = {
break;
}
} else {
if (curLine == lineNumber && !("range" in result)) {
result.range = content.document.createRange();
result.range.setStart(textNode, curPos);
} else if (curLine == lineNumber && !("range" in result)) {
result.range = content.document.createRange();
result.range.setStart(textNode, curPos);
// This will always be overridden later, except when we look for
// the very last line in the file (this is the only line that does
// not end with \n).
result.range.setEndAfter(pre.lastChild);
// This will always be overridden later, except when we look for
// the very last line in the file (this is the only line that does
// not end with \n).
result.range.setEndAfter(pre.lastChild);
} else if (curLine == lineNumber + 1) {
result.range.setEnd(textNode, curPos - 1);
found = true;
break;
}
} else if (curLine == lineNumber + 1) {
result.range.setEnd(textNode, curPos - 1);
found = true;
break;
}
}
}

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

@ -59,17 +59,15 @@ function check_autoplay_audio_pause_state(expectedPauseState) {
} else {
ok(true, "Audio is resumed correctly.");
}
} else if (expectedPauseState) {
autoPlay.onpause = function () {
autoPlay.onpause = null;
ok(true, "Audio is paused correctly, checking from onpause.");
}
} else {
if (expectedPauseState) {
autoPlay.onpause = function () {
autoPlay.onpause = null;
ok(true, "Audio is paused correctly, checking from onpause.");
}
} else {
autoPlay.onplay = function () {
autoPlay.onplay = null;
ok(true, "Audio is resumed correctly, checking from onplay.");
}
autoPlay.onplay = function () {
autoPlay.onplay = null;
ok(true, "Audio is resumed correctly, checking from onplay.");
}
}
}

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

@ -785,13 +785,10 @@ TileManager.Tile.prototype = {
else
this._dirtyTileCanvasRect.copyFrom(this.boundRect);
} else {
if (!this._dirtyTileCanvasRect)
this._dirtyTileCanvasRect = dirtyRect.intersect(this.boundRect);
else if (dirtyRect.intersects(this.boundRect))
this._dirtyTileCanvasRect.expandToContain(dirtyRect.intersect(this.boundRect));
} else if (!this._dirtyTileCanvasRect) {
this._dirtyTileCanvasRect = dirtyRect.intersect(this.boundRect);
} else if (dirtyRect.intersects(this.boundRect)) {
this._dirtyTileCanvasRect.expandToContain(dirtyRect.intersect(this.boundRect));
}
// TODO if after the above, the dirty rectangle is large enough,

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

@ -27,13 +27,11 @@
<setter><![CDATA[
if (this.boxObject instanceof MenuBoxObject) {
this.boxObject.openMenu(val);
} else {
} else if (val) {
// Fall back to just setting the attribute
if (val) {
this.setAttribute('open', 'true');
} else {
this.removeAttribute('open');
}
this.setAttribute('open', 'true');
} else {
this.removeAttribute('open');
}
return val;
]]></setter>
@ -292,11 +290,9 @@
this.buttondown = false;
this._pendingActive = true;
}
else {
if (this._pendingActive) {
this.buttondown = true;
this._pendingActive = false;
}
else if (this._pendingActive) {
this.buttondown = true;
this._pendingActive = false;
}
if (v)

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

@ -26,12 +26,10 @@
if (cs.direction == "rtl") {
this.setAttribute("rtl", "true");
}
} else {
} else if (cs.writingMode.endsWith("-rl")) {
// writing-modes 'vertical-rl' and 'sideways-rl' want rtl resizers,
// as they will appear at the bottom left of the element
if (cs.writingMode.endsWith("-rl")) {
this.setAttribute("rtl", "true");
}
this.setAttribute("rtl", "true");
}
]]>
</constructor>

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

@ -605,9 +605,9 @@
if (event.detail == 1)
return;
}
else { // horizontal scrollbox
if (event.detail == 0)
return;
else if (event.detail == 0) {
// horizontal scrollbox
return;
}
this.setAttribute("notoverflowing", "true");
@ -640,9 +640,9 @@
if (event.detail == 1)
return;
}
else { // horizontal scrollbox
if (event.detail == 0)
return;
else if (event.detail == 0) {
// horizontal scrollbox
return;
}
this.removeAttribute("notoverflowing");

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

@ -539,11 +539,9 @@
}
i = i > edge ? edge : i;
} else {
if (c <= i) {
i = c <= p ? 0 : c - p;
this.treeBoxObject.ensureRowIsVisible(i);
}
} else if (c <= i) {
i = c <= p ? 0 : c - p;
this.treeBoxObject.ensureRowIsVisible(i);
}
this.view.selection.timedSelect(i, this._selectDelay);
]]>

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

@ -130,10 +130,8 @@ RokuApp.prototype = {
if (callback) {
callback(new RemoteMedia(this.resourceURL, listener));
}
} else {
if (callback) {
callback();
}
} else if (callback) {
callback();
}
}
}

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

@ -102,12 +102,10 @@ function checkObjects(expected, actual) {
do_check_neq(actual[key], undefined);
if (expected[key] instanceof RegExp) {
do_check_true(expected[key].test(actual[key].toString()));
} else if (expected[key] instanceof Object) {
checkObjects(expected[key], actual[key]);
} else {
if (expected[key] instanceof Object) {
checkObjects(expected[key], actual[key]);
} else {
do_check_eq(expected[key], actual[key]);
}
do_check_eq(expected[key], actual[key]);
}
}

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

@ -186,11 +186,10 @@ DownloadLastDir.prototype = {
gDownloadLastDirFile = aFile.clone();
else
gDownloadLastDirFile = null;
} else {
if (aFile instanceof Components.interfaces.nsIFile)
Services.prefs.setComplexValue(LAST_DIR_PREF, nsIFile, aFile);
else if (Services.prefs.prefHasUserValue(LAST_DIR_PREF))
Services.prefs.clearUserPref(LAST_DIR_PREF);
} else if (aFile instanceof Components.interfaces.nsIFile) {
Services.prefs.setComplexValue(LAST_DIR_PREF, nsIFile, aFile);
} else if (Services.prefs.prefHasUserValue(LAST_DIR_PREF)) {
Services.prefs.clearUserPref(LAST_DIR_PREF);
}
}
};

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

@ -482,16 +482,14 @@ this.DownloadUtils = {
// Don't try to format Infinity values using NumberFormat.
if (aBytes === Infinity) {
aBytes = "Infinity";
} else if (typeof Intl != "undefined") {
aBytes = getLocaleNumberFormat(fractionDigits)
.format(aBytes);
} else {
if (typeof Intl != "undefined") {
aBytes = getLocaleNumberFormat(fractionDigits)
.format(aBytes);
} else {
// FIXME: Fall back to the old hack, will be fixed in bug 1200494.
aBytes = aBytes.toFixed(fractionDigits);
if (gDecimalSymbol != ".") {
aBytes = aBytes.replace(".", gDecimalSymbol);
}
// FIXME: Fall back to the old hack, will be fixed in bug 1200494.
aBytes = aBytes.toFixed(fractionDigits);
if (gDecimalSymbol != ".") {
aBytes = aBytes.replace(".", gDecimalSymbol);
}
}

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

@ -365,12 +365,10 @@ this.LightweightThemeManager = {
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
new AddonWrapper(this.getUsedTheme(next)));
}
else {
if (id == current.id) {
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
new AddonWrapper(current));
return;
}
else if (id == current.id) {
AddonManagerPrivate.callAddonListeners("onOperationCancelled",
new AddonWrapper(current));
return;
}
}
catch (e) {

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

@ -480,9 +480,8 @@ var gEventManager = {
: addonItem.mAddon.version);
}
}
else {
if (shouldShowVersionNumber(addonItem.mInstall))
tiptext += " " + addonItem.mInstall.version;
else if (shouldShowVersionNumber(addonItem.mInstall)) {
tiptext += " " + addonItem.mInstall.version;
}
addonTooltip.label = tiptext;
@ -677,11 +676,10 @@ var gViewController = {
gHistory.back();
else
gViewController.replaceView(gViewDefault);
} else if (gHistory.canGoForward) {
gHistory.forward();
} else {
if (gHistory.canGoForward)
gHistory.forward();
else
gViewController.replaceView(gViewDefault);
gViewController.replaceView(gViewDefault);
}
}
},

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

@ -6100,13 +6100,13 @@ AddonInstall.prototype = {
this.downloadFailed(error, message);
});
}
else if (aRequest instanceof Ci.nsIHttpChannel) {
this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE,
aRequest.responseStatus + " " +
aRequest.responseStatusText);
}
else {
if (aRequest instanceof Ci.nsIHttpChannel)
this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE,
aRequest.responseStatus + " " +
aRequest.responseStatusText);
else
this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE, aStatus);
this.downloadFailed(AddonManager.ERROR_NETWORK_FAILURE, aStatus);
}
}
else {
@ -7544,10 +7544,9 @@ AddonWrapper.prototype = {
XPIProvider.updateAddonDisabledState(addon, undefined, val);
}
}
else {
else if (!addon.userDisabled) {
// Only set softDisabled if not already disabled
if (!addon.userDisabled)
addon.softDisabled = val;
addon.softDisabled = val;
}
return val;

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

@ -105,9 +105,8 @@ function do_check_item(aItem, aVersion, aAddonsEntry) {
do_throw("Addon " + aAddonsEntry.id + " wasn't detected");
if (aItem.version != aVersion)
do_throw("Addon " + aAddonsEntry.id + " was version " + aItem.version + " instead of " + aVersion);
} else {
if (aItem != null)
do_throw("Addon " + aAddonsEntry.id + " was detected");
} else if (aItem != null) {
do_throw("Addon " + aAddonsEntry.id + " was detected");
}
}

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

@ -417,10 +417,9 @@ function* verify_state(initialState, finalState = undefined) {
if (finalState == undefined) {
finalState = initialState;
}
else {
else if (finalState[0]) {
// If the new state is using the profile then that directory will exist.
if (finalState[0])
expectedDirs++;
expectedDirs++;
}
do_print("Checking final state.");

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

@ -4211,69 +4211,67 @@ Downloader.prototype = {
// Destroy the updates directory, since we're done with it.
cleanUpUpdatesDir();
}
} else {
if (status == Cr.NS_ERROR_OFFLINE) {
// Register an online observer to try again.
// The online observer will continue the incremental download by
// calling downloadUpdate on the active update which continues
// downloading the file from where it was.
LOG("Downloader:onStopRequest - offline, register online observer: true");
AUSTLMY.pingDownloadCode(this.isCompleteUpdate,
AUSTLMY.DWNLD_RETRY_OFFLINE);
shouldRegisterOnlineObserver = true;
deleteActiveUpdate = false;
// Each of NS_ERROR_NET_TIMEOUT, ERROR_CONNECTION_REFUSED,
// NS_ERROR_NET_RESET and NS_ERROR_DOCUMENT_NOT_CACHED can be returned
// when disconnecting the internet while a download of a MAR is in
// progress. There may be others but I have not encountered them during
// testing.
} else if ((status == Cr.NS_ERROR_NET_TIMEOUT ||
status == Cr.NS_ERROR_CONNECTION_REFUSED ||
status == Cr.NS_ERROR_NET_RESET ||
status == Cr.NS_ERROR_DOCUMENT_NOT_CACHED) &&
this.updateService._consecutiveSocketErrors < maxFail) {
LOG("Downloader:onStopRequest - socket error, shouldRetrySoon: true");
let dwnldCode = AUSTLMY.DWNLD_RETRY_CONNECTION_REFUSED;
if (status == Cr.NS_ERROR_NET_TIMEOUT) {
dwnldCode = AUSTLMY.DWNLD_RETRY_NET_TIMEOUT;
} else if (status == Cr.NS_ERROR_NET_RESET) {
dwnldCode = AUSTLMY.DWNLD_RETRY_NET_RESET;
} else if (status == Cr.NS_ERROR_DOCUMENT_NOT_CACHED) {
dwnldCode = AUSTLMY.DWNLD_ERR_DOCUMENT_NOT_CACHED;
}
AUSTLMY.pingDownloadCode(this.isCompleteUpdate, dwnldCode);
shouldRetrySoon = true;
deleteActiveUpdate = false;
} else if (status != Cr.NS_BINDING_ABORTED &&
status != Cr.NS_ERROR_ABORT) {
LOG("Downloader:onStopRequest - non-verification failure");
let dwnldCode = AUSTLMY.DWNLD_ERR_BINDING_ABORTED;
if (status == Cr.NS_ERROR_ABORT) {
dwnldCode = AUSTLMY.DWNLD_ERR_ABORT;
}
AUSTLMY.pingDownloadCode(this.isCompleteUpdate, dwnldCode);
// Some sort of other failure, log this in the |statusText| property
state = STATE_DOWNLOAD_FAILED;
// XXXben - if |request| (The Incremental Download) provided a means
// for accessing the http channel we could do more here.
this._update.statusText = getStatusTextFromCode(status,
Cr.NS_BINDING_FAILED);
if (AppConstants.platform == "gonk") {
// bug891009: On FirefoxOS, manaully retry OTA download will reuse
// the Update object. We need to remove selected patch so that download
// can be triggered again successfully.
this._update.selectedPatch.selected = false;
}
// Destroy the updates directory, since we're done with it.
cleanUpUpdatesDir();
deleteActiveUpdate = true;
} else if (status == Cr.NS_ERROR_OFFLINE) {
// Register an online observer to try again.
// The online observer will continue the incremental download by
// calling downloadUpdate on the active update which continues
// downloading the file from where it was.
LOG("Downloader:onStopRequest - offline, register online observer: true");
AUSTLMY.pingDownloadCode(this.isCompleteUpdate,
AUSTLMY.DWNLD_RETRY_OFFLINE);
shouldRegisterOnlineObserver = true;
deleteActiveUpdate = false;
// Each of NS_ERROR_NET_TIMEOUT, ERROR_CONNECTION_REFUSED,
// NS_ERROR_NET_RESET and NS_ERROR_DOCUMENT_NOT_CACHED can be returned
// when disconnecting the internet while a download of a MAR is in
// progress. There may be others but I have not encountered them during
// testing.
} else if ((status == Cr.NS_ERROR_NET_TIMEOUT ||
status == Cr.NS_ERROR_CONNECTION_REFUSED ||
status == Cr.NS_ERROR_NET_RESET ||
status == Cr.NS_ERROR_DOCUMENT_NOT_CACHED) &&
this.updateService._consecutiveSocketErrors < maxFail) {
LOG("Downloader:onStopRequest - socket error, shouldRetrySoon: true");
let dwnldCode = AUSTLMY.DWNLD_RETRY_CONNECTION_REFUSED;
if (status == Cr.NS_ERROR_NET_TIMEOUT) {
dwnldCode = AUSTLMY.DWNLD_RETRY_NET_TIMEOUT;
} else if (status == Cr.NS_ERROR_NET_RESET) {
dwnldCode = AUSTLMY.DWNLD_RETRY_NET_RESET;
} else if (status == Cr.NS_ERROR_DOCUMENT_NOT_CACHED) {
dwnldCode = AUSTLMY.DWNLD_ERR_DOCUMENT_NOT_CACHED;
}
AUSTLMY.pingDownloadCode(this.isCompleteUpdate, dwnldCode);
shouldRetrySoon = true;
deleteActiveUpdate = false;
} else if (status != Cr.NS_BINDING_ABORTED &&
status != Cr.NS_ERROR_ABORT) {
LOG("Downloader:onStopRequest - non-verification failure");
let dwnldCode = AUSTLMY.DWNLD_ERR_BINDING_ABORTED;
if (status == Cr.NS_ERROR_ABORT) {
dwnldCode = AUSTLMY.DWNLD_ERR_ABORT;
}
AUSTLMY.pingDownloadCode(this.isCompleteUpdate, dwnldCode);
// Some sort of other failure, log this in the |statusText| property
state = STATE_DOWNLOAD_FAILED;
// XXXben - if |request| (The Incremental Download) provided a means
// for accessing the http channel we could do more here.
this._update.statusText = getStatusTextFromCode(status,
Cr.NS_BINDING_FAILED);
if (AppConstants.platform == "gonk") {
// bug891009: On FirefoxOS, manaully retry OTA download will reuse
// the Update object. We need to remove selected patch so that download
// can be triggered again successfully.
this._update.selectedPatch.selected = false;
}
// Destroy the updates directory, since we're done with it.
cleanUpUpdatesDir();
deleteActiveUpdate = true;
}
LOG("Downloader:onStopRequest - setting state to: " + state);
this._patch.state = state;
@ -4283,10 +4281,8 @@ Downloader.prototype = {
this._update.installDate = (new Date()).getTime();
um.activeUpdate = null;
}
else {
if (um.activeUpdate) {
um.activeUpdate.state = state;
}
else if (um.activeUpdate) {
um.activeUpdate.state = state;
}
um.saveUpdates();

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

@ -4325,15 +4325,13 @@ function resetEnvironment() {
debugDump("removing DYLD_LIBRARY_PATH environment variable");
gEnv.set("DYLD_LIBRARY_PATH", "");
}
} else {
if (gEnvLdLibraryPath) {
debugDump("setting LD_LIBRARY_PATH environment variable value back " +
"to " + gEnvLdLibraryPath);
gEnv.set("LD_LIBRARY_PATH", gEnvLdLibraryPath);
} else if (gEnvLdLibraryPath !== null) {
debugDump("removing LD_LIBRARY_PATH environment variable");
gEnv.set("LD_LIBRARY_PATH", "");
}
} else if (gEnvLdLibraryPath) {
debugDump("setting LD_LIBRARY_PATH environment variable value back " +
"to " + gEnvLdLibraryPath);
gEnv.set("LD_LIBRARY_PATH", gEnvLdLibraryPath);
} else if (gEnvLdLibraryPath !== null) {
debugDump("removing LD_LIBRARY_PATH environment variable");
gEnv.set("LD_LIBRARY_PATH", "");
}
}