Skip to content

Commit

Permalink
merge fx-team to mozilla-central a=merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BavarianTomcat committed Nov 17, 2015
2 parents 0f397d9 + 29636e2 commit 6f7666a
Show file tree
Hide file tree
Showing 110 changed files with 851 additions and 866 deletions.
20 changes: 0 additions & 20 deletions browser/base/content/aboutDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Components.utils.import("resource://gre/modules/Services.jsm");

const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";

var gMenuButton = null;
try {
gMenuButton = Services.wm.getMostRecentWindow("navigator:browser")
.document.getElementById("PanelUI-menu-button");
} catch (ex) { };

function init(aEvent)
{
if (aEvent.target != document)
Expand Down Expand Up @@ -55,17 +49,6 @@ function init(aEvent)
document.getElementById("communityDesc").hidden = true;
}

if (/^42/.test(version)) {
document.getElementById("version").addEventListener("click", event => {
if (gMenuButton) {
gMenuButton.classList.add("thumburger");
if (event.shiftKey) {
gMenuButton = null;
}
}
});
}

#ifdef MOZ_UPDATER
gAppUpdater = new appUpdater();

Expand Down Expand Up @@ -100,9 +83,6 @@ function onUnload(aEvent) {
// Safe to call even when there isn't a download in progress.
gAppUpdater.removeDownloadListener();
gAppUpdater = null;
if (gMenuButton) {
gMenuButton.classList.remove("thumburger");
}
}


Expand Down
12 changes: 1 addition & 11 deletions browser/base/content/aboutcerterror/aboutCertError.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,6 @@
return decodeURIComponent(matches[1]);
}

function goBack(buttonEl)
{
if (history.length > 1) {
history.back();
} else {
location.href = "about:home";
}
buttonEl.disabled = true;
}

function toggleVisibility(id)
{
var node = document.getElementById(id);
Expand Down Expand Up @@ -213,7 +203,7 @@
</div>

<div id="buttonContainer">
<button id="returnButton" autocomplete="off" onclick="goBack(this);" autofocus="true">&certerror.returnToPreviousPage.label;</button>
<button id="returnButton" autocomplete="off" autofocus="true">&certerror.returnToPreviousPage.label;</button>
<div id="buttonSpacer"></div>
<button id="advancedButton" autocomplete="off" onclick="toggleVisibility('advancedPanel');" autofocus="true">&certerror.advanced.label;</button>
</div>
Expand Down
43 changes: 33 additions & 10 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2982,20 +2982,14 @@ var BrowserOnClick = {
}
break;

case "getMeOutOfHereButton":
case "returnButton":
if (isTopFrame) {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_GET_ME_OUT_OF_HERE);
}
getMeOutOfHere();
break;

case "technicalContent":
if (isTopFrame) {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_TECHNICAL_DETAILS);
}
goBackFromErrorPage();
break;

case "expertContent":
case "advancedButton":
if (isTopFrame) {
secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_BAD_CERT_TOP_UNDERSTAND_RISKS);
}
Expand Down Expand Up @@ -3134,6 +3128,35 @@ var BrowserOnClick = {
* when their own homepage is infected, we can get them somewhere safe.
*/
function getMeOutOfHere() {
gBrowser.loadURI(getDefaultHomePage());
}

/**
* Re-direct the browser to the previous page or a known-safe page if no
* previous page is found in history. This function is used when the user
* browses to a secure page with certificate issues and is presented with
* about:certerror. The "Go Back" button should take the user to the previous
* or a default start page so that even when their own homepage is on a server
* that has certificate errors, we can get them somewhere safe.
*/
function goBackFromErrorPage() {
const ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let state = JSON.parse(ss.getTabState(gBrowser.selectedTab));
if (state.index == 1) {
// If the unsafe page is the first or the only one in history, go to the
// start page.
gBrowser.loadURI(getDefaultHomePage());
} else {
BrowserBack();
}
}

/**
* Return the default start page for the cases when the user's own homepage is
* infected, so we can get them somewhere safe.
*/
function getDefaultHomePage() {
// Get the start page from the *default* pref branch, not the user's
var prefs = Services.prefs.getDefaultBranch(null);
var url = BROWSER_NEW_TAB_URL;
Expand All @@ -3146,7 +3169,7 @@ function getMeOutOfHere() {
} catch(e) {
Components.utils.reportError("Couldn't get homepage pref: " + e);
}
gBrowser.loadURI(url);
return url;
}

function BrowserFullScreen()
Expand Down
14 changes: 14 additions & 0 deletions browser/base/content/test/general/browser_aboutCertError.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
const GOOD_PAGE = "https://example.com/";
const BAD_CERT = "https://expired.example.com/";
const BAD_STS_CERT = "https://badchain.include-subdomains.pinning.example.com:443";
const {TabStateFlusher} = Cu.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);

add_task(function* checkReturnToAboutHome() {
info("Loading a bad cert page directly and making sure 'return to previous page' goes to about:home");
Expand All @@ -24,6 +26,12 @@ add_task(function* checkReturnToAboutHome() {
is(browser.webNavigation.canGoBack, false, "!webNavigation.canGoBack");
is(browser.webNavigation.canGoForward, false, "!webNavigation.canGoForward");

// Populate the shistory entries manually, since it happens asynchronously
// and the following tests will be too soon otherwise.
yield TabStateFlusher.flush(browser);
let {entries} = JSON.parse(ss.getTabState(tab));
is(entries.length, 1, "there is one shistory entry");

info("Clicking the go back button on about:certerror");
let pageshowPromise = promiseWaitForEvent(browser, "pageshow");
yield ContentTask.spawn(browser, null, function* () {
Expand Down Expand Up @@ -53,6 +61,12 @@ add_task(function* checkReturnToPreviousPage() {
is(browser.webNavigation.canGoBack, true, "webNavigation.canGoBack");
is(browser.webNavigation.canGoForward, false, "!webNavigation.canGoForward");

// Populate the shistory entries manually, since it happens asynchronously
// and the following tests will be too soon otherwise.
yield TabStateFlusher.flush(browser);
let {entries} = JSON.parse(ss.getTabState(tab));
is(entries.length, 2, "there are two shistory entries");

info("Clicking the go back button on about:certerror");
let pageshowPromise = promiseWaitForEvent(browser, "pageshow");
yield ContentTask.spawn(browser, null, function* () {
Expand Down
1 change: 0 additions & 1 deletion browser/components/build/nsModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "remote-newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "preferences", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "downloads", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "accounts", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
Expand Down
17 changes: 17 additions & 0 deletions browser/components/extensions/ext-browserAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function BrowserAction(options, extension)
}

this.defaults = {
enabled: true,
title: title,
badgeText: "",
badgeBackgroundColor: null,
Expand Down Expand Up @@ -113,6 +114,12 @@ BrowserAction.prototype = {
node.removeAttribute("badge");
}

if (tabData.enabled) {
node.removeAttribute("disabled");
} else {
node.setAttribute("disabled", "true");
}

let badgeNode = node.ownerDocument.getAnonymousElementByAttribute(node,
'class', 'toolbarbutton-badge');
if (badgeNode) {
Expand Down Expand Up @@ -207,6 +214,16 @@ extensions.registerAPI((extension, context) => {
};
}).api(),

enable: function(tabId) {
let tab = tabId ? TabManager.getTab(tabId) : null;
browserActionOf(extension).setProperty(tab, "enabled", true);
},

disable: function(tabId) {
let tab = tabId ? TabManager.getTab(tabId) : null;
browserActionOf(extension).setProperty(tab, "enabled", false);
},

setTitle: function(details) {
let tab = details.tabId ? TabManager.getTab(details.tabId) : null;
browserActionOf(extension).setProperty(tab, "title", details.title);
Expand Down
2 changes: 2 additions & 0 deletions browser/components/extensions/test/browser/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ support-files =
[browser_ext_browserAction_simple.js]
[browser_ext_browserAction_pageAction_icon.js]
[browser_ext_browserAction_context.js]
[browser_ext_browserAction_disabled.js]
[browser_ext_pageAction_context.js]
[browser_ext_pageAction_popup.js]
[browser_ext_browserAction_popup.js]
[browser_ext_contextMenus.js]
[browser_ext_getViews.js]
[browser_ext_tabs_executeScript.js]
Expand Down
Loading

0 comments on commit 6f7666a

Please sign in to comment.