toolkit-ui-lockdown.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 25 Jun 2012 11:08:07 +0200
branchfirefox13
changeset 489 f5ef195f348b
parent 24 ca988be0905b
permissions -rw-r--r--
13.0.2 with adopted mozilla-prefer_plugin_pref.patch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
From: various contributors
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
Subject: toolkit ui lockdown hooks
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
--- a/toolkit/components/passwordmgr/content/passwordManager.js
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
@@ -119,19 +119,28 @@ function LoadSignons() {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
   // SignonColumnSort) assumes we want to toggle the sort
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
   // direction but here we don't so we have to trick it
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
   lastSignonSortAscending = !lastSignonSortAscending;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
   SignonColumnSort(lastSignonSortColumn);
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
   // disable "remove all signons" button if there are no signons
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
   var element = document.getElementById("removeAllSignons");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
   var toggle = document.getElementById("togglePasswords");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
+  try {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
+    var viewLocked = Components.classes["@mozilla.org/preferences-service;1"]
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
+      .getService(Components.interfaces.nsIPrefBranch)
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
+      .getBoolPref("config.lockdown.showsavedpasswords");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
+  } catch (e) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
+    var viewLocked = false;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
+  }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
   if (signons.length == 0 || gSelectUserInUse) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
     element.setAttribute("disabled","true");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
     toggle.setAttribute("disabled","true");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
+  } else if (viewLocked) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
+    toggle.setAttribute("disabled","true");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
   } else {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
     element.removeAttribute("disabled");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
     toggle.removeAttribute("disabled");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
   }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
   return true;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
 }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
@@ -166,16 +175,28 @@ function DeleteAllSignons() {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
   var syncNeeded = (signonsTreeView._filterSet.length != 0);
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
   DeleteAllFromTree(signonsTree, signonsTreeView,
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
                         signonsTreeView._filterSet.length ? signonsTreeView._filterSet : signons,
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
                         deletedSignons, "removeSignon", "removeAllSignons");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
   FinalizeSignonDeletions(syncNeeded);
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
 }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
 function TogglePasswordVisible() {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
+  try {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
+    var viewLocked = Components.classes["@mozilla.org/preferences-service;1"]
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
+      .getService(Components.interfaces.nsIPrefBranch)
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
+      .getBoolPref("config.lockdown.showsavedpasswords");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
+  } catch (e) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
+    var viewLocked = false;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
+  }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
+  // at that point if viewLocked is true, we shouldn't reach this code,
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
+  // but better be safe than sorry.
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
+  if (viewLocked) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
+    return;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
+  }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
   if (showingPasswords || ConfirmShowPasswords()) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
     showingPasswords = !showingPasswords;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
     document.getElementById("togglePasswords").label = kSignonBundle.getString(showingPasswords ? "hidePasswords" : "showPasswords");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
     document.getElementById("togglePasswords").accessKey = kSignonBundle.getString(showingPasswords ? "hidePasswordsAccessKey" : "showPasswordsAccessKey");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
     document.getElementById("passwordCol").hidden = !showingPasswords;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
     _filterPasswords();
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
   }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
diff --git a/toolkit/components/printing/content/printdialog.js b/toolkit/components/printing/content/printdialog.js
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
--- a/toolkit/components/printing/content/printdialog.js
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
+++ b/toolkit/components/printing/content/printdialog.js
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
@@ -45,16 +45,17 @@ var printService       = null;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
 var gOriginalNumCopies = 1;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
 var paramBlock;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
 var gPrefs             = null;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
 var gPrintSettings     = null;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
 var gWebBrowserPrint   = null;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
 var gPrintSetInterface = Components.interfaces.nsIPrintSettings;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
 var doDebug            = false;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
+var gPrefService       = null;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
 //---------------------------------------------------
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
 function initDialog()
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
 {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
   dialog = new Object;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
   dialog.propertiesButton = document.getElementById("properties");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
   dialog.descText         = document.getElementById("descText");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
@@ -82,21 +83,33 @@ function initDialog()
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
   dialog.printButton     = document.documentElement.getButton("accept");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
   // <data> elements
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
   dialog.printName       = document.getElementById("printButton");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
   dialog.fpDialog        = document.getElementById("fpDialog");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
   dialog.enabled         = false;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
+
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
+  gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
+      .getService(Components.interfaces.nsIPrefService).getBranch(null);
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
+  if (gPrefService.getBoolPref("config.lockdown.savepage")) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
+    dialog.fileCheck.setAttribute("disabled", "true");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
+  }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
+  if (gPrefService.getBoolPref("config.lockdown.printing")) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
+    dialog.printButton.setAttribute("disabled", "true");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
+  }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
 }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
 
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
 //---------------------------------------------------
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
 function checkInteger(element)
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
 {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
+  if (gPrefService.getBoolPref("config.lockdown.printing"))
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
+    return;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
+
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
   var value = element.value;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
   if (value && value.length > 0) {
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
     value = value.replace(/[^0-9]/g,"");
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
     if (!value) value = "";
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
     element.value = value;
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
   }
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
   if (!value || value < 1 || value > 999)
ca988be0905b Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
     dialog.printButton.setAttribute("disabled","true");