зеркало из https://github.com/mozilla/pjs.git
Bug 646306 - file is not defined in DirInstallLocation__readDirectoryFromFile. r=dtownsend
This commit is contained in:
Родитель
2b8f454193
Коммит
3065e9a7fa
|
@ -7217,7 +7217,7 @@ DirectoryInstallLocation.prototype = {
|
|||
linkedDirectory.initWithPath(line.value);
|
||||
}
|
||||
catch (e) {
|
||||
linkedDirectory.setRelativeDescriptor(file.parent, line.value);
|
||||
linkedDirectory.setRelativeDescriptor(aFile.parent, line.value);
|
||||
}
|
||||
|
||||
if (!linkedDirectory.exists()) {
|
||||
|
|
|
@ -64,6 +64,25 @@ function writePointer(aId, aName) {
|
|||
fos.close();
|
||||
}
|
||||
|
||||
function writeRelativePointer(aId, aName) {
|
||||
let file = profileDir.clone();
|
||||
file.append(aName ? aName : aId);
|
||||
|
||||
let absTarget = sourceDir.clone();
|
||||
absTarget.append(do_get_expected_addon_name(aId));
|
||||
|
||||
var relTarget = absTarget.QueryInterface(Ci.nsILocalFile)
|
||||
.getRelativeDescriptor(profileDir);
|
||||
|
||||
var fos = AM_Cc["@mozilla.org/network/file-output-stream;1"].
|
||||
createInstance(AM_Ci.nsIFileOutputStream);
|
||||
fos.init(file,
|
||||
FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE,
|
||||
FileUtils.PERMS_FILE, 0);
|
||||
fos.write(relTarget, relTarget.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
// pointer files only work with unpacked directories
|
||||
if (Services.prefs.getBoolPref("extensions.alwaysUnpack") == false)
|
||||
|
@ -352,7 +371,33 @@ function run_test_9() {
|
|||
pointer.append(addon1.id);
|
||||
do_check_false(pointer.exists());
|
||||
|
||||
end_test();
|
||||
run_test_10();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Tests that installing a new add-on by pointer with a relative path works
|
||||
function run_test_10() {
|
||||
writeInstallRDFForExtension(addon1, sourceDir);
|
||||
writeRelativePointer(addon1.id);
|
||||
|
||||
restartManager();
|
||||
|
||||
AddonManager.getAddonByID(addon1.id, function(a1) {
|
||||
do_check_neq(a1, null);
|
||||
do_check_eq(a1.version, "1.0");
|
||||
|
||||
let file = a1.getResourceURI().QueryInterface(AM_Ci.nsIFileURL).file;
|
||||
do_check_eq(file.parent.path, sourceDir.path);
|
||||
|
||||
let rootUri = do_get_addon_root_uri(sourceDir, addon1.id);
|
||||
let uri = a1.getResourceURI("/");
|
||||
do_check_eq(uri.spec, rootUri);
|
||||
uri = a1.getResourceURI("install.rdf");
|
||||
do_check_eq(uri.spec, rootUri + "install.rdf");
|
||||
|
||||
// Check that upgrade is disabled for addons installed by file-pointers.
|
||||
do_check_eq(a1.permissions & AddonManager.PERM_CAN_UPGRADE, 0);
|
||||
end_test();
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче