Bug 965064 - Part 1: back out non-native about:accounts. r=nalexander

This commit is contained in:
Richard Newman 2014-01-28 16:49:54 -08:00
parent 51af941cf3
commit bdf87cafc6
10 changed files with 0 additions and 202 deletions

View File

@ -800,9 +800,6 @@ pref("browser.ui.linkify.phone", false);
// Enables/disables Spatial Navigation
pref("snav.enabled", true);
// URL to fetch about:accounts web content from.
pref("identity.fxaccounts.remote.uri", "https://accounts.dev.lcip.org/mobile");
// This url, if changed, MUST continue to point to an https url. Pulling arbitrary content to inject into
// this page over http opens us up to a man-in-the-middle attack that we'd rather not face. If you are a downstream
// repackager of this code using an alternate snippet url, please keep your users safe

View File

@ -1,133 +0,0 @@
/* 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 {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Log.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// loglevel should be one of "Fatal", "Error", "Warn", "Info", "Config",
// "Debug", "Trace" or "All". If none is specified, "Error" will be used by
// default.
const PREF_LOG_LEVEL = "identity.fxaccounts.loglevel";
// Shamelessly cribbed from services/fxaccounts/FxAccountsCommon.js.
let log = Log.repository.getLogger("FirefoxAccounts");
// Avoid adding lots of appenders, which results in duplicate messages.
try {
if (log.ownAppenders.length == 0) {
log.addAppender(new Log.DumpAppender());
}
} catch (e) {
log.addAppender(new Log.DumpAppender());
}
log.level = Log.Level.Error;
try {
let level =
Services.prefs.getPrefType(PREF_LOG_LEVEL) == Ci.nsIPrefBranch.PREF_STRING
&& Services.prefs.getCharPref(PREF_LOG_LEVEL);
log.level = Log.Level[level] || Log.Level.Error;
} catch (e) {
log.error(e);
}
function sendMessageToJava(message) {
return Services.androidBridge.handleGeckoMessage(JSON.stringify(message));
}
let wrapper = {
iframe: null,
init: function () {
log.info("about:accounts init");
let iframe = document.getElementById("remote");
this.iframe = iframe;
iframe.addEventListener("load", this);
log.debug("accountsURI " + this.accountsURI);
iframe.src = this.accountsURI;
},
handleEvent: function (evt) {
switch (evt.type) {
case "load":
this.iframe.contentWindow.addEventListener("FirefoxAccountsCommand", this);
this.iframe.removeEventListener("load", this);
break;
case "FirefoxAccountsCommand":
this.handleRemoteCommand(evt);
break;
}
},
onLogin: function (data) {
log.debug("Received: 'login'. Data:" + JSON.stringify(data));
this.injectData("message", { status: "login" });
sendMessageToJava({
type: "FxAccount:Login",
data: data,
});
},
onCreate: function (data) {
log.debug("Received: 'create'. Data:" + JSON.stringify(data));
this.injectData("message", { status: "create" });
sendMessageToJava({
type: "FxAccount:Create",
data: data,
});
},
onVerified: function (data) {
log.debug("Received: 'verified'. Data:" + JSON.stringify(data));
this.injectData("message", { status: "verified" });
sendMessageToJava({
type: "FxAccount:Verified",
data: data,
});
},
get accountsURI() {
delete this.accountsURI;
return this.accountsURI = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.uri");
},
handleRemoteCommand: function (evt) {
log.debug('command: ' + evt.detail.command);
let data = evt.detail.data;
switch (evt.detail.command) {
case "create":
this.onCreate(data);
break;
case "login":
this.onLogin(data);
break;
case "verified":
this.onVerified(data);
break;
default:
log.warn("Unexpected remote command received: " + evt.detail.command + ". Ignoring command.");
break;
}
},
injectData: function (type, content) {
let authUrl = this.accountsURI;
let data = {
type: type,
content: content
};
this.iframe.contentWindow.postMessage(data, authUrl);
},
};
log.info("about:accounts initializing.");
wrapper.init();
log.info("about:accounts initialized.");

View File

@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/. -->
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % aboutAccountsDTD SYSTEM "chrome://browser/locale/aboutAccounts.dtd">
%aboutAccountsDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/png" sizes="64x64"
href="chrome://branding/content/favicon64.png" />
<title>&aboutAccounts.pageTitle;</title>
<link rel="stylesheet"
href="chrome://browser/skin/aboutAccounts.css"
type="text/css" />
</head>
<body>
<iframe mozframetype="content" id="remote" />
<script type="text/javascript;version=1.8"
src="chrome://browser/content/aboutAccounts.js" />
</body>
</html>

View File

@ -58,8 +58,6 @@ chrome.jar:
content/aboutHealthReport.xhtml (content/aboutHealthReport.xhtml)
* content/aboutHealthReport.js (content/aboutHealthReport.js)
#endif
content/aboutAccounts.xhtml (content/aboutAccounts.xhtml)
* content/aboutAccounts.js (content/aboutAccounts.js)
% content branding %content/branding/

View File

@ -78,10 +78,6 @@ let modules = {
privileged: true
},
#endif
accounts: {
uri: "chrome://browser/content/aboutAccounts.xhtml",
privileged: true
},
}
function AboutRedirector() {}

View File

@ -12,7 +12,6 @@ contract @mozilla.org/network/protocol/about;1?what=downloads {322ba47e-7047-4f7
contract @mozilla.org/network/protocol/about;1?what=reader {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=feedback {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=privatebrowsing {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=accounts {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#ifdef MOZ_SERVICES_HEALTHREPORT
contract @mozilla.org/network/protocol/about;1?what=healthreport {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#endif

View File

@ -1,5 +0,0 @@
<!-- 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/. -->
<!ENTITY aboutAccounts.pageTitle "&brandShortName; Accounts">

View File

@ -7,7 +7,6 @@
@AB_CD@.jar:
% locale browser @AB_CD@ %locale/@AB_CD@/browser/
locale/@AB_CD@/browser/about.dtd (%chrome/about.dtd)
locale/@AB_CD@/browser/aboutAccounts.dtd (%chrome/aboutAccounts.dtd)
locale/@AB_CD@/browser/aboutAddons.dtd (%chrome/aboutAddons.dtd)
locale/@AB_CD@/browser/aboutAddons.properties (%chrome/aboutAddons.properties)
locale/@AB_CD@/browser/aboutApps.dtd (%chrome/aboutApps.dtd)

View File

@ -1,21 +0,0 @@
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
#content {
width: 100%;
height: 100%;
border: 0;
display: flex;
}
#remote {
width: 100%;
height: 100%;
border: 0;
}

View File

@ -8,7 +8,6 @@ chrome.jar:
% skin browser classic/1.0 %skin/
skin/aboutPage.css (aboutPage.css)
skin/about.css (about.css)
skin/aboutAccounts.css (aboutAccounts.css)
skin/aboutAddons.css (aboutAddons.css)
skin/aboutApps.css (aboutApps.css)
skin/aboutBase.css (aboutBase.css)