Bug 1033568 - add pref for customizeToolbars security check, r=dao, a=sylvestre
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 03 Jul 2014 00:14:07 +0100
changeset 228794 62c43665c993aca3d6c2be6e7a437efce94270f0
parent 228793 8f5b7a72b37ea8b44316244ae73567e3381b51a0
child 228795 fa9cfb1d9b8ebe49e191d0faa4d8fdae98e792f6
push id6
push userryanvm@gmail.com
push dateMon, 12 Jan 2015 22:04:06 +0000
treeherdermozilla-b2g37_v2_2@895c8fc7b734 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, sylvestre
bugs1033568
milestone32.0a2
Bug 1033568 - add pref for customizeToolbars security check, r=dao, a=sylvestre
toolkit/content/customizeToolbar.js
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -4,16 +4,18 @@
 
 var gToolboxDocument = null;
 var gToolbox = null;
 var gCurrentDragOverItem = null;
 var gToolboxChanged = false;
 var gToolboxSheet = false;
 var gPaletteBox = null;
 
+Components.utils.import("resource://gre/modules/Services.jsm");
+
 function onLoad()
 {
   if ("arguments" in window && window.arguments[0]) {
     InitWithToolbox(window.arguments[0]);
     repositionDialog(window);
   }
   else if (window.frameElement &&
            "toolbox" in window.frameElement) {
@@ -452,19 +454,17 @@ function setDragActive(aItem, aValue)
       node.setAttribute("dragover", value);
   } else {
     node.removeAttribute("dragover");
   }
 }
 
 function addNewToolbar()
 {
-  var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
-                                .getService(Components.interfaces.nsIPromptService);
-
+  var promptService = Services.prompt;
   var stringBundle = document.getElementById("stringBundle");
   var message = stringBundle.getString("enterToolbarName");
   var title = stringBundle.getString("enterToolbarTitle");
 
   var name = {};
 
   // Quitting from the toolbar dialog while the new toolbar prompt is up
   // can cause things to become unresponsive on the Mac. Until dialog modality
@@ -814,16 +814,22 @@ function onPaletteDrop(aEvent)
     wrapper.parentNode.removeChild(wrapper);
   }
 
   toolboxChanged();
 }
 
 
 function isUnwantedDragEvent(aEvent) {
+  try {
+    if (Services.prefs.getBoolPref("toolkit.customization.unsafe_drag_events")) {
+      return false;
+    }
+  } catch (ex) {}
+
   /* Discard drag events that originated from a separate window to
      prevent content->chrome privilege escalations. */
   let mozSourceNode = aEvent.dataTransfer.mozSourceNode;
   // mozSourceNode is null in the dragStart event handler or if
   // the drag event originated in an external application.
   if (!mozSourceNode) {
     return true;
   }