Richard Pospesel pushed to branch tor-browser-102.6.0esr-12.0-1 at The Tor Project / Applications / Tor Browser
Commits: 8825bcad by hackademix at 2022-12-14T13:34:31+00:00 Bug 41520: (Regression) Rearranging bookmarks / place items by drag & drop doesn't work anymore
- - - - - 8b01895e by hackademix at 2022-12-14T13:34:31+00:00 fixup! Bug 10760: Integrate TorButton to TorBrowser core
- - - - -
5 changed files:
- browser/components/places/PlacesUIUtils.jsm - browser/components/places/content/controller.js - dom/base/ContentAreaDropListener.jsm - toolkit/components/places/PlacesUtils.jsm - toolkit/torproject/torbutton
Changes:
===================================== browser/components/places/PlacesUIUtils.jsm ===================================== @@ -1903,7 +1903,11 @@ XPCOMUtils.defineLazyGetter(PlacesUIUtils, "URI_FLAVORS", () => { return [PlacesUtils.TYPE_X_MOZ_URL, TAB_DROP_TYPE, PlacesUtils.TYPE_UNICODE]; }); XPCOMUtils.defineLazyGetter(PlacesUIUtils, "SUPPORTED_FLAVORS", () => { - return [...PlacesUIUtils.PLACES_FLAVORS, ...PlacesUIUtils.URI_FLAVORS]; + return [ + ...PlacesUIUtils.PLACES_FLAVORS, + ...PlacesUIUtils.URI_FLAVORS, + "application/x-torbrowser-opaque", + ]; });
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ellipsis", function() {
===================================== browser/components/places/content/controller.js ===================================== @@ -1251,6 +1251,7 @@ PlacesController.prototype = { [ PlacesUtils.TYPE_X_MOZ_PLACE, PlacesUtils.TYPE_X_MOZ_URL, + "application/x-torbrowser-opaque", PlacesUtils.TYPE_UNICODE, ].forEach(type => xferable.addDataFlavor(type));
===================================== dom/base/ContentAreaDropListener.jsm ===================================== @@ -5,6 +5,16 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
+const { XPCOMUtils } = ChromeUtils.import( + "resource://gre/modules/XPCOMUtils.jsm" +); + +XPCOMUtils.defineLazyGetter(this, "gOpaqueDrag", () => { + return Cc["@torproject.org/torbutton-dragDropFilter;1"].getService( + Ci.nsISupports + ).wrappedJSObject.opaqueDrag; +}); + // This component is used for handling dragover and drop of urls. // // It checks to see whether a drop of a url is allowed. For instance, a url @@ -43,10 +53,15 @@ ContentAreaDropListener.prototype = { } }
- type = "text/x-moz-url"; - if (types.contains(type)) { + for (let type of ["text/x-moz-url", "application/x-torbrowser-opaque"]) { + if (!types.contains(type)) { + continue; + } data = dt.mozGetDataAt(type, i); if (data) { + if (type === "application/x-torbrowser-opaque") { + ({ type, value: data = "" } = gOpaqueDrag.get(data)); + } let lines = data.split("\n"); for (let i = 0, length = lines.length; i < length; i += 2) { this._addLink(links, lines[i], lines[i + 1], type); @@ -250,6 +265,7 @@ ContentAreaDropListener.prototype = { if ( !types.includes("application/x-moz-file") && !types.includes("text/x-moz-url") && + !types.includes("application/x-torbrowser-opaque") && !types.includes("text/uri-list") && !types.includes("text/x-moz-text-internal") && !types.includes("text/plain")
===================================== toolkit/components/places/PlacesUtils.jsm ===================================== @@ -32,6 +32,12 @@ XPCOMUtils.defineLazyGetter(this, "gCryptoHash", () => { return Cc["@mozilla.org/security/hash;1"].createInstance(Ci.nsICryptoHash); });
+XPCOMUtils.defineLazyGetter(this, "gOpaqueDrag", () => { + return Cc["@torproject.org/torbutton-dragDropFilter;1"].getService( + Ci.nsISupports + ).wrappedJSObject.opaqueDrag; +}); + // On Mac OSX, the transferable system converts "\r\n" to "\n\n", where // we really just want "\n". On other platforms, the transferable system // converts "\r\n" to "\n". @@ -1132,6 +1138,9 @@ var PlacesUtils = { unwrapNodes: function PU_unwrapNodes(blob, type) { // We split on "\n" because the transferable system converts "\r\n" to "\n" var nodes = []; + if (type === "application/x-torbrowser-opaque") { + ({ value: blob, type } = gOpaqueDrag.get(blob)); + } switch (type) { case this.TYPE_X_MOZ_PLACE: case this.TYPE_X_MOZ_PLACE_SEPARATOR:
===================================== toolkit/torproject/torbutton ===================================== @@ -1 +1 @@ -Subproject commit b0a2e740d6c7440cc9722358eb775c6a04f49e72 +Subproject commit a5767f29c0d509c6cb34527c091ae0c4bfc2f386
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/2657bbc...
tbb-commits@lists.torproject.org