Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | const { Cc, Ci, Cu } = require("chrome"); |
michael@0 | 8 | const Services = require("Services"); |
michael@0 | 9 | const { OS } = require("resource://gre/modules/osfile.jsm"); |
michael@0 | 10 | const { devtools } = require("resource://gre/modules/devtools/Loader.jsm"); |
michael@0 | 11 | const gcli = require("gcli/index"); |
michael@0 | 12 | |
michael@0 | 13 | const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"] |
michael@0 | 14 | .getService(Ci.nsIStringBundleService) |
michael@0 | 15 | .createBundle("chrome://branding/locale/brand.properties") |
michael@0 | 16 | .GetStringFromName("brandShortName"); |
michael@0 | 17 | |
michael@0 | 18 | exports.items = [ |
michael@0 | 19 | { |
michael@0 | 20 | name: "tools", |
michael@0 | 21 | description: gcli.lookupFormat("toolsDesc2", [ BRAND_SHORT_NAME ]), |
michael@0 | 22 | manual: gcli.lookupFormat("toolsManual2", [ BRAND_SHORT_NAME ]), |
michael@0 | 23 | get hidden() gcli.hiddenByChromePref(), |
michael@0 | 24 | }, |
michael@0 | 25 | { |
michael@0 | 26 | name: "tools srcdir", |
michael@0 | 27 | description: gcli.lookup("toolsSrcdirDesc"), |
michael@0 | 28 | manual: gcli.lookupFormat("toolsSrcdirManual2", [ BRAND_SHORT_NAME ]), |
michael@0 | 29 | get hidden() gcli.hiddenByChromePref(), |
michael@0 | 30 | params: [ |
michael@0 | 31 | { |
michael@0 | 32 | name: "srcdir", |
michael@0 | 33 | type: "string" /* { |
michael@0 | 34 | name: "file", |
michael@0 | 35 | filetype: "directory", |
michael@0 | 36 | existing: "yes" |
michael@0 | 37 | } */, |
michael@0 | 38 | description: gcli.lookup("toolsSrcdirDir") |
michael@0 | 39 | } |
michael@0 | 40 | ], |
michael@0 | 41 | returnType: "string", |
michael@0 | 42 | exec: function(args, context) { |
michael@0 | 43 | let clobber = OS.Path.join(args.srcdir, "CLOBBER"); |
michael@0 | 44 | return OS.File.exists(clobber).then(function(exists) { |
michael@0 | 45 | if (exists) { |
michael@0 | 46 | let str = Cc["@mozilla.org/supports-string;1"] |
michael@0 | 47 | .createInstance(Ci.nsISupportsString); |
michael@0 | 48 | str.data = args.srcdir; |
michael@0 | 49 | Services.prefs.setComplexValue("devtools.loader.srcdir", |
michael@0 | 50 | Ci.nsISupportsString, str); |
michael@0 | 51 | devtools.reload(); |
michael@0 | 52 | |
michael@0 | 53 | let msg = gcli.lookupFormat("toolsSrcdirReloaded", [ args.srcdir ]); |
michael@0 | 54 | throw new Error(msg); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | return gcli.lookupFormat("toolsSrcdirNotFound", [ args.srcdir ]); |
michael@0 | 58 | }); |
michael@0 | 59 | } |
michael@0 | 60 | }, |
michael@0 | 61 | { |
michael@0 | 62 | name: "tools builtin", |
michael@0 | 63 | description: gcli.lookup("toolsBuiltinDesc"), |
michael@0 | 64 | manual: gcli.lookup("toolsBuiltinManual"), |
michael@0 | 65 | get hidden() gcli.hiddenByChromePref(), |
michael@0 | 66 | returnType: "string", |
michael@0 | 67 | exec: function(args, context) { |
michael@0 | 68 | Services.prefs.clearUserPref("devtools.loader.srcdir"); |
michael@0 | 69 | devtools.reload(); |
michael@0 | 70 | return gcli.lookup("toolsBuiltinReloaded"); |
michael@0 | 71 | } |
michael@0 | 72 | }, |
michael@0 | 73 | { |
michael@0 | 74 | name: "tools reload", |
michael@0 | 75 | description: gcli.lookup("toolsReloadDesc"), |
michael@0 | 76 | get hidden() { |
michael@0 | 77 | return gcli.hiddenByChromePref() || |
michael@0 | 78 | !Services.prefs.prefHasUserValue("devtools.loader.srcdir"); |
michael@0 | 79 | }, |
michael@0 | 80 | |
michael@0 | 81 | returnType: "string", |
michael@0 | 82 | exec: function(args, context) { |
michael@0 | 83 | devtools.reload(); |
michael@0 | 84 | return gcli.lookup("toolsReloaded2"); |
michael@0 | 85 | } |
michael@0 | 86 | } |
michael@0 | 87 | ]; |