1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 // Number of terminal entries for the self-xss prevention to go away
8 const CONSOLE_ENTRY_THRESHOLD = 5;
10 var WebConsoleUtils = {
11 CONSOLE_ENTRY_THRESHOLD,
14 * Wrap a string in an nsISupportsString object.
16 * @param string string
17 * @return nsISupportsString
19 supportsString(string) {
20 const str = Cc["@mozilla.org/supports-string;1"].createInstance(
28 * Value of devtools.selfxss.count preference
35 if (WebConsoleUtils._usageCount < CONSOLE_ENTRY_THRESHOLD) {
36 WebConsoleUtils._usageCount = Services.prefs.getIntPref(
37 "devtools.selfxss.count"
39 if (Services.prefs.getBoolPref("devtools.chrome.enabled")) {
40 WebConsoleUtils.usageCount = CONSOLE_ENTRY_THRESHOLD;
43 return WebConsoleUtils._usageCount;
45 set usageCount(newUC) {
46 if (newUC <= CONSOLE_ENTRY_THRESHOLD) {
47 WebConsoleUtils._usageCount = newUC;
48 Services.prefs.setIntPref("devtools.selfxss.count", newUC);
53 exports.Utils = WebConsoleUtils;