js: Add support for plugins to set cookies directly

refs #1796