Merge m-c to inbound on a CLOSED TREE.

This commit is contained in:
Ryan VanderMeulen 2013-07-23 16:14:26 -04:00
commit a95c9e4ba5
7 changed files with 179 additions and 62 deletions

View File

@ -1,4 +1,4 @@
{
"revision": "d39f167ee1b770d2312a7b35bbcb29afe83b5c4f",
"revision": "5c08f3d8a2b96b15b232dae43a2428fcdca61a79",
"repo_path": "/integration/gaia-central"
}

View File

@ -1,7 +1,7 @@
[
{
"size": 141304652,
"digest": "0bbba7483a483803fa0277ddeeb3f8f9592b57cb83d57794c366fb8a3541b47f0ab901c071b7ceb6828bceec7170e5d5c05c5b1dcc926c70f3da46a7e224f078",
"size": 117247732,
"digest": "16e74278e4e9b0d710df77d68af1677c91823dccfc611ab00ee617298a63787f9f9892bd1a41eccb8d45fb18d61bfda0dbd1de88f1861c14b4b44da3b94a4eca",
"algorithm": "sha512",
"filename": "backup-leo.tar.xz"
},

View File

@ -67,8 +67,21 @@ function testBreakOnAll()
});
gThreadClient.resume(function() {
// Make sure that the focus is not on the input box so that a focus event
// will be triggered.
window.focus();
gBrowser.selectedBrowser.focus();
gButton.focus();
// Focus the element and wait for focus event.
gInput.addEventListener("focus", function onfocus() {
gInput.removeEventListener("focus", onfocus, false);
executeSoon(function() {
EventUtils.synthesizeKey("e", { shiftKey: 1 }, content);
});
}, false);
gInput.focus();
EventUtils.synthesizeKey("e", { shiftKey: 1 }, content);
});
});
});
@ -94,8 +107,21 @@ function testBreakOnDisabled()
testBreakOnNone();
}, false);
// Make sure that the focus is not on the input box so that a focus event
// will be triggered.
window.focus();
gBrowser.selectedBrowser.focus();
gButton.focus();
// Focus the element and wait for focus event.
gInput.addEventListener("focus", function onfocus() {
gInput.removeEventListener("focus", onfocus, false);
executeSoon(function() {
EventUtils.synthesizeKey("e", { shiftKey: 1 }, content);
});
}, false);
gInput.focus();
EventUtils.synthesizeKey("e", { shiftKey: 1 }, content);
});
}
@ -117,8 +143,21 @@ function testBreakOnNone()
testBreakOnClick();
}, false);
// Make sure that the focus is not on the input box so that a focus event
// will be triggered.
window.focus();
gBrowser.selectedBrowser.focus();
gButton.focus();
// Focus the element and wait for focus event.
gInput.addEventListener("focus", function onfocus() {
gInput.removeEventListener("focus", onfocus, false);
executeSoon(function() {
EventUtils.synthesizeKey("g", { shiftKey: 1 }, content);
});
}, false);
gInput.focus();
EventUtils.synthesizeKey("g", { shiftKey: 1 }, content);
});
}

View File

@ -2545,31 +2545,6 @@ this.DOMApplicationRegistry = {
throw "INSTALL_FROM_DENIED";
}
// Get ids.json if the file is signed
if (isSigned) {
let idsStream;
try {
idsStream = zipReader.getInputStream("META-INF/ids.json");
} catch (e) {
throw zipReader.hasEntry("META-INF/ids.json")
? e
: "MISSING_IDS_JSON";
}
let ids =
JSON.parse(
converter.ConvertToUnicode(
NetUtil.readInputStreamToString(
idsStream, idsStream.available()) || ""));
if ((!ids.id) || !Number.isInteger(ids.version) ||
(ids.version <= 0)) {
throw "INVALID_IDS_JSON";
}
let storeId = aApp.installOrigin + "#" + ids.id;
checkForStoreIdMatch(storeId, ids.version);
app.storeId = storeId;
app.storeVersion = ids.version;
}
let maxStatus = isSigned ? Ci.nsIPrincipal.APP_STATUS_PRIVILEGED
: Ci.nsIPrincipal.APP_STATUS_INSTALLED;
@ -2614,38 +2589,67 @@ this.DOMApplicationRegistry = {
throw "INVALID_ORIGIN";
}
// Changing the origin during an update is not allowed.
if (aIsUpdate && uri.prePath != app.origin) {
throw "INVALID_ORIGIN_CHANGE";
if (aIsUpdate) {
// Changing the origin during an update is not allowed.
if (uri.prePath != app.origin) {
throw "INVALID_ORIGIN_CHANGE";
}
// Nothing else to do for an update... since the
// origin can't change we don't need to move the
// app nor can we have a duplicated origin
} else {
debug("Setting origin to " + uri.prePath +
" for " + app.manifestURL);
let newId = uri.prePath.substring(6); // "app://".length
if (newId in self.webapps) {
throw "DUPLICATE_ORIGIN";
}
app.origin = uri.prePath;
app.id = newId;
self.webapps[newId] = app;
delete self.webapps[id];
// Rename the directories where the files are installed.
[DIRECTORY_NAME, "TmpD"].forEach(function(aDir) {
let parent = FileUtils.getDir(aDir,
["webapps"], true, true);
let dir = FileUtils.getDir(aDir,
["webapps", id], true, true);
dir.moveTo(parent, newId);
});
// Signals that we need to swap the old id with the new app.
self.broadcastMessage("Webapps:RemoveApp", { id: id });
self.broadcastMessage("Webapps:AddApp", { id: newId,
app: app });
}
}
debug("Setting origin to " + uri.prePath +
" for " + app.manifestURL);
let newId = uri.prePath.substring(6); // "app://".length
if (newId in self.webapps) {
throw "DUPLICATE_ORIGIN";
// Get ids.json if the file is signed
if (isSigned) {
let idsStream;
try {
idsStream = zipReader.getInputStream("META-INF/ids.json");
} catch (e) {
throw zipReader.hasEntry("META-INF/ids.json")
? e
: "MISSING_IDS_JSON";
}
app.origin = uri.prePath;
// Update the registry.
app.id = newId;
self.webapps[newId] = app;
delete self.webapps[id];
// Rename the directories where the files are installed.
[DIRECTORY_NAME, "TmpD"].forEach(function(aDir) {
let parent = FileUtils.getDir(aDir,
["webapps"], true, true);
let dir = FileUtils.getDir(aDir,
["webapps", id], true, true);
dir.moveTo(parent, newId);
});
// Signals that we need to swap the old id with the new app.
self.broadcastMessage("Webapps:RemoveApp", { id: id });
self.broadcastMessage("Webapps:AddApp", { id: newId,
app: app });
let ids =
JSON.parse(
converter.ConvertToUnicode(
NetUtil.readInputStreamToString(
idsStream, idsStream.available()) || ""));
if ((!ids.id) || !Number.isInteger(ids.version) ||
(ids.version <= 0)) {
throw "INVALID_IDS_JSON";
}
let storeId = aApp.installOrigin + "#" + ids.id;
checkForStoreIdMatch(storeId, ids.version);
app.storeId = storeId;
app.storeVersion = ids.version;
}
if (aOnSuccess) {

View File

@ -264,8 +264,9 @@ BrowserElementChild.prototype = {
},
observe: function(subject, topic, data) {
// Ignore notifications not about our document.
if (subject != content.document)
// Ignore notifications not about our document. (Note that |content| /can/
// be null; see bug 874900.)
if (!content || subject != content.document)
return;
switch (topic) {
case 'fullscreen-origin-change':

View File

@ -18,6 +18,7 @@
#include <android/log.h>
#include "AutoMounter.h"
#include "nsVolumeService.h"
#include "AutoMounterSetting.h"
#include "base/message_loop.h"
#include "mozilla/FileUtils.h"
@ -567,9 +568,68 @@ public:
static StaticRefPtr<UsbCableObserver> sUsbCableObserver;
static StaticRefPtr<AutoMounterSetting> sAutoMounterSetting;
static void
InitVolumeConfig()
{
// This function uses /system/etc/volume.cfg to add additional volumes
// to the Volume Manager.
//
// This is useful on devices like the Nexus 4, which have no physical sd card
// or dedicated partition.
//
// The format of the volume.cfg file is as follows:
// create volume-name mount-point
// Blank lines and lines starting with the hash character "#" will be ignored.
nsCOMPtr<nsIVolumeService> vs = do_GetService(NS_VOLUMESERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(vs);
ScopedCloseFile fp;
int n = 0;
char line[255];
char *command, *vol_name_cstr, *mount_point_cstr, *save_ptr;
const char *filename = "/system/etc/volume.cfg";
if (!(fp = fopen(filename, "r"))) {
LOG("Unable to open volume configuration file '%s' - ignoring", filename);
return;
}
while(fgets(line, sizeof(line), fp)) {
char *delim = " \t\n";
n++;
if (line[0] == '#')
continue;
if (!(command = strtok_r(line, delim, &save_ptr))) {
// Blank line - ignore
continue;
}
if (!strcmp(command, "create")) {
if (!(vol_name_cstr = strtok_r(NULL, delim, &save_ptr))) {
ERR("No vol_name in %s line %d", filename, n);
continue;
}
if (!(mount_point_cstr = strtok_r(NULL, delim, &save_ptr))) {
ERR("No mount point for volume '%s'. %s line %d", vol_name_cstr, filename, n);
continue;
}
nsString mount_point = NS_ConvertUTF8toUTF16(mount_point_cstr);
nsString vol_name = NS_ConvertUTF8toUTF16(vol_name_cstr);
nsresult rv;
rv = vs->CreateFakeVolume(vol_name, mount_point);
NS_ENSURE_SUCCESS_VOID(rv);
rv = vs->SetFakeVolumeState(vol_name, nsIVolume::STATE_MOUNTED);
NS_ENSURE_SUCCESS_VOID(rv);
}
else {
ERR("Unrecognized command: '%s'", command);
}
}
}
void
InitAutoMounter()
{
InitVolumeConfig();
InitVolumeManager();
sAutoMounterSetting = new AutoMounterSetting();

View File

@ -68,6 +68,19 @@ struct ScopedClosePRFDTraits
};
typedef Scoped<ScopedClosePRFDTraits> AutoFDClose;
/* RAII wrapper for FILE descriptors */
struct ScopedCloseFileTraits
{
typedef FILE *type;
static type empty() { return nullptr; }
static void release(type f) {
if (f) {
fclose(f);
}
}
};
typedef Scoped<ScopedCloseFileTraits> ScopedCloseFile;
/**
* Fallocate efficiently and continuously allocates files via fallocate-type APIs.
* This is useful for avoiding fragmentation.