How exactly are you trying to run your javascript? Website javascript certainly won’t be allowed to create bookmarks. If you run the function on browser side however, then it should work fine - but then I don’t understand why it’s wrapped into javascript url.
If it’s a javascript: url because you tried to run this as bookmark itself (ie. clicking this special bookmark creates another bookmark folder and a bookmark inside it) then that’s not going to work because that’s pretty much just user provided code running in website context.
Go to about:config and set the pref
browser.ml.chat.hideLocalhost
tofalse
Afterwards you can select localhost as the provider in Settings > Firefox Labs