It should be as simple as `Cu.import("resource://gre/modules/WebappOSUtils.jsm");` and then `WebappOSUtils.sanitizeStringForFilename()` instead of `slugify()`.