32 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
37 library.setProperty(SBProperties.isReadOnly,
null);
42 var list = library.createMediaList(
"simple");
46 list.setProperty(SBProperties.isReadOnly,
"1");
48 list.setProperty(SBProperties.isReadOnly,
null);
57 item.setProperty(SBProperties.isReadOnly,
"1");
59 item.setProperty(SBProperties.isReadOnly,
null);
63 library.setProperty(SBProperties.isReadOnly,
"1");
67 library.setProperty(SBProperties.isReadOnly,
null);
73 file.permissions = 0400;
75 file.permissions = 0664;
81 file.append(
"file-that-doesnt-exist.mp3");
83 assertTrue(!item.userEditable,
"Non-existent files are read-only.");
86 item.contentSrc =
newURI(
"http://example.com/foo.mp3");
87 assertTrue(item.userEditable,
"Remote files are user editable.");
92 var
file = Components.classes[
"@mozilla.org/file/directory_service;1"]
93 .getService(Components.interfaces.nsIProperties)
94 .get(
"TmpD", Components.interfaces.nsIFile);
96 file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0664);
97 var registerFileForDelete =
Cc[
"@mozilla.org/uriloader/external-helper-app-service;1"]
98 .getService(
Ci.nsPIExternalAppLauncher);
99 registerFileForDelete.deleteTemporaryFileOnExit(file);
function assertTrue(aTest, aMessage)
function runTest()
Confirm that sbILibraryResource.userEditable works as expected.
function newFileURI(file)
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
function newTempFile(name)