Merge m-c to m-i.

This commit is contained in:
Richard Newman 2012-02-23 18:37:12 -08:00
commit f8f9fa6f5d
34 changed files with 682 additions and 109 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

View File

@ -0,0 +1,127 @@
/*
* This defines the look-and-feel styling of the error pages.
* (see: netError.xhtml)
*
* Original styling by William Price <bugzilla@mob.rice.edu>
* Updated for mobile by: Wes Johnston <wjohnston@mozilla.com>
*/
body {
margin: 0;
padding: 0 8px 8px;
font-family: "Nokia Sans", Tahoma, sans-serif !important;
}
h1 {
font-size: 22px;
}
h2 {
font-size: 16px;
}
ul {
margin: 0px;
padding: 0px 0px 0px 1em;
}
li {
margin: 0px;
padding: 8px 0px;
}
#errorPage {
background-color: #CEE6F4;
}
#errorPage.certerror {
background-color: #EFD400;
}
#errorPage.blockedsite {
background-color: #BF0000;
}
#errorTitle {
background: url("chrome://browser/content/images/errorpage-warning.png") left center no-repeat;
/* Scaled by .666 of their actual size */
background-size: 40px 40px;
background-origin: content-box;
min-height: 60px;
margin-left: auto;
margin-right: auto;
max-width: 500px;
margin-left: auto;
margin-right: auto;
}
#errorPage.certerror #errorTitle {
background-image: url("chrome://browser/content/images/errorpage-larry-black.png");
}
#errorPage.blockedsite #errorTitle {
background-image: url("chrome://browser/content/images/errorpage-larry-white.png");
color: white;
}
.errorTitleText {
padding: 0px 0px 0px 50px;
display: inline-block;
vertical-align: middle
}
#errorPageContainer {
background-color: white;
border: 1px solid #999999;
border-radius: 6px;
padding: 6px 20px 20px;
font-size: 14px;
max-width: 500px;
margin-left: auto;
margin-right: auto;
}
#errorShortDesc > p:empty {
display: none;
}
#errorShortDesc > p {
overflow: auto;
border-bottom: 1px solid #999999;
padding-bottom: 1em;
}
#errorPage.blockedsite #errorShortDesc > p {
font-weight: bold;
border-bottom: none;
padding-bottom: 0px;
}
#securityOverrideDiv {
padding-top: 10px;
}
div[collapsed] {
padding-left: 15px;
background-image: url("chrome://browser/skin/images/arrowright-16.png");
background-size: 11px 11px;
background-repeat: no-repeat;
background-position: left 0.3em;
}
div[collapsed="true"] {
background-image: url("chrome://browser/skin/images/arrowright-16.png");
}
div[collapsed="false"] {
background-image: url("chrome://browser/skin/images/arrowdown-16.png");
}
div[collapsed="true"] > p,
div[collapsed="true"] > div {
display: none;
}
button {
padding: 0.3em !important;
}

View File

@ -304,7 +304,6 @@
</head>
<body id="errorPage" dir="&locale.dir;">
<!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
<div id="errorContainer">
<div id="errorTitlesContainer">
@ -318,6 +317,7 @@
<h1 id="et_redirectLoop">&redirectLoop.title;</h1>
<h1 id="et_unknownSocketType">&unknownSocketType.title;</h1>
<h1 id="et_netReset">&netReset.title;</h1>
<h1 id="et_notCached">&notCached.title;</h1>
<h1 id="et_netOffline">&netOffline.title;</h1>
<h1 id="et_netInterrupt">&netInterrupt.title;</h1>
<h1 id="et_deniedPortAccess">&deniedPortAccess.title;</h1>
@ -342,6 +342,7 @@
<div id="ed_redirectLoop">&redirectLoop.longDesc;</div>
<div id="ed_unknownSocketType">&unknownSocketType.longDesc;</div>
<div id="ed_netReset">&netReset.longDesc;</div>
<div id="ed_notCached">&notCached.longDesc;</div>
<div id="ed_netOffline">&netOffline.longDesc2;</div>
<div id="ed_netInterrupt">&netInterrupt.longDesc;</div>
<div id="ed_deniedPortAccess">&deniedPortAccess.longDesc;</div>

View File

@ -84,6 +84,18 @@ XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
content.dispatchEvent(event);
}
function maybeShowIme(targetElement) {
// FIXME/bug 729623: work around apparent bug in the IME manager
// in gecko.
let readonly = targetElement.getAttribute('readonly');
if (readonly)
return false;
let type = targetElement.type;
fireEvent('showime', { type: type });
return true;
}
let constructor = {
handleEvent: function vkm_handleEvent(evt) {
switch (evt.type) {
@ -102,9 +114,7 @@ XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
if (evt.target != activeElement || isKeyboardOpened)
return;
let type = activeElement.type;
fireEvent('showime', { type: type });
isKeyboardOpened = true;
isKeyboardOpened = maybeShowIme(activeElement);
break;
}
},
@ -112,11 +122,10 @@ XPCOMUtils.defineLazyGetter(Services, 'fm', function() {
let shouldOpen = parseInt(data);
if (shouldOpen && !isKeyboardOpened) {
activeElement = Services.fm.focusedElement;
if (!activeElement)
if (!activeElement || !maybeShowIme(activeElement)) {
activeElement = null;
return;
let type = activeElement.type;
fireEvent('showime', { type: type });
}
} else if (!shouldOpen && isKeyboardOpened) {
fireEvent('hideime');
}

View File

@ -17,4 +17,9 @@ chrome.jar:
content/content.css (content/content.css)
% override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml
% override chrome://global/skin/netError.css chrome://browser/content/netError.css
content/netError.xhtml (content/netError.xhtml)
content/netError.css (content/netError.css)
content/images/errorpage-larry-black.png (content/images/errorpage-larry-black.png)
content/images/errorpage-larry-white.png (content/images/errorpage-larry-white.png)
content/images/errorpage-warning.png (content/images/errorpage-warning.png)

View File

@ -35,7 +35,7 @@
* ***** END LICENSE BLOCK ***** */
function test() {
let tab1 = gBrowser.addTab("about:robots");
let tab1 = gBrowser.addTab("about:rights");
let tab2 = gBrowser.addTab("about:mozilla");
tab1.linkedBrowser.addEventListener("load", mainPart, true);
waitForExplicitFinish();
@ -44,7 +44,7 @@ function test() {
tab1.linkedBrowser.removeEventListener("load", mainPart, true);
// Tell the session storer that the tab is pinned
let newTabState = '{"entries":[{"url":"about:robots"}],"pinned":true,"userTypedValue":"Hello World!"}';
let newTabState = '{"entries":[{"url":"about:rights"}],"pinned":true,"userTypedValue":"Hello World!"}';
ss.setTabState(tab1, newTabState);
// Undo pinning

View File

@ -4,7 +4,7 @@
function test() {
let state = { windows: [{ tabs: [
{entries: [{url: "about:mozilla"}], hidden: true},
{entries: [{url: "about:robots"}], hidden: true}
{entries: [{url: "about:rights"}], hidden: true}
] }] };
waitForExplicitFinish();

View File

@ -252,7 +252,7 @@ function onWindowUnloaded() {
let previousClosedWindowData = ss.getClosedWindowData();
// Now we want to open a new window
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:robots");
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:mozilla");
newWin.addEventListener("load", function(aEvent) {
newWin.removeEventListener("load", arguments.callee, false);

View File

@ -5,7 +5,7 @@ function test() {
let oldState = {
windows: [{
tabs: [
{ entries: [{ url: "about:robots" }], hidden: true },
{ entries: [{ url: "about:mozilla" }], hidden: true },
{ entries: [{ url: "about:blank" }], hidden: false }
]
}]

View File

@ -40,7 +40,7 @@ const testState = {
windows: [{
tabs: [
{ entries: [{ url: "about:blank" }] },
{ entries: [{ url: "about:robots" }] }
{ entries: [{ url: "about:rights" }] }
]
}]
};
@ -174,7 +174,7 @@ function test_duplicateTab() {
is(busyEventCount, 1);
is(readyEventCount, 1);
is(ss.getTabValue(newTab, "baz"), "qux");
is(newTab.linkedBrowser.currentURI.spec, "about:robots");
is(newTab.linkedBrowser.currentURI.spec, "about:rights");
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
@ -215,7 +215,7 @@ function test_undoCloseTab() {
is(busyEventCount, 1);
is(readyEventCount, 1);
is(ss.getTabValue(reopenedTab, "baz"), "qux");
is(reopenedTab.linkedBrowser.currentURI.spec, "about:robots");
is(reopenedTab.linkedBrowser.currentURI.spec, "about:rights");
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);

View File

@ -40,7 +40,7 @@ const testState = {
windows: [{
tabs: [
{ entries: [{ url: "about:blank" }] },
{ entries: [{ url: "about:robots" }] }
{ entries: [{ url: "about:mozilla" }] }
]
}]
};

View File

@ -28,7 +28,7 @@ function test() {
// Open a new window, which should trigger a save event soon.
waitForSaveState(onSaveState);
newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:robots");
newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:rights");
}
function onSaveState() {

View File

@ -20,7 +20,7 @@ function test() {
assertNumberOfTabs(1, "we start off with one tab");
// setup
let tab = gBrowser.addTab("about:robots");
let tab = gBrowser.addTab("about:mozilla");
whenTabIsLoaded(tab, function () {
// hide the newly created tab
@ -35,7 +35,7 @@ function test() {
// check that everything was restored correctly, clean up and finish
whenTabIsLoaded(tab, function () {
is(tab.linkedBrowser.currentURI.spec, "about:robots", "restored tab has correct url");
is(tab.linkedBrowser.currentURI.spec, "about:mozilla", "restored tab has correct url");
gBrowser.removeTab(tab);
finish();

View File

@ -11,7 +11,6 @@ function test() {
let brokenState = {
windows: [
{ tabs: [{ entries: [{ url: "about:mozilla" }] }] }
//{ tabs: [{ entries: [{ url: "about:robots" }] }] },
],
selectedWindow: 2
};
@ -32,4 +31,3 @@ function test() {
let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
waitForBrowserState(blankState, finish);
}

View File

@ -849,15 +849,11 @@ nsTextInputListener::EditAction()
nsCOMPtr<nsIEditor> editor;
frame->GetEditor(getter_AddRefs(editor));
nsCOMPtr<nsITransactionManager> manager;
editor->GetTransactionManager(getter_AddRefs(manager));
NS_ENSURE_TRUE(manager, NS_ERROR_FAILURE);
// Get the number of undo / redo items
PRInt32 numUndoItems = 0;
PRInt32 numRedoItems = 0;
manager->GetNumberOfUndoItems(&numUndoItems);
manager->GetNumberOfRedoItems(&numRedoItems);
editor->GetNumberOfUndoItems(&numUndoItems);
editor->GetNumberOfRedoItems(&numRedoItems);
if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) ||
(numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) {
// Modify the menu if undo or redo items are different

View File

@ -495,7 +495,7 @@ let Buf = {
* Integer specifying the request type.
* @param options [optional]
* Object containing information about the request, e.g. the
* original main thread message object that led to the RIL request.
* original main thread message object that led to the RIL request.
*/
newParcel: function newParcel(type, options) {
if (DEBUG) debug("New outgoing parcel of type " + type);
@ -532,8 +532,8 @@ let Buf = {
this.outgoingIndex = PARCEL_SIZE_SIZE;
},
simpleRequest: function simpleRequest(type) {
this.newParcel(type);
simpleRequest: function simpleRequest(type, options) {
this.newParcel(type, options);
this.sendParcel();
}
};
@ -570,7 +570,7 @@ let RIL = {
* Parse an integer from a string, falling back to a default value
* if the the provided value is not a string or does not contain a valid
* number.
*
*
* @param string
* String to be parsed.
* @param defaultValue
@ -848,9 +848,12 @@ let RIL = {
/**
* Get the Short Message Service Center address.
*
* @param pendingSMS
* Object containing the parameters of an SMS waiting to be sent.
*/
getSMSCAddress: function getSMSCAddress() {
Buf.simpleRequest(REQUEST_GET_SMSC_ADDRESS);
getSMSCAddress: function getSMSCAddress(pendingSMS) {
Buf.simpleRequest(REQUEST_GET_SMSC_ADDRESS, pendingSMS);
},
/**
@ -1225,9 +1228,9 @@ RIL[REQUEST_CDMA_WRITE_SMS_TO_RUIM] = null;
RIL[REQUEST_CDMA_DELETE_SMS_ON_RUIM] = null;
RIL[REQUEST_DEVICE_IDENTITY] = null;
RIL[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE] = null;
RIL[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS() {
RIL[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS(length, options) {
let smsc = Buf.readString();
Phone.onGetSMSCAddress(smsc);
Phone.onGetSMSCAddress(smsc, options);
};
RIL[REQUEST_SET_SMSC_ADDRESS] = function REQUEST_SET_SMSC_ADDRESS() {
Phone.onSetSMSCAddress();
@ -1777,8 +1780,17 @@ let Phone = {
onStopTone: function onStopTone() {
},
onGetSMSCAddress: function onGetSMSCAddress(smsc) {
onGetSMSCAddress: function onGetSMSCAddress(smsc, options) {
//TODO: notify main thread if we fail retrieving the SMSC, especially
// if there was a pending SMS (bug 727319).
this.SMSC = smsc;
// If the SMSC was not retrieved on RIL initialization, an attempt to
// get it is triggered from this.sendSMS followed by the 'options'
// parameter of the SMS, so that we can send it after successfully
// retrieving the SMSC.
if (smsc && options.body) {
this.sendSMS(options);
}
},
onSetSMSCAddress: function onSetSMSCAddress() {
@ -2053,12 +2065,9 @@ let Phone = {
sendSMS: function sendSMS(options) {
// Get the SMS Center address
if (!this.SMSC) {
//TODO: we shouldn't get here, but if we do, we might want to hold on
// to the message and retry once we know the SMSC... or just notify an
// error to the mainthread and let them deal with retrying?
if (DEBUG) {
debug("Cannot send the SMS. Need to get the SMSC address first.");
}
// We request the SMS center address again, passing it the SMS options
// in order to try to send it again after retrieving the SMSC number.
RIL.getSMSCAddress(options);
return;
}
// We explicitly save this information on the options object so that we
@ -2069,8 +2078,7 @@ let Phone = {
//TODO: verify values on 'options'
//TODO: the data encoding and length in octets should eventually be
// computed on the mainthread and passed down to us.
options.dcs = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
options.bodyLengthInOctets = Math.ceil(options.body.length * 7 / 8);
GsmPDUHelper.calculateUserDataLength(options);
RIL.sendSMS(options);
},
@ -2341,13 +2349,22 @@ let GsmPDUHelper = {
/**
* Read user data and decode as a UCS2 string.
*
* @param length
* XXX TODO
* @param numOctets
* num of octets to read as UCS2 string.
*
* @return a string.
*/
readUCS2String: function readUCS2String(length) {
//TODO bug 712804
readUCS2String: function readUCS2String(numOctets) {
let str = "";
let length = numOctets / 2;
for (let i = 0; i < length; ++i) {
let code = (this.readHexOctet() << 8) | this.readHexOctet();
str += String.fromCharCode(code);
}
if (DEBUG) debug("Read UCS2 string: " + str);
return str;
},
/**
@ -2357,14 +2374,50 @@ let GsmPDUHelper = {
* Message string to encode as UCS2 in hex-encoded octets.
*/
writeUCS2String: function writeUCS2String(message) {
//TODO bug 712804
for (let i = 0; i < message.length; ++i) {
let code = message.charCodeAt(i);
this.writeHexOctet((code >> 8) & 0xFF);
this.writeHexOctet(code & 0xFF);
}
},
/**
* Calculate user data length and its encoding.
*
* The `options` parameter object should contain the `body` attribute, and
* the `dcs`, `bodyLengthInOctets` attributes will be set as return:
*
* @param body
* String containing the message body.
* @param dcs
* Data coding scheme. One of the PDU_DCS_MSG_CODING_*BITS_ALPHABET
* constants.
* @param bodyLengthInOctets
* Byte length of the message body when encoded with the given DCS.
*/
calculateUserDataLength: function calculateUserDataLength(options) {
//TODO: support language tables, see bug 729876
//TODO: support multipart SMS, see bug 712933
let needUCS2 = false;
for (let i = 0; i < options.body.length; ++i) {
if (options.body.charCodeAt(i) >= 128) {
needUCS2 = true;
break;
}
}
if (needUCS2) {
options.dcs = PDU_DCS_MSG_CODING_16BITS_ALPHABET;
options.bodyLengthInOctets = options.body.length * 2;
} else {
options.dcs = PDU_DCS_MSG_CODING_7BITS_ALPHABET;
options.bodyLengthInOctets = Math.ceil(options.body.length * 7 / 8);
}
},
/**
* User data can be 7 bit (default alphabet) data, 8 bit data, or 16 bit
* (UCS2) data.
*
* TODO: This function currently supports only the default alphabet.
*/
readUserData: function readUserData(length, codingScheme) {
if (DEBUG) {

View File

@ -483,7 +483,13 @@ var WifiManager = (function() {
}
}
function parseStatus(status) {
function notifyStateChange(fields) {
fields.prevState = manager.state;
manager.state = fields.state;
notify("statechange", fields);
}
function parseStatus(status, reconnected) {
if (status === null) {
debug("Unable to get wpa supplicant's status");
return;
@ -493,9 +499,9 @@ var WifiManager = (function() {
for (let i = 0; i < lines.length; ++i) {
let [key, value] = lines[i].split("=");
if (key === "wpa_state") {
notify("statechange", { state: value });
notifyStateChange({ state: value });
if (value === "COMPLETED")
onconnected();
onconnected(reconnected);
}
}
}
@ -507,11 +513,7 @@ var WifiManager = (function() {
if (ok === 0) {
// Tell the event worker to start waiting for events.
retryTimer = null;
waitForEvent();
notify("supplicantconnection");
// Load up the supplicant state.
statusCommand(parseStatus);
didConnectSupplicant(false, function(){});
return;
}
if (connectTries++ < 3) {
@ -530,10 +532,14 @@ var WifiManager = (function() {
}
manager.start = function() {
connectToSupplicant(connectCallback);
// If we reconnected to an already-running supplicant, then manager.state
// will have already been updated to the supplicant's state. Otherwise, we
// started the supplicant ourselves and need to connect.
if (manager.state === "UNINITIALIZED")
connectToSupplicant(connectCallback);
}
function onconnected() {
function dhcpAfterConnect() {
runDhcp(manager.ifname, function (data) {
if (!data) {
debug("DHCP failed to run");
@ -564,6 +570,30 @@ var WifiManager = (function() {
});
}
function onconnected(reconnected) {
if (!reconnected) {
dhcpAfterConnect();
return;
}
// We're in the process of reconnecting to a pre-existing wpa_supplicant.
// Check to see if there was already a DHCP process:
getProperty("init.svc.dhcpcd_" + manager.ifname, "stopped", function(value) {
if (value === "running") {
return;
}
// Some phones use a different property name for the dhcpcd daemon.
getProperty("init.svc.dhcpcd", "stopped", function(value) {
if (value === "running") {
return;
}
dhcpAfterConnect();
});
});
}
var supplicantStatesMap = ["DISCONNECTED", "INACTIVE", "SCANNING", "ASSOCIATING",
"ASSOCIATED", "FOUR_WAY_HANDSHAKE", "GROUP_HANDSHAKE",
"COMPLETED", "DORMANT", "UNINITIALIZED"];
@ -595,7 +625,7 @@ var WifiManager = (function() {
if (!("state" in fields))
return true;
fields.state = supplicantStatesMap[fields.state];
notify("statechange", fields);
notifyStateChange(fields);
return true;
}
if (eventData.indexOf("CTRL-EVENT-DRIVER-STATE") === 0) {
@ -620,15 +650,15 @@ var WifiManager = (function() {
return false;
}
if (eventData.indexOf("CTRL-EVENT-DISCONNECTED") === 0) {
notify("statechange", { state: "DISCONNECTED" });
notifyStateChange({ state: "DISCONNECTED" });
return true;
}
if (eventData.indexOf("CTRL-EVENT-CONNECTED") === 0) {
// Format: CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]
var bssid = eventData.split(" ")[4];
var id = eventData.substr(eventData.indexOf("id=")).split(" ")[0];
notify("statechange", { state: "CONNECTED", BSSID: bssid, id: id });
onconnected();
notifyStateChange({ state: "CONNECTED", BSSID: bssid, id: id });
onconnected(false);
return true;
}
if (eventData.indexOf("CTRL-EVENT-SCAN-RESULTS") === 0) {
@ -640,6 +670,7 @@ var WifiManager = (function() {
return true;
}
const SUPP_PROP = "init.svc.wpa_supplicant";
function killSupplicant(callback) {
// It is interesting to note that this function does exactly what
// wifi_stop_supplicant does. Unforunately, on the Galaxy S2, Samsung
@ -649,15 +680,15 @@ var WifiManager = (function() {
var count = 0;
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
function tick() {
getProperty("init.svc.wpa_supplicant", "stopped", function (result) {
getProperty(SUPP_PROP, "stopped", function (result) {
if (result === null) {
callback(false);
callback();
return;
}
if (result === "stopped" || ++count >= 5) {
// Either we succeeded or ran out of time.
timer = null;
callback(count < 5);
callback();
return;
}
@ -669,15 +700,53 @@ var WifiManager = (function() {
setProperty("ctl.stop", "wpa_supplicant", tick);
}
function didConnectSupplicant(reconnected, callback) {
waitForEvent();
notify("supplicantconnection");
// Load up the supplicant state.
statusCommand(function(status) {
parseStatus(status, reconnected);
callback();
});
}
function prepareForStartup(callback) {
stopDhcp(manager.ifname, function() {
// Ignore any errors.
killSupplicant(callback);
// First, check to see if there's a wpa_supplicant running that we can
// connect to.
getProperty(SUPP_PROP, "stopped", function (value) {
debug(SUPP_PROP + " was " + value);
if (value !== "running") {
stopDhcp(manager.ifname, function() { callback(false) });
return;
}
debug(SUPP_PROP + " was running, trying to connect");
// It's running, try to reconnect to it.
connectToSupplicant(function (retval) {
if (retval === 0) {
// Successfully reconnected! Don't do anything else.
debug("Successfully connected!");
// It is important that we call parseStatus (in
// didConnectSupplicant) before calling the callback here.
// Otherwise, WifiManager.start will reconnect to it.
didConnectSupplicant(true, function() { callback(true) });
return;
}
debug("Didn't connect, trying other method.");
stopDhcp(manager.ifname, function() {
// Ignore any errors.
killSupplicant(function() { callback(false); });
});
});
});
}
// Initial state
var airplaneMode = false;
manager.state = "UNINITIALIZED";
// Public interface of the wifi service
manager.setWifiEnabled = function(enable, callback) {
@ -695,8 +764,12 @@ var WifiManager = (function() {
}
manager.ifname = ifname;
prepareForStartup(function() {
// Ignore errors...
prepareForStartup(function(already_connected) {
if (already_connected) {
callback(0);
return;
}
loadDriver(function (status) {
if (status < 0) {
callback(status);
@ -855,6 +928,7 @@ function nsWifiWorker() {
WifiManager.getMacAddress(function (mac) {
debug("Got mac: " + mac);
});
connectToMozilla();
}
WifiManager.onsupplicantlost = function() {
debug("Couldn't connect to supplicant");
@ -862,15 +936,9 @@ function nsWifiWorker() {
var self = this;
this.state = null;
this.networks = Object.create(null);
WifiManager.onstatechange = function() {
debug("State change: " + self.state + " -> " + this.state);
self.state = this.state;
// TODO Worth adding a more generic API for this?
if (self.state === "INACTIVE")
connectToMozilla();
debug("State change: " + this.prevState + " -> " + this.state);
}
function connectToMozilla() {

View File

@ -55,7 +55,7 @@ interface nsIEditActionListener;
interface nsIInlineSpellChecker;
interface nsITransferable;
[scriptable, uuid(94479B76-7FD7-47D3-BB1E-5B77846339D2)]
[scriptable, uuid(656005d2-d900-4839-81bf-6274a3c38537)]
interface nsIEditor : nsISupports
{
@ -205,6 +205,16 @@ interface nsIEditor : nsISupports
*/
void enableUndo(in boolean enable);
/**
* The number of items on the undo stack.
*/
readonly attribute long numberOfUndoItems;
/**
* The number of items on the redo stack.
*/
readonly attribute long numberOfRedoItems;
/** undo reverses the effects of the last Do operation,
* if Undo is enabled in the editor.
* It is provided here so clients need no knowledge of whether

View File

@ -750,6 +750,19 @@ nsEditor::EnableUndo(bool aEnable)
return NS_OK;
}
NS_IMETHODIMP
nsEditor::GetNumberOfUndoItems(PRInt32* aNumItems)
{
*aNumItems = 0;
return mTxnMgr ? mTxnMgr->GetNumberOfUndoItems(aNumItems) : NS_OK;
}
NS_IMETHODIMP
nsEditor::GetNumberOfRedoItems(PRInt32* aNumItems)
{
*aNumItems = 0;
return mTxnMgr ? mTxnMgr->GetNumberOfRedoItems(aNumItems) : NS_OK;
}
NS_IMETHODIMP
nsEditor::GetTransactionManager(nsITransactionManager* *aTxnManager)

View File

@ -9,6 +9,7 @@ In this order:
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
angle-limit-identifiers-to-250-chars.patch - see bug 675625
angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
angle-castrate-bug-241.patch - see bug 699033 / angle bug 241
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.

View File

@ -0,0 +1,47 @@
# HG changeset patch
# User Benoit Jacob <bjacob@mozilla.com>
# Parent 7dcbce54a953090ae8e537f93c6c99ab8eb0dc62
diff --git a/gfx/angle/README.mozilla b/gfx/angle/README.mozilla
--- a/gfx/angle/README.mozilla
+++ b/gfx/angle/README.mozilla
@@ -4,16 +4,17 @@ Current revision: r963
== Applied local patches ==
In this order:
angle-renaming-debug.patch - rename debug.h to compilerdebug.h to avoid conflict in our makefiles
angle-intrinsic-msvc2005.patch - work around a MSVC 2005 compile error
angle-limit-identifiers-to-250-chars.patch - see bug 675625
angle-use-xmalloc.patch - see bug 680840. Can drop this patch whenever the new preprocessor lands.
+ angle-castrate-bug-241.patch - see bug 699033 / angle bug 241
In addition to these patches, the Makefile.in files are ours, they're not present in upsteam ANGLE.
== How to update this ANGLE copy ==
1. Unapply patches
2. Apply diff with new ANGLE version
3. Reapply patches.
diff --git a/gfx/angle/src/compiler/Types.h b/gfx/angle/src/compiler/Types.h
--- a/gfx/angle/src/compiler/Types.h
+++ b/gfx/angle/src/compiler/Types.h
@@ -203,17 +203,17 @@ public:
bool isVector() const { return size > 1 && !matrix; }
bool isScalar() const { return size == 1 && !matrix && !structure; }
TTypeList* getStruct() const { return structure; }
void setStruct(TTypeList* s) { structure = s; computeDeepestStructNesting(); }
const TString& getTypeName() const
{
- assert(typeName);
+ if(!typeName) abort();
return *typeName;
}
void setTypeName(const TString& n)
{
typeName = NewPoolTString(n.c_str());
}
bool isField() const { return fieldName != 0; }

View File

@ -208,7 +208,7 @@ public:
const TString& getTypeName() const
{
assert(typeName);
if(!typeName) abort();
return *typeName;
}
void setTypeName(const TString& n)

View File

@ -412,6 +412,7 @@ SetScreenBrightness(double brightness)
aConfig.flashOnMS() = aConfig.flashOffMS() = 0;
aConfig.color() = color;
hal::SetLight(hal::eHalLightID_Backlight, aConfig);
hal::SetLight(hal::eHalLightID_Buttons, aConfig);
}
static light_device_t* sLights[hal::eHalLightID_Count]; // will be initialized to NULL

View File

@ -1760,6 +1760,10 @@ main(int argc, char **argv, char **envp)
setbuf(stdout, 0);
#endif
#ifdef XRE_HAS_DLL_BLOCKLIST
XRE_SetupDllBlocklist();
#endif
gErrFile = stderr;
gOutFile = stdout;
gInFile = stdin;

View File

@ -50,6 +50,7 @@
#endif
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "prlog.h"
@ -151,12 +152,76 @@ static DllBlockInfo sWindowsDllBlocklist[] = {
// define this for very verbose dll load debug spew
#undef DEBUG_very_verbose
extern bool gInXPCOMLoadOnMainThread;
namespace {
typedef NTSTATUS (NTAPI *LdrLoadDll_func) (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileName, PHANDLE handle);
static LdrLoadDll_func stub_LdrLoadDll = 0;
template <class T>
struct RVAMap {
RVAMap(HANDLE map, DWORD offset) {
SYSTEM_INFO info;
GetSystemInfo(&info);
DWORD alignedOffset = (offset / info.dwAllocationGranularity) *
info.dwAllocationGranularity;
NS_ASSERTION(offset - alignedOffset < info.dwAllocationGranularity, "Wtf");
mRealView = ::MapViewOfFile(map, FILE_MAP_READ, 0, alignedOffset,
sizeof(T) + (offset - alignedOffset));
mMappedView = reinterpret_cast<T*>((char*)mRealView + (offset - alignedOffset));
}
~RVAMap() {
if (mRealView) {
::UnmapViewOfFile(mRealView);
}
}
operator const T*() const { return mMappedView; }
const T* operator->() const { return mMappedView; }
private:
const T* mMappedView;
void* mRealView;
};
bool
CheckASLR(const wchar_t* path)
{
bool retval = false;
HANDLE file = ::CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
NULL);
if (file != INVALID_HANDLE_VALUE) {
HANDLE map = ::CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
if (map) {
RVAMap<IMAGE_DOS_HEADER> peHeader(map, 0);
if (peHeader) {
RVAMap<IMAGE_NT_HEADERS> ntHeader(map, peHeader->e_lfanew);
if (ntHeader) {
// If the DLL has no code, permit it regardless of ASLR status.
if (ntHeader->OptionalHeader.SizeOfCode == 0) {
retval = true;
}
// Check to see if the DLL supports ASLR
else if ((ntHeader->OptionalHeader.DllCharacteristics &
IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE) != 0) {
retval = true;
}
}
}
::CloseHandle(map);
}
::CloseHandle(file);
}
return retval;
}
/**
* Some versions of Windows call LoadLibraryEx to get the version information
* for a DLL, which causes our patched LdrLoadDll implementation to re-enter
@ -225,6 +290,29 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
int len = moduleFileName->Length / 2;
wchar_t *fname = moduleFileName->Buffer;
// In Windows 8, the first parameter seems to be used for more than just the
// path name. For example, its numerical value can be 1. Passing a non-valid
// pointer to SearchPathW will cause a crash, so we need to check to see if we
// are handed a valid pointer, and otherwise just pass NULL to SearchPathW.
PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? NULL : filePath;
// figure out the length of the string that we need
DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, NULL, NULL);
if (pathlen == 0) {
// uh, we couldn't find the DLL at all, so...
printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName);
return STATUS_DLL_NOT_FOUND;
}
nsAutoArrayPtr<wchar_t> full_fname(new wchar_t[pathlen+1]);
if (!full_fname) {
// couldn't allocate memory?
return STATUS_DLL_NOT_FOUND;
}
// now actually grab it
SearchPathW(sanitizedFilePath, fname, L".dll", pathlen+1, full_fname, NULL);
// The filename isn't guaranteed to be null terminated, but in practice
// it always will be; ensure that this is so, and bail if not.
// This is done instead of the more robust approach because of bug 527122,
@ -305,29 +393,6 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
goto continue_loading;
}
// In Windows 8, the first parameter seems to be used for more than just the
// path name. For example, its numerical value can be 1. Passing a non-valid
// pointer to SearchPathW will cause a crash, so we need to check to see if we
// are handed a valid pointer, and otherwise just pass NULL to SearchPathW.
PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? NULL : filePath;
// figure out the length of the string that we need
DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, NULL, NULL);
if (pathlen == 0) {
// uh, we couldn't find the DLL at all, so...
printf_stderr("LdrLoadDll: Blocking load of '%s' (SearchPathW didn't find it?)\n", dllName);
return STATUS_DLL_NOT_FOUND;
}
wchar_t *full_fname = (wchar_t*) malloc(sizeof(wchar_t)*(pathlen+1));
if (!full_fname) {
// couldn't allocate memory?
return STATUS_DLL_NOT_FOUND;
}
// now actually grab it
SearchPathW(sanitizedFilePath, fname, L".dll", pathlen+1, full_fname, NULL);
DWORD zero;
DWORD infoSize = GetFileVersionInfoSizeW(full_fname, &zero);
@ -351,8 +416,6 @@ patched_LdrLoadDll (PWCHAR filePath, PULONG flags, PUNICODE_STRING moduleFileNam
load_ok = true;
}
}
free(full_fname);
}
if (!load_ok) {
@ -368,6 +431,14 @@ continue_loading:
NS_SetHasLoadedNewDLLs();
if (gInXPCOMLoadOnMainThread && NS_IsMainThread()) {
// Check to ensure that the DLL has ASLR.
if (!CheckASLR(full_fname)) {
printf_stderr("LdrLoadDll: Blocking load of '%s'. XPCOM components must support ASLR.\n", dllName);
return STATUS_DLL_NOT_FOUND;
}
}
return stub_LdrLoadDll(filePath, flags, moduleFileName, handle);
}

View File

@ -87,6 +87,8 @@ using namespace mozilla;
static PRLogModuleInfo *nsNativeModuleLoaderLog =
PR_NewLogModule("nsNativeModuleLoader");
bool gInXPCOMLoadOnMainThread = false;
#define LOG(level, args) PR_LOG(nsNativeModuleLoaderLog, level, args)
NS_IMPL_QUERY_INTERFACE1(nsNativeModuleLoader,
@ -167,7 +169,9 @@ nsNativeModuleLoader::LoadModule(FileLocation &aFile)
// We haven't loaded this module before
gInXPCOMLoadOnMainThread = true;
rv = file->Load(&data.library);
gInXPCOMLoadOnMainThread = false;
if (NS_FAILED(rv)) {
char errorMsg[1024] = "<unknown; can't get error from NSPR>";

View File

@ -45,7 +45,12 @@ include $(DEPTH)/config/autoconf.mk
MODULE = xpcom
DIRS = external component bug656331_component
DIRS = \
external \
component \
bug656331_component \
component_no_aslr \
$(NULL)
ifeq ($(OS_ARCH),WINNT)
DIRS += windows

View File

@ -0,0 +1,81 @@
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Benjamin Smedberg <benjamin@smedbergs.us>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = testcompnoaslr
IS_COMPONENT = 1
CPPSRCS = TestComponent.cpp
NO_DIST_INSTALL = 1
FORCE_SHARED_LIB = 1
include $(topsrcdir)/config/config.mk
MANIFEST_FILE = testcompnoaslr.manifest
EXTRA_DSO_LDOPTS = \
$(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(XPCOM_FROZEN_LDOPTS) \
$(NSPR_LIBS) \
$(NULL)
# Need to link with CoreFoundation on Mac
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
EXTRA_DSO_LDOPTS += \
$(TK_LIBS) \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk
LDFLAGS := $(filter-out -DYNAMICBASE,$(LDFLAGS)) -DYNAMICBASE:NO
DEFINES += -DLIBRARY_FILENAME="$(SHARED_LIBRARY)"
unittestlocation = xpcom/tests/unit
libs:: $(SHARED_LIBRARY)
$(INSTALL) $^ $(testxpcobjdir)/$(unittestlocation)
libs:: $(MANIFEST_FILE)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $< > $(testxpcobjdir)/$(unittestlocation)/$(<F)

View File

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Suresh Duddu <dp@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/ModuleUtils.h"
#define NS_TESTING_CID \
{ 0x335fb596, 0xe52d, 0x418f, \
{ 0xb0, 0x1c, 0x1b, 0xf1, 0x6c, 0xe5, 0xe7, 0xe4 } }
NS_DEFINE_NAMED_CID(NS_TESTING_CID);
static nsresult
DummyConstructorFunc(nsISupports* aOuter, const nsIID& aIID, void** aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
static const mozilla::Module::CIDEntry kTestCIDs[] = {
{ &kNS_TESTING_CID, false, NULL, DummyConstructorFunc },
{ NULL }
};
static const mozilla::Module kTestModule = {
mozilla::Module::kVersion,
kTestCIDs
};
NSMODULE_DEFN(dummy) = &kTestModule;

View File

@ -0,0 +1,2 @@
#filter substitution
binary-component @LIBRARY_FILENAME@

View File

@ -0,0 +1,10 @@
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const Cc = Components.classes;
const Ci = Components.interfaces;
function run_test() {
let manifest = do_get_file('testcompnoaslr.manifest');
Components.manager.autoRegister(manifest);
do_check_false("{335fb596-e52d-418f-b01c-1bf16ce5e7e4}" in Components.classesByID);
}

View File

@ -42,3 +42,5 @@ fail-if = os == "android"
# Bug 676998: test fails consistently on Android
fail-if = os == "android"
[test_versioncomparator.js]
[test_comp_no_aslr.js]
fail-if = os != "win"