Closed Bug 1298467 Opened 10 years ago Closed 8 years ago

writeInstallRDFTo{Dir,XPI} should pass files object for aExtraFile

Categories

(Toolkit :: Add-ons Manager, defect, P5)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: rhelmer, Unassigned, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: triaged)

Both writeInstallRDFToDir and writeInstallRDFToXPI take this argument: * @param aExtraFile * An optional dummy file to create in the directory This isn't really very useful in practice. If for example you want to build an extension and inject a custom bootstrap.js, the pattern is: writeInstallRDFToDir({...}, aExtraFile="bootstrap.js"); // create and copy bootstrap.js into the directory There isn't really an easy way to do this for XPI files (technically you could add the file to the zip, but no tests right now do this). To make this less cumbersome, aExtraFile should instead be plural and an object of {name: content} that the underlying AddonTestUtils methods already understand: * @param {Object} aExtraFiles * An optional object containing file names and their contents. An example use of this would be: writeInstallRDFToDir({...}, aExtraFiles={"bootstrap.js": `startup() {}`); The most common bootstrap.js to inject is to use BootstrapMonitor.jsm so we should consider providing an argument to the writeInstallRDF test functions so tests don't need to do this themselves: writeInstallRDFToDir({...}, bootstrapMonitor=true); This would create a files object containing: "bootstrap.js": `Components.utils.import("resource://xpcshell-data/BootstrapMonitor.jsm").monitor(this);`
Priority: -- → P5
Whiteboard: triaged
Blocks: 557710
Assignee: rhelmer → nobody
Keywords: good-first-bug
Mentor: rhelmer
Looks like Kris did this in bug 1420775
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.