chromeHelper.js (712B)
1 /* -*- Mode: javascript; indent-tabs-mode: nil; js-indent-level: 2 -*- */ 2 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* eslint-env mozilla/chrome-script */ 8 9 "use strict"; 10 11 // eslint-disable-next-line mozilla/use-services 12 const dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService( 13 Ci.nsIProperties 14 ); 15 16 addMessageListener("media-test:getcwd", () => { 17 let cwd; 18 try { 19 cwd = dirSvc.get("CurWorkD", Ci.nsIFile).path; 20 } finally { 21 sendAsyncMessage("media-test:cwd", cwd); 22 } 23 });