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
-
8b01895e
by hackademix at 2022-12-14T13:34:31+00:00
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:
| ... | ... | @@ -1903,7 +1903,11 @@ XPCOMUtils.defineLazyGetter(PlacesUIUtils, "URI_FLAVORS", () => { |
| 1903 | 1903 | return [PlacesUtils.TYPE_X_MOZ_URL, TAB_DROP_TYPE, PlacesUtils.TYPE_UNICODE];
|
| 1904 | 1904 | });
|
| 1905 | 1905 | XPCOMUtils.defineLazyGetter(PlacesUIUtils, "SUPPORTED_FLAVORS", () => {
|
| 1906 | - return [...PlacesUIUtils.PLACES_FLAVORS, ...PlacesUIUtils.URI_FLAVORS];
|
|
| 1906 | + return [
|
|
| 1907 | + ...PlacesUIUtils.PLACES_FLAVORS,
|
|
| 1908 | + ...PlacesUIUtils.URI_FLAVORS,
|
|
| 1909 | + "application/x-torbrowser-opaque",
|
|
| 1910 | + ];
|
|
| 1907 | 1911 | });
|
| 1908 | 1912 | |
| 1909 | 1913 | XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ellipsis", function() {
|
| ... | ... | @@ -1251,6 +1251,7 @@ PlacesController.prototype = { |
| 1251 | 1251 | [
|
| 1252 | 1252 | PlacesUtils.TYPE_X_MOZ_PLACE,
|
| 1253 | 1253 | PlacesUtils.TYPE_X_MOZ_URL,
|
| 1254 | + "application/x-torbrowser-opaque",
|
|
| 1254 | 1255 | PlacesUtils.TYPE_UNICODE,
|
| 1255 | 1256 | ].forEach(type => xferable.addDataFlavor(type));
|
| 1256 | 1257 |
| ... | ... | @@ -5,6 +5,16 @@ |
| 5 | 5 | const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
| 6 | 6 | const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
| 7 | 7 | |
| 8 | +const { XPCOMUtils } = ChromeUtils.import(
|
|
| 9 | + "resource://gre/modules/XPCOMUtils.jsm"
|
|
| 10 | +);
|
|
| 11 | + |
|
| 12 | +XPCOMUtils.defineLazyGetter(this, "gOpaqueDrag", () => {
|
|
| 13 | + return Cc["@torproject.org/torbutton-dragDropFilter;1"].getService(
|
|
| 14 | + Ci.nsISupports
|
|
| 15 | + ).wrappedJSObject.opaqueDrag;
|
|
| 16 | +});
|
|
| 17 | + |
|
| 8 | 18 | // This component is used for handling dragover and drop of urls.
|
| 9 | 19 | //
|
| 10 | 20 | // It checks to see whether a drop of a url is allowed. For instance, a url
|
| ... | ... | @@ -43,10 +53,15 @@ ContentAreaDropListener.prototype = { |
| 43 | 53 | }
|
| 44 | 54 | }
|
| 45 | 55 | |
| 46 | - type = "text/x-moz-url";
|
|
| 47 | - if (types.contains(type)) {
|
|
| 56 | + for (let type of ["text/x-moz-url", "application/x-torbrowser-opaque"]) {
|
|
| 57 | + if (!types.contains(type)) {
|
|
| 58 | + continue;
|
|
| 59 | + }
|
|
| 48 | 60 | data = dt.mozGetDataAt(type, i);
|
| 49 | 61 | if (data) {
|
| 62 | + if (type === "application/x-torbrowser-opaque") {
|
|
| 63 | + ({ type, value: data = "" } = gOpaqueDrag.get(data));
|
|
| 64 | + }
|
|
| 50 | 65 | let lines = data.split("\n");
|
| 51 | 66 | for (let i = 0, length = lines.length; i < length; i += 2) {
|
| 52 | 67 | this._addLink(links, lines[i], lines[i + 1], type);
|
| ... | ... | @@ -250,6 +265,7 @@ ContentAreaDropListener.prototype = { |
| 250 | 265 | if (
|
| 251 | 266 | !types.includes("application/x-moz-file") &&
|
| 252 | 267 | !types.includes("text/x-moz-url") &&
|
| 268 | + !types.includes("application/x-torbrowser-opaque") &&
|
|
| 253 | 269 | !types.includes("text/uri-list") &&
|
| 254 | 270 | !types.includes("text/x-moz-text-internal") &&
|
| 255 | 271 | !types.includes("text/plain")
|
| ... | ... | @@ -32,6 +32,12 @@ XPCOMUtils.defineLazyGetter(this, "gCryptoHash", () => { |
| 32 | 32 | return Cc["@mozilla.org/security/hash;1"].createInstance(Ci.nsICryptoHash);
|
| 33 | 33 | });
|
| 34 | 34 | |
| 35 | +XPCOMUtils.defineLazyGetter(this, "gOpaqueDrag", () => {
|
|
| 36 | + return Cc["@torproject.org/torbutton-dragDropFilter;1"].getService(
|
|
| 37 | + Ci.nsISupports
|
|
| 38 | + ).wrappedJSObject.opaqueDrag;
|
|
| 39 | +});
|
|
| 40 | + |
|
| 35 | 41 | // On Mac OSX, the transferable system converts "\r\n" to "\n\n", where
|
| 36 | 42 | // we really just want "\n". On other platforms, the transferable system
|
| 37 | 43 | // converts "\r\n" to "\n".
|
| ... | ... | @@ -1132,6 +1138,9 @@ var PlacesUtils = { |
| 1132 | 1138 | unwrapNodes: function PU_unwrapNodes(blob, type) {
|
| 1133 | 1139 | // We split on "\n" because the transferable system converts "\r\n" to "\n"
|
| 1134 | 1140 | var nodes = [];
|
| 1141 | + if (type === "application/x-torbrowser-opaque") {
|
|
| 1142 | + ({ value: blob, type } = gOpaqueDrag.get(blob));
|
|
| 1143 | + }
|
|
| 1135 | 1144 | switch (type) {
|
| 1136 | 1145 | case this.TYPE_X_MOZ_PLACE:
|
| 1137 | 1146 | case this.TYPE_X_MOZ_PLACE_SEPARATOR:
|
| 1 | -Subproject commit b0a2e740d6c7440cc9722358eb775c6a04f49e72 |
|
| 1 | +Subproject commit a5767f29c0d509c6cb34527c091ae0c4bfc2f386 |