lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

October 2016

  • 1 participants
  • 61 discussions
[tor-browser/tor-browser-45.4.0esr-6.5-1] Bug 1249522, when a file is present, only specify file type, r=smaug
by gk@torproject.org 28 Oct '16

28 Oct '16
commit 3bfc8bc8ea3a87010c2203f752af19b29bf4c0b2 Author: Neil Deakin <neil(a)mozilla.com> Date: Wed May 11 10:04:19 2016 -0400 Bug 1249522, when a file is present, only specify file type, r=smaug --- browser/base/content/test/general/browser.ini | 2 + .../test/general/browser_clipboard_pastefile.js | 59 +++++++++++++++++++++ .../content/test/general/clipboard_pastefile.html | 37 +++++++++++++ dom/events/DataTransfer.cpp | 60 +++++++++++++--------- dom/events/DataTransfer.h | 3 +- .../mochitest/chrome/test_sanityChromeUtils.xul | 4 +- 6 files changed, 139 insertions(+), 26 deletions(-) diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index 44e5d15..3224ce5 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -25,6 +25,7 @@ support-files = bug792517.html bug792517.sjs bug839103.css + clipboard_pastefile.html discovery.html domplate_test.js download_page.html @@ -283,6 +284,7 @@ skip-if = os == 'win' || e10s # Bug 1159268 - Need a content-process safe versio [browser_canonizeURL.js] skip-if = e10s # Bug 1094510 - test hits the network in e10s mode only [browser_clipboard.js] +[browser_clipboard_pastefile.js] [browser_contentAreaClick.js] [browser_contextSearchTabPosition.js] skip-if = os == "mac" || e10s # bug 967013; e10s: bug 1094761 - test hits the network in e10s, causing next test to crash diff --git a/browser/base/content/test/general/browser_clipboard_pastefile.js b/browser/base/content/test/general/browser_clipboard_pastefile.js new file mode 100644 index 0000000..094628f --- /dev/null +++ b/browser/base/content/test/general/browser_clipboard_pastefile.js @@ -0,0 +1,59 @@ +// This test is used to check that pasting files removes all non-file data from +// event.clipboardData. + +add_task(function*() { + var searchbar = document.getElementById("searchbar"); + + searchbar.focus(); + searchbar.value = "Text"; + searchbar.select(); + + yield new Promise((resolve, reject) => { + searchbar.addEventListener("copy", function copyEvent(event) { + searchbar.removeEventListener("copy", copyEvent, true); + event.clipboardData.setData("text/plain", "Alternate"); + // For this test, it doesn't matter that the file isn't actually a file. + event.clipboardData.setData("application/x-moz-file", "Sample"); + event.preventDefault(); + resolve(); + }, true) + + EventUtils.synthesizeKey("c", { accelKey: true }); + }); + + let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, + "https://example.com/browser/browser/base/content/test/general/clipboard_pas…"); + let browser = tab.linkedBrowser; + + yield ContentTask.spawn(browser, { }, function* (arg) { + content.document.getElementById("input").focus(); + }); + + yield BrowserTestUtils.synthesizeKey("v", { accelKey: true }, browser); + + let output = yield ContentTask.spawn(browser, { }, function* (arg) { + return content.document.getElementById("output").textContent; + }); + is (output, "Passed", "Paste file"); + + searchbar.focus(); + + yield new Promise((resolve, reject) => { + searchbar.addEventListener("paste", function copyEvent(event) { + searchbar.removeEventListener("paste", copyEvent, true); + + let dt = event.clipboardData; + is(dt.types.length, 3, "number of types"); + ok(dt.types.contains("text/plain"), "text/plain exists in types"); + ok(dt.mozTypesAt(0).contains("text/plain"), "text/plain exists in mozTypesAt"); + is(dt.getData("text/plain"), "Alternate", "text/plain returned in getData"); + is(dt.mozGetDataAt("text/plain", 0), "Alternate", "text/plain returned in mozGetDataAt"); + + resolve(); + }, true); + + EventUtils.synthesizeKey("v", { accelKey: true }); + }); + + yield BrowserTestUtils.removeTab(tab); +}); diff --git a/browser/base/content/test/general/clipboard_pastefile.html b/browser/base/content/test/general/clipboard_pastefile.html new file mode 100644 index 0000000..fcbf60e --- /dev/null +++ b/browser/base/content/test/general/clipboard_pastefile.html @@ -0,0 +1,37 @@ +<html><body> +<script> +function checkPaste(event) +{ + let output = document.getElementById("output"); + output.textContent = checkPasteHelper(event); +} + +function checkPasteHelper(event) +{ + let dt = event.clipboardData; + if (dt.types.length != 2) + return "Wrong number of types; got " + dt.types.length; + + for (let type of dt.types) { + if (type != "Files" && type != "application/x-moz-file") + return "Invalid type for types; got" + type; + } + + for (let type of dt.mozTypesAt(0)) { + if (type != "Files" && type != "application/x-moz-file") + return "Invalid type for mozTypesAt; got" + type; + } + + if (dt.getData("text/plain")) + return "text/plain found with getData"; + if (dt.mozGetDataAt("text/plain", 0)) + return "text/plain found with mozGetDataAt"; + + return "Passed"; +} +</script> + +<input id="input" onpaste="checkPaste(event)"> +<div id="output"></div> + +</body></html> diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index 2ad0eff..a6c9342 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -359,25 +359,8 @@ DataTransfer::GetFiles(nsIDOMFileList** aFileList) already_AddRefed<DOMStringList> DataTransfer::Types() { - RefPtr<DOMStringList> types = new DOMStringList(); - if (mItems.Length()) { - bool addFile = false; - const nsTArray<TransferItem>& item = mItems[0]; - for (uint32_t i = 0; i < item.Length(); i++) { - const nsString& format = item[i].mFormat; - types->Add(format); - if (!addFile) { - addFile = format.EqualsASCII(kFileMime) || - format.EqualsASCII("application/x-moz-file-promise"); - } - } - - if (addFile) { - types->Add(NS_LITERAL_STRING("Files")); - } - } - - return types.forget(); + ErrorResult rv; + return MozTypesAt(0, rv); } NS_IMETHODIMP @@ -545,7 +528,7 @@ DataTransfer::GetMozSourceNode(nsIDOMNode** aSourceNode) } already_AddRefed<DOMStringList> -DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) +DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) const { // Only the first item is valid for clipboard events if (aIndex > 0 && @@ -557,10 +540,28 @@ DataTransfer::MozTypesAt(uint32_t aIndex, ErrorResult& aRv) RefPtr<DOMStringList> types = new DOMStringList(); if (aIndex < mItems.Length()) { + bool addFile = false; // note that you can retrieve the types regardless of their principal - nsTArray<TransferItem>& item = mItems[aIndex]; - for (uint32_t i = 0; i < item.Length(); i++) - types->Add(item[i].mFormat); + const nsTArray<TransferItem>& item = mItems[aIndex]; + for (uint32_t i = 0; i < item.Length(); i++) { + const nsString& format = item[i].mFormat; + types->Add(format); + if (!addFile) { + addFile = format.EqualsASCII(kFileMime); + } + } + + if (addFile) { + // If this is a content caller, and a file is in the data transfer, remove + // the non-file types. This prevents alternate text forms of the file + // from being returned. + if (!nsContentUtils::LegacyIsCallerChromeOrNativeCode()) { + types->Clear(); + types->Add(NS_LITERAL_STRING(kFileMime)); + } + + types->Add(NS_LITERAL_STRING("Files")); + } } return types.forget(); @@ -602,12 +603,23 @@ DataTransfer::GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex, return NS_ERROR_DOM_INDEX_SIZE_ERR; } - nsAutoString format; GetRealFormat(aFormat, format); nsTArray<TransferItem>& item = mItems[aIndex]; + // If this is a content caller, and a file is in the data transfer, only + // return the file type. + if (!format.EqualsLiteral(kFileMime) && + !nsContentUtils::IsSystemPrincipal(aSubjectPrincipal)) { + uint32_t count = item.Length(); + for (uint32_t i = 0; i < count; i++) { + if (item[i].mFormat.EqualsLiteral(kFileMime)) { + return NS_OK; + } + } + } + // Check if the caller is allowed to access the drag data. Callers with // chrome privileges can always read the data. During the // drop event, allow retrieving the data except in the case where the diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index 2b1f90a..48fbac9 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -165,7 +165,8 @@ public: } } already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex, - mozilla::ErrorResult& aRv); + mozilla::ErrorResult& aRv) const; + void MozClearDataAt(const nsAString& aFormat, uint32_t aIndex, mozilla::ErrorResult& aRv); void MozSetDataAt(JSContext* aCx, const nsAString& aFormat, diff --git a/testing/mochitest/chrome/test_sanityChromeUtils.xul b/testing/mochitest/chrome/test_sanityChromeUtils.xul index ca1915b..f3ac45d 100644 --- a/testing/mochitest/chrome/test_sanityChromeUtils.xul +++ b/testing/mochitest/chrome/test_sanityChromeUtils.xul @@ -65,7 +65,9 @@ var dragfile = [[ { type : "application/x-moz-file", data : testFile, - eqTest : function(actualData, expectedData) {return expectedData.equals(actualData);} } + eqTest : function(actualData, expectedData) {return expectedData.equals(actualData);} }, + { type : "Files", + data : null } ]]; function doOnDrop(aEvent) {
1 0
0 0
[tor-browser/tor-browser-45.4.0esr-6.5-1] Bug 1270277, HasDataMatchingFlavors should only return true for text/unicode, r=snorp
by gk@torproject.org 28 Oct '16

28 Oct '16
commit dc9533fe8ec258aff8bf7c99c9d20586e6f58e5a Author: Neil Deakin <neil(a)mozilla.com> Date: Wed May 11 10:04:19 2016 -0400 Bug 1270277, HasDataMatchingFlavors should only return true for text/unicode, r=snorp --- dom/base/test/test_bug116083.html | 23 +++++++++++++++-------- widget/android/nsClipboard.cpp | 9 ++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/dom/base/test/test_bug116083.html b/dom/base/test/test_bug116083.html index dfdef8d..0d37242 100644 --- a/dom/base/test/test_bug116083.html +++ b/dom/base/test/test_bug116083.html @@ -52,15 +52,22 @@ const Cc = SpecialPowers.Cc; const Ci = SpecialPowers.Ci; function hasExpectedFlavors() { - var flavors = [ - "text/plain", - "text/html", - "application/x-moz-nativehtml", - ]; var cb = Cc["@mozilla.org/widget/clipboard;1"]. getService(Ci.nsIClipboard); - return cb.hasDataMatchingFlavors(flavors, flavors.length, - cb.kGlobalClipboard); + + ok(cb.hasDataMatchingFlavors(["text/unicode"], 1, cb.kGlobalClipboard), + "The clipboard has text/unicode"); + + // Android only supports plain text + if (navigator.appVersion.indexOf("Android") == -1) { + ok(cb.hasDataMatchingFlavors(["text/html"], 1, cb.kGlobalClipboard), + "The clipboard has text/html"); + } + + if (navigator.appVersion.indexOf("Win") >= 0) { + ok(cb.hasDataMatchingFlavors(["application/x-moz-nativehtml"], 1, cb.kGlobalClipboard), + "The clipboard has application/x-moz-nativehtml"); + } } function nextTest() { @@ -77,7 +84,7 @@ function nextTest() { synthesizeKey("C", {accelKey: true}); }, function() { ok(true, div.getAttribute("style") + " passed"); - ok(hasExpectedFlavors(), "The clipboard has the expected flavors"); + hasExpectedFlavors(); div.parentNode.removeChild(div); nextTest(); }, function() { diff --git a/widget/android/nsClipboard.cpp b/widget/android/nsClipboard.cpp index cf8675b..9a49bb0 100644 --- a/widget/android/nsClipboard.cpp +++ b/widget/android/nsClipboard.cpp @@ -97,7 +97,14 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList, *aHasText = false; if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED; - *aHasText = widget::Clipboard::HasText(); + + for (uint32_t k = 0; k < aLength; k++) { + if (strcmp(aFlavorList[k], kUnicodeMime) == 0) { + *aHasText = widget::Clipboard::HasText(); + break; + } + } + return NS_OK; }
1 0
0 0
[tor-browser/tor-browser-45.4.0esr-6.5-1] Bug 1273371, don't use the searchbar for this test, instead use a separate textbox, r=gijs
by gk@torproject.org 28 Oct '16

28 Oct '16
commit 0aa148499aaa1748036e9e89567c6e709dd16dbc Author: Neil Deakin <neil(a)mozilla.com> Date: Mon Oct 17 13:55:16 2016 -0400 Bug 1273371, don't use the searchbar for this test, instead use a separate textbox, r=gijs This and the previous two commits fix bug 20442 in our bug tracker. --- .../test/general/browser_clipboard_pastefile.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/browser/base/content/test/general/browser_clipboard_pastefile.js b/browser/base/content/test/general/browser_clipboard_pastefile.js index 094628f..55acc2b 100644 --- a/browser/base/content/test/general/browser_clipboard_pastefile.js +++ b/browser/base/content/test/general/browser_clipboard_pastefile.js @@ -2,15 +2,16 @@ // event.clipboardData. add_task(function*() { - var searchbar = document.getElementById("searchbar"); + var textbox = document.createElement("textbox"); + document.documentElement.appendChild(textbox); - searchbar.focus(); - searchbar.value = "Text"; - searchbar.select(); + textbox.focus(); + textbox.value = "Text"; + textbox.select(); yield new Promise((resolve, reject) => { - searchbar.addEventListener("copy", function copyEvent(event) { - searchbar.removeEventListener("copy", copyEvent, true); + textbox.addEventListener("copy", function copyEvent(event) { + textbox.removeEventListener("copy", copyEvent, true); event.clipboardData.setData("text/plain", "Alternate"); // For this test, it doesn't matter that the file isn't actually a file. event.clipboardData.setData("application/x-moz-file", "Sample"); @@ -36,11 +37,11 @@ add_task(function*() { }); is (output, "Passed", "Paste file"); - searchbar.focus(); + textbox.focus(); yield new Promise((resolve, reject) => { - searchbar.addEventListener("paste", function copyEvent(event) { - searchbar.removeEventListener("paste", copyEvent, true); + textbox.addEventListener("paste", function copyEvent(event) { + textbox.removeEventListener("paste", copyEvent, true); let dt = event.clipboardData; is(dt.types.length, 3, "number of types"); @@ -55,5 +56,7 @@ add_task(function*() { EventUtils.synthesizeKey("v", { accelKey: true }); }); + document.documentElement.removeChild(textbox); + yield BrowserTestUtils.removeTab(tab); });
1 0
0 0
[tor-launcher/maint-0.2.10] Bug 20185: Avoid using Unix domain socket paths that are too long
by gk@torproject.org 27 Oct '16

27 Oct '16
commit c916965ec2fe0b29c30414bb3c0ce3bf6ca207c5 Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Thu Oct 27 12:02:57 2016 -0400 Bug 20185: Avoid using Unix domain socket paths that are too long Enforce a maximum length of 100 for Unix domain socket paths. If $XDG_RUNTIME_DIR is set, create a unique subdirectory within that directory and place the control and SOCKS sockets there if the resulting paths will not be too long else if the length of <tor-data-dir>/control.socket is less than 100 characters, place both sockets under <tor-data-dir> (this is compatible with the Tor Browser 6.5a3 behavior) else create a unique subdirectory under /tmp and place the sockets there. The unique subdirectory that is created under $XDG_RUNTIME_DIR or /tmp will be named Tor if no such directory exists; otherwise, an integer suffix will be appended until a new, uniquely named directory is found such as /tmp/Tor-1. Also, when starting tor, only include a SocksPort argument if a Unix domain socket path or a host/port is available. --- src/components/tl-process.js | 30 +++-- src/modules/tl-util.jsm | 254 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 223 insertions(+), 61 deletions(-) diff --git a/src/components/tl-process.js b/src/components/tl-process.js index 166a8ae..777a253 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -142,7 +142,11 @@ TorProcessService.prototype = this.mObsSvc.notifyObservers(null, "TorProcessExited", null); - if (!this.mIsQuitting) + if (this.mIsQuitting) + { + TorLauncherUtil.cleanupTempDirectories(); + } + else { this.mProtocolSvc.TorCleanupConnection(); @@ -399,15 +403,21 @@ TorProcessService.prototype = // a TCP port and an IPC port (e.g., a Unix domain socket). if (socksPortInfo) { - let socksPortArg = (socksPortInfo.ipcFile) - ? this._ipcPortArg(socksPortInfo.ipcFile) - : socksPortInfo.host + ':' + socksPortInfo.port; - let socksPortFlags = TorLauncherUtil.getCharPref( - "extensions.torlauncher.socks_port_flags"); - if (socksPortFlags) - socksPortArg += ' ' + socksPortFlags; - args.push("SocksPort"); - args.push(socksPortArg); + let socksPortArg; + if (socksPortInfo.ipcFile) + socksPortArg = this._ipcPortArg(socksPortInfo.ipcFile) + else if (socksPortInfo.host && (socksPortInfo.port != 0)) + socksPortArg = socksPortInfo.host + ':' + socksPortInfo.port; + + if (socksPortArg) + { + let socksPortFlags = TorLauncherUtil.getCharPref( + "extensions.torlauncher.socks_port_flags"); + if (socksPortFlags) + socksPortArg += ' ' + socksPortFlags; + args.push("SocksPort"); + args.push(socksPortArg); + } } var pid = this._getpid(); diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm index a18f779..313a51b 100644 --- a/src/modules/tl-util.jsm +++ b/src/modules/tl-util.jsm @@ -247,6 +247,14 @@ let TorLauncherUtil = // Public } catch (e) {} }, + clearUserPref: function(aPrefName) + { + try + { + TLUtilInternal.mPrefsSvc.clearUserPref(aPrefName); + } catch (e) {} + }, + // Currently, this returns a random permutation of an array, bridgeArray. // Later, we might want to change this function to weight based on the // bridges' bandwidths. @@ -377,22 +385,97 @@ let TorLauncherUtil = // Public if (!aTorFileType) return null; - let isRelativePath = true; + let torFile; // an nsIFile to be returned + let path; // a relative or absolute path that will determine torFile + + let isRelativePath = false; let isUserData = (aTorFileType != "tor") && (aTorFileType != "torrc-defaults"); let isControlIPC = ("control_ipc" == aTorFileType); let isSOCKSIPC = ("socks_ipc" == aTorFileType); let isIPC = isControlIPC || isSOCKSIPC; + let checkIPCPathLen = true; + + const kControlIPCFileName = "control.socket"; + const kSOCKSIPCFileName = "socks.socket"; + let extraIPCPathLen = (isSOCKSIPC) ? 2 : 0; + let ipcFileName; + if (isControlIPC) + ipcFileName = kControlIPCFileName; + else if (isSOCKSIPC) + ipcFileName = kSOCKSIPCFileName; + + // If this is the first request for an IPC path during this browser + // session, remove the old temporary directory. This helps to keep /tmp + // clean if the browser crashes or is killed. + let ipcDirPath; + if (isIPC && TLUtilInternal.mIsFirstIPCPathRequest) + { + this.cleanupTempDirectories(); + TLUtilInternal.mIsFirstIPCPathRequest = false; + } + else + { + // Retrieve path for IPC objects (it may have already been determined). + ipcDirPath = this.getCharPref(TLUtilInternal.kIPCDirPrefName); + } + + // First, check the _path preference for this file type. let prefName = "extensions.torlauncher." + aTorFileType + "_path"; - let path = this.getCharPref(prefName); + path = this.getCharPref(prefName); if (path) { let re = (this.isWindows) ? /^[A-Za-z]:\\/ : /^\//; isRelativePath = !re.test(path); + checkIPCPathLen = false; // always try to use path if provided in pref } - else + else if (isIPC) + { + if (ipcDirPath) + { + // We have already determined where IPC objects will be placed. + torFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + torFile.initWithPath(ipcDirPath); + torFile.append(ipcFileName); + checkIPCPathLen = false; // already checked. + } + else + { + // If XDG_RUNTIME_DIR is set, use it as the base directory for IPC + // objects (e.g., Unix domain sockets) -- assuming it is not too long. + let env = Cc["@mozilla.org/process/environment;1"] + .getService(Ci.nsIEnvironment); + if (env.exists("XDG_RUNTIME_DIR")) + { + let ipcDir = TLUtilInternal._createUniqueIPCDir( + env.get("XDG_RUNTIME_DIR")); + if (ipcDir) + { + let f = ipcDir.clone(); + f.append(ipcFileName); + if (TLUtilInternal._isIPCPathLengthOK(f.path, extraIPCPathLen)) + { + torFile = f; + checkIPCPathLen = false; // no need to check again. + + // Store directory path so it can be reused for other IPC objects + // and so it can be removed during exit. + this.setCharPref(TLUtilInternal.kIPCDirPrefName, ipcDir.path); + } + else + { + // too long; remove the directory that we just created. + ipcDir.remove(false); + } + } + } + } + } + + if (!path && !torFile) { - // Get default path. + // No preference and no pre-determined IPC path: use a default path. + isRelativePath = true; if (TLUtilInternal._isUserDataOutsideOfAppDir) { // This block is used for the TorBrowser-Data/ case. @@ -417,10 +500,8 @@ let TorLauncherUtil = // Public path = "Tor/torrc"; else if ("tordatadir" == aTorFileType) path = "Tor"; - else if (isControlIPC) - path = "Tor/control.socket"; - else if (isSOCKSIPC) - path = "Tor/socks.socket"; + else if (isIPC) + path = "Tor/" + ipcFileName; } else // Linux and others. { @@ -432,10 +513,8 @@ let TorLauncherUtil = // Public path = "Tor/torrc"; else if ("tordatadir" == aTorFileType) path = "Tor"; - else if (isControlIPC) - path = "Tor/control.socket"; - else if (isSOCKSIPC) - path = "Tor/socks.socket"; + else if (isIPC) + path = "Tor/" + ipcFileName; } } else if (this.isWindows) @@ -461,67 +540,90 @@ let TorLauncherUtil = // Public path = "Data/Tor/torrc"; else if ("tordatadir" == aTorFileType) path = "Data/Tor"; - else if (isControlIPC) - path = "Data/Tor/control.socket"; - else if (isSOCKSIPC) - path = "Data/Tor/socks.socket"; + else if (isIPC) + path = "Data/Tor/" + ipcFileName; } - } - if (!path) - return null; + if (!path) + return null; + } try { - let f; - if (isRelativePath) + if (path) { - // Turn 'path' into an absolute path. - if (TLUtilInternal._isUserDataOutsideOfAppDir) + if (isRelativePath) { - let baseDir = isUserData ? TLUtilInternal._dataDir - : TLUtilInternal._appDir; - f = baseDir.clone(); + // Turn 'path' into an absolute path. + if (TLUtilInternal._isUserDataOutsideOfAppDir) + { + let baseDir = isUserData ? TLUtilInternal._dataDir + : TLUtilInternal._appDir; + torFile = baseDir.clone(); + } + else + { + torFile = TLUtilInternal._appDir.clone(); + torFile.append("TorBrowser"); + } + torFile.appendRelativePath(path); } else { - f = TLUtilInternal._appDir.clone(); - f.append("TorBrowser"); + torFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + torFile.initWithPath(path); } - f.appendRelativePath(path); - } - else - { - f = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); - f.initWithPath(path); - } - if (!f.exists() && !isIPC && aCreate) - { - try - { - if ("tordatadir" == aTorFileType) - f.create(f.DIRECTORY_TYPE, 0700); - else - f.create(f.NORMAL_FILE_TYPE, 0600); - } - catch (e) + if (!torFile.exists() && !isIPC && aCreate) { - TorLauncherLogger.safelog(4, "unable to create " + f.path + ": ", e); - return null; + try + { + if ("tordatadir" == aTorFileType) + torFile.create(torFile.DIRECTORY_TYPE, 0700); + else + torFile.create(torFile.NORMAL_FILE_TYPE, 0600); + } + catch (e) + { + TorLauncherLogger.safelog(4, + "unable to create " + torFile.path + ": ", e); + return null; + } } } // If the file exists or an IPC object was requested, normalize the path // and return a file object. The control and SOCKS IPC objects will be // created by tor. - if (f.exists() || isIPC) + if (torFile.exists() || isIPC) { - try { f.normalize(); } catch(e) {} - return f; + try { torFile.normalize(); } catch(e) {} + + // Ensure that the IPC path length is short enough for use by the + // operating system. If not, create and use a unique directory under + // /tmp for all IPC objects. The created directory path is stored in + // a preference so it can be reused for other IPC objects and so it + // can be removed during exit. + if (isIPC && checkIPCPathLen && + !TLUtilInternal._isIPCPathLengthOK(torFile.path, extraIPCPathLen)) + { + torFile = TLUtilInternal._createUniqueIPCDir("/tmp"); + if (!torFile) + { + TorLauncherLogger.log(4, + "failed to create unique directory under /tmp"); + return null; + } + + this.setCharPref(TLUtilInternal.kIPCDirPrefName, torFile.path); + torFile.append(ipcFileName); + } + + return torFile; } - TorLauncherLogger.log(4, aTorFileType + " file not found: " + f.path); + TorLauncherLogger.log(4, aTorFileType + " file not found: " + + torFile.path); } catch(e) { @@ -531,6 +633,22 @@ let TorLauncherUtil = // Public return null; // File not found or error (logged above). }, // getTorFile() + + cleanupTempDirectories: function() + { + try + { + let dirPath = this.getCharPref(TLUtilInternal.kIPCDirPrefName); + this.clearUserPref(TLUtilInternal.kIPCDirPrefName); + if (dirPath) + { + let f = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + f.initWithPath(dirPath); + if (f.exists()) + f.remove(false); // Remove directory if it is empty + } + } catch(e) {} + }, }; @@ -541,6 +659,7 @@ let TLUtilInternal = // Private { kThunderbirdID: "{3550f703-e582-4d05-9a08-453d09bdfdc6}", kInstantbirdID: "{33cb9019-c295-46dd-be21-8c4936574bee}", + kIPCDirPrefName: "extensions.torlauncher.tmp_ipc_dir", mPrefsSvc : null, mStringBundle : null, @@ -550,6 +669,7 @@ let TLUtilInternal = // Private // this._isUserDataOutsideOfAppDir) mAppDir: null, // nsIFile (cached; access via this._appDir) mDataDir: null, // nsIFile (cached; access via this._dataDir) + mIsFirstIPCPathRequest : true, _init: function() { @@ -662,6 +782,38 @@ let TLUtilInternal = // Private return this.mDataDir; }, // get _dataDir + // Return true if aPath is short enough to be used as an IPC object path, + // e.g., for a Unix domain socket path. aExtraLen is the "delta" necessary + // to accommodate other IPC objects that have longer names; it is used to + // account for "control.socket" vs. "socks.socket" (we want to ensure that + // all IPC objects are placed in the same parent directory unless the user + // has set prefs or env vars to explicitly specify the path for an object). + // We enforce a maximum length of 100 because all operating systems allow + // at least 100 characters for Unix domain socket paths. + _isIPCPathLengthOK: function(aPath, aExtraLen) + { + const kMaxIPCPathLen = 100; + return aPath && ((aPath.length + aExtraLen) <= kMaxIPCPathLen); + }, + + // Returns an nsIFile or null if a unique directory could not be created. + _createUniqueIPCDir: function(aBasePath) + { + try + { + let d = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + d.initWithPath(aBasePath); + d.append("Tor"); + d.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0700); + return d; + } + catch (e) + { + TorLauncherLogger.safelog(4, "_createUniqueIPCDir failed for " + + aBasePath + ": ", e); + return null; + } + }, };
1 0
0 0
[tor-launcher/master] Bug 20185: Avoid using Unix domain socket paths that are too long
by gk@torproject.org 27 Oct '16

27 Oct '16
commit 4dd8f6130f931616cf014e0ded444c30e04c8bad Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Thu Oct 27 12:02:57 2016 -0400 Bug 20185: Avoid using Unix domain socket paths that are too long Enforce a maximum length of 100 for Unix domain socket paths. If $XDG_RUNTIME_DIR is set, create a unique subdirectory within that directory and place the control and SOCKS sockets there if the resulting paths will not be too long else if the length of <tor-data-dir>/control.socket is less than 100 characters, place both sockets under <tor-data-dir> (this is compatible with the Tor Browser 6.5a3 behavior) else create a unique subdirectory under /tmp and place the sockets there. The unique subdirectory that is created under $XDG_RUNTIME_DIR or /tmp will be named Tor if no such directory exists; otherwise, an integer suffix will be appended until a new, uniquely named directory is found such as /tmp/Tor-1. Also, when starting tor, only include a SocksPort argument if a Unix domain socket path or a host/port is available. --- src/components/tl-process.js | 30 +++-- src/modules/tl-util.jsm | 254 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 223 insertions(+), 61 deletions(-) diff --git a/src/components/tl-process.js b/src/components/tl-process.js index 844aba1..de71d45 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -142,7 +142,11 @@ TorProcessService.prototype = this.mObsSvc.notifyObservers(null, "TorProcessExited", null); - if (!this.mIsQuitting) + if (this.mIsQuitting) + { + TorLauncherUtil.cleanupTempDirectories(); + } + else { this.mProtocolSvc.TorCleanupConnection(); @@ -395,15 +399,21 @@ TorProcessService.prototype = // a TCP port and an IPC port (e.g., a Unix domain socket). if (socksPortInfo) { - let socksPortArg = (socksPortInfo.ipcFile) - ? this._ipcPortArg(socksPortInfo.ipcFile) - : socksPortInfo.host + ':' + socksPortInfo.port; - let socksPortFlags = TorLauncherUtil.getCharPref( - "extensions.torlauncher.socks_port_flags"); - if (socksPortFlags) - socksPortArg += ' ' + socksPortFlags; - args.push("SocksPort"); - args.push(socksPortArg); + let socksPortArg; + if (socksPortInfo.ipcFile) + socksPortArg = this._ipcPortArg(socksPortInfo.ipcFile) + else if (socksPortInfo.host && (socksPortInfo.port != 0)) + socksPortArg = socksPortInfo.host + ':' + socksPortInfo.port; + + if (socksPortArg) + { + let socksPortFlags = TorLauncherUtil.getCharPref( + "extensions.torlauncher.socks_port_flags"); + if (socksPortFlags) + socksPortArg += ' ' + socksPortFlags; + args.push("SocksPort"); + args.push(socksPortArg); + } } var pid = this._getpid(); diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm index a1256fd..2f8d14e 100644 --- a/src/modules/tl-util.jsm +++ b/src/modules/tl-util.jsm @@ -251,6 +251,14 @@ let TorLauncherUtil = // Public } catch (e) {} }, + clearUserPref: function(aPrefName) + { + try + { + TLUtilInternal.mPrefsSvc.clearUserPref(aPrefName); + } catch (e) {} + }, + // Currently, this returns a random permutation of an array, bridgeArray. // Later, we might want to change this function to weight based on the // bridges' bandwidths. @@ -397,22 +405,97 @@ let TorLauncherUtil = // Public if (!aTorFileType) return null; - let isRelativePath = true; + let torFile; // an nsIFile to be returned + let path; // a relative or absolute path that will determine torFile + + let isRelativePath = false; let isUserData = (aTorFileType != "tor") && (aTorFileType != "torrc-defaults"); let isControlIPC = ("control_ipc" == aTorFileType); let isSOCKSIPC = ("socks_ipc" == aTorFileType); let isIPC = isControlIPC || isSOCKSIPC; + let checkIPCPathLen = true; + + const kControlIPCFileName = "control.socket"; + const kSOCKSIPCFileName = "socks.socket"; + let extraIPCPathLen = (isSOCKSIPC) ? 2 : 0; + let ipcFileName; + if (isControlIPC) + ipcFileName = kControlIPCFileName; + else if (isSOCKSIPC) + ipcFileName = kSOCKSIPCFileName; + + // If this is the first request for an IPC path during this browser + // session, remove the old temporary directory. This helps to keep /tmp + // clean if the browser crashes or is killed. + let ipcDirPath; + if (isIPC && TLUtilInternal.mIsFirstIPCPathRequest) + { + this.cleanupTempDirectories(); + TLUtilInternal.mIsFirstIPCPathRequest = false; + } + else + { + // Retrieve path for IPC objects (it may have already been determined). + ipcDirPath = this.getCharPref(TLUtilInternal.kIPCDirPrefName); + } + + // First, check the _path preference for this file type. let prefName = "extensions.torlauncher." + aTorFileType + "_path"; - let path = this.getCharPref(prefName); + path = this.getCharPref(prefName); if (path) { let re = (this.isWindows) ? /^[A-Za-z]:\\/ : /^\//; isRelativePath = !re.test(path); + checkIPCPathLen = false; // always try to use path if provided in pref } - else + else if (isIPC) + { + if (ipcDirPath) + { + // We have already determined where IPC objects will be placed. + torFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + torFile.initWithPath(ipcDirPath); + torFile.append(ipcFileName); + checkIPCPathLen = false; // already checked. + } + else + { + // If XDG_RUNTIME_DIR is set, use it as the base directory for IPC + // objects (e.g., Unix domain sockets) -- assuming it is not too long. + let env = Cc["@mozilla.org/process/environment;1"] + .getService(Ci.nsIEnvironment); + if (env.exists("XDG_RUNTIME_DIR")) + { + let ipcDir = TLUtilInternal._createUniqueIPCDir( + env.get("XDG_RUNTIME_DIR")); + if (ipcDir) + { + let f = ipcDir.clone(); + f.append(ipcFileName); + if (TLUtilInternal._isIPCPathLengthOK(f.path, extraIPCPathLen)) + { + torFile = f; + checkIPCPathLen = false; // no need to check again. + + // Store directory path so it can be reused for other IPC objects + // and so it can be removed during exit. + this.setCharPref(TLUtilInternal.kIPCDirPrefName, ipcDir.path); + } + else + { + // too long; remove the directory that we just created. + ipcDir.remove(false); + } + } + } + } + } + + if (!path && !torFile) { - // Get default path. + // No preference and no pre-determined IPC path: use a default path. + isRelativePath = true; if (TLUtilInternal._isUserDataOutsideOfAppDir) { // This block is used for the TorBrowser-Data/ case. @@ -437,10 +520,8 @@ let TorLauncherUtil = // Public path = "Tor/torrc"; else if ("tordatadir" == aTorFileType) path = "Tor"; - else if (isControlIPC) - path = "Tor/control.socket"; - else if (isSOCKSIPC) - path = "Tor/socks.socket"; + else if (isIPC) + path = "Tor/" + ipcFileName; } else // Linux and others. { @@ -452,10 +533,8 @@ let TorLauncherUtil = // Public path = "Tor/torrc"; else if ("tordatadir" == aTorFileType) path = "Tor"; - else if (isControlIPC) - path = "Tor/control.socket"; - else if (isSOCKSIPC) - path = "Tor/socks.socket"; + else if (isIPC) + path = "Tor/" + ipcFileName; } } else if (this.isWindows) @@ -481,67 +560,90 @@ let TorLauncherUtil = // Public path = "Data/Tor/torrc"; else if ("tordatadir" == aTorFileType) path = "Data/Tor"; - else if (isControlIPC) - path = "Data/Tor/control.socket"; - else if (isSOCKSIPC) - path = "Data/Tor/socks.socket"; + else if (isIPC) + path = "Data/Tor/" + ipcFileName; } - } - if (!path) - return null; + if (!path) + return null; + } try { - let f; - if (isRelativePath) + if (path) { - // Turn 'path' into an absolute path. - if (TLUtilInternal._isUserDataOutsideOfAppDir) + if (isRelativePath) { - let baseDir = isUserData ? TLUtilInternal._dataDir - : TLUtilInternal._appDir; - f = baseDir.clone(); + // Turn 'path' into an absolute path. + if (TLUtilInternal._isUserDataOutsideOfAppDir) + { + let baseDir = isUserData ? TLUtilInternal._dataDir + : TLUtilInternal._appDir; + torFile = baseDir.clone(); + } + else + { + torFile = TLUtilInternal._appDir.clone(); + torFile.append("TorBrowser"); + } + torFile.appendRelativePath(path); } else { - f = TLUtilInternal._appDir.clone(); - f.append("TorBrowser"); + torFile = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + torFile.initWithPath(path); } - f.appendRelativePath(path); - } - else - { - f = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); - f.initWithPath(path); - } - if (!f.exists() && !isIPC && aCreate) - { - try - { - if ("tordatadir" == aTorFileType) - f.create(f.DIRECTORY_TYPE, 0700); - else - f.create(f.NORMAL_FILE_TYPE, 0600); - } - catch (e) + if (!torFile.exists() && !isIPC && aCreate) { - TorLauncherLogger.safelog(4, "unable to create " + f.path + ": ", e); - return null; + try + { + if ("tordatadir" == aTorFileType) + torFile.create(torFile.DIRECTORY_TYPE, 0700); + else + torFile.create(torFile.NORMAL_FILE_TYPE, 0600); + } + catch (e) + { + TorLauncherLogger.safelog(4, + "unable to create " + torFile.path + ": ", e); + return null; + } } } // If the file exists or an IPC object was requested, normalize the path // and return a file object. The control and SOCKS IPC objects will be // created by tor. - if (f.exists() || isIPC) + if (torFile.exists() || isIPC) { - try { f.normalize(); } catch(e) {} - return f; + try { torFile.normalize(); } catch(e) {} + + // Ensure that the IPC path length is short enough for use by the + // operating system. If not, create and use a unique directory under + // /tmp for all IPC objects. The created directory path is stored in + // a preference so it can be reused for other IPC objects and so it + // can be removed during exit. + if (isIPC && checkIPCPathLen && + !TLUtilInternal._isIPCPathLengthOK(torFile.path, extraIPCPathLen)) + { + torFile = TLUtilInternal._createUniqueIPCDir("/tmp"); + if (!torFile) + { + TorLauncherLogger.log(4, + "failed to create unique directory under /tmp"); + return null; + } + + this.setCharPref(TLUtilInternal.kIPCDirPrefName, torFile.path); + torFile.append(ipcFileName); + } + + return torFile; } - TorLauncherLogger.log(4, aTorFileType + " file not found: " + f.path); + TorLauncherLogger.log(4, aTorFileType + " file not found: " + + torFile.path); } catch(e) { @@ -551,6 +653,22 @@ let TorLauncherUtil = // Public return null; // File not found or error (logged above). }, // getTorFile() + + cleanupTempDirectories: function() + { + try + { + let dirPath = this.getCharPref(TLUtilInternal.kIPCDirPrefName); + this.clearUserPref(TLUtilInternal.kIPCDirPrefName); + if (dirPath) + { + let f = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + f.initWithPath(dirPath); + if (f.exists()) + f.remove(false); // Remove directory if it is empty + } + } catch(e) {} + }, }; @@ -561,6 +679,7 @@ let TLUtilInternal = // Private { kThunderbirdID: "{3550f703-e582-4d05-9a08-453d09bdfdc6}", kInstantbirdID: "{33cb9019-c295-46dd-be21-8c4936574bee}", + kIPCDirPrefName: "extensions.torlauncher.tmp_ipc_dir", mPrefsSvc : null, mStringBundle : null, @@ -570,6 +689,7 @@ let TLUtilInternal = // Private // this._isUserDataOutsideOfAppDir) mAppDir: null, // nsIFile (cached; access via this._appDir) mDataDir: null, // nsIFile (cached; access via this._dataDir) + mIsFirstIPCPathRequest : true, _init: function() { @@ -682,6 +802,38 @@ let TLUtilInternal = // Private return this.mDataDir; }, // get _dataDir + // Return true if aPath is short enough to be used as an IPC object path, + // e.g., for a Unix domain socket path. aExtraLen is the "delta" necessary + // to accommodate other IPC objects that have longer names; it is used to + // account for "control.socket" vs. "socks.socket" (we want to ensure that + // all IPC objects are placed in the same parent directory unless the user + // has set prefs or env vars to explicitly specify the path for an object). + // We enforce a maximum length of 100 because all operating systems allow + // at least 100 characters for Unix domain socket paths. + _isIPCPathLengthOK: function(aPath, aExtraLen) + { + const kMaxIPCPathLen = 100; + return aPath && ((aPath.length + aExtraLen) <= kMaxIPCPathLen); + }, + + // Returns an nsIFile or null if a unique directory could not be created. + _createUniqueIPCDir: function(aBasePath) + { + try + { + let d = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + d.initWithPath(aBasePath); + d.append("Tor"); + d.createUnique(Ci.nsIFile.DIRECTORY_TYPE, 0700); + return d; + } + catch (e) + { + TorLauncherLogger.safelog(4, "_createUniqueIPCDir failed for " + + aBasePath + ": ", e); + return null; + } + }, };
1 0
0 0
[tor-launcher/maint-0.2.10] Bug 20429: Do not open progress window if TOR_SKIP_LAUNCH=1
by gk@torproject.org 27 Oct '16

27 Oct '16
commit 8aa78d3a78bbabe01759b63d837b09acdf53be42 Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Wed Oct 26 15:00:06 2016 -0400 Bug 20429: Do not open progress window if TOR_SKIP_LAUNCH=1 After saving tor settings, if TOR_SKIP_LAUNCH=1 or if extensions.torlauncher.start_tor is false, avoid opening the progress dialog to monitor bootstrap progress. This avoids displaying a progress window that will not make progress (and the situation was made worse by the fact that clicking Cancel set DisableNetwork=1). Also, leave the network settings dialog open if we fail to set DisableNetwork=0. --- src/chrome/content/network-settings.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js index 2736f08..dc54445 100644 --- a/src/chrome/content/network-settings.js +++ b/src/chrome/content/network-settings.js @@ -1055,11 +1055,22 @@ function useSettings() { var settings = {}; settings[kTorConfKeyDisableNetwork] = false; - setConfAndReportErrors(settings, null); + let didApply = setConfAndReportErrors(settings, null); + if (!didApply) + return; gProtocolSvc.TorSendCommand("SAVECONF"); gTorProcessService.TorClearBootstrapError(); + // If we are not responsible for starting tor we do not monitor bootstrap + // status, so just close this dialog and return rather than opening the + // progress dialog (which will make no progress). + if (!TorLauncherUtil.shouldStartAndOwnTor) + { + close(); + return; + } + gIsBootstrapComplete = gTorProcessService.TorIsBootstrapDone; if (!gIsBootstrapComplete) openProgressDialog();
1 0
0 0
[tor-launcher/maint-0.2.9] Bug 20429: Do not open progress window if TOR_SKIP_LAUNCH=1
by gk@torproject.org 27 Oct '16

27 Oct '16
commit 2014143e0081170267a34e3a102878999dee6a29 Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Wed Oct 26 15:00:06 2016 -0400 Bug 20429: Do not open progress window if TOR_SKIP_LAUNCH=1 After saving tor settings, if TOR_SKIP_LAUNCH=1 or if extensions.torlauncher.start_tor is false, avoid opening the progress dialog to monitor bootstrap progress. This avoids displaying a progress window that will not make progress (and the situation was made worse by the fact that clicking Cancel set DisableNetwork=1). Also, leave the network settings dialog open if we fail to set DisableNetwork=0. --- src/chrome/content/network-settings.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js index 2736f08..dc54445 100644 --- a/src/chrome/content/network-settings.js +++ b/src/chrome/content/network-settings.js @@ -1055,11 +1055,22 @@ function useSettings() { var settings = {}; settings[kTorConfKeyDisableNetwork] = false; - setConfAndReportErrors(settings, null); + let didApply = setConfAndReportErrors(settings, null); + if (!didApply) + return; gProtocolSvc.TorSendCommand("SAVECONF"); gTorProcessService.TorClearBootstrapError(); + // If we are not responsible for starting tor we do not monitor bootstrap + // status, so just close this dialog and return rather than opening the + // progress dialog (which will make no progress). + if (!TorLauncherUtil.shouldStartAndOwnTor) + { + close(); + return; + } + gIsBootstrapComplete = gTorProcessService.TorIsBootstrapDone; if (!gIsBootstrapComplete) openProgressDialog();
1 0
0 0
[tor-launcher/master] Bug 20429: Do not open progress window if TOR_SKIP_LAUNCH=1
by gk@torproject.org 27 Oct '16

27 Oct '16
commit c12d56470b7164c33b3cb2e48a90dc65151a9a26 Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Wed Oct 26 15:00:06 2016 -0400 Bug 20429: Do not open progress window if TOR_SKIP_LAUNCH=1 After saving tor settings, if TOR_SKIP_LAUNCH=1 or if extensions.torlauncher.start_tor is false, avoid opening the progress dialog to monitor bootstrap progress. This avoids displaying a progress window that will not make progress (and the situation was made worse by the fact that clicking Cancel set DisableNetwork=1). Also, leave the network settings dialog open if we fail to set DisableNetwork=0. --- src/chrome/content/network-settings.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js index e0d7d1c..5df4e1e 100644 --- a/src/chrome/content/network-settings.js +++ b/src/chrome/content/network-settings.js @@ -1209,11 +1209,22 @@ function useSettings() { var settings = {}; settings[kTorConfKeyDisableNetwork] = false; - setConfAndReportErrors(settings, null); + let didApply = setConfAndReportErrors(settings, null); + if (!didApply) + return; gProtocolSvc.TorSendCommand("SAVECONF"); gTorProcessService.TorClearBootstrapError(); + // If we are not responsible for starting tor we do not monitor bootstrap + // status, so just close this dialog and return rather than opening the + // progress dialog (which will make no progress). + if (!TorLauncherUtil.shouldStartAndOwnTor) + { + close(); + return; + } + gIsBootstrapComplete = gTorProcessService.TorIsBootstrapDone; if (!gIsBootstrapComplete) openProgressDialog();
1 0
0 0
[tor-browser/tor-browser-45.4.0esr-6.0-1] fixup! Bug 1070710 - Add mozilla::ViewRegion which assembles a LayoutDeviceIntRegion as NSViews. r=spohl
by gk@torproject.org 26 Oct '16

26 Oct '16
commit 41f1c54ad978155f964fca1100f0c2eda1bef88a Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Tue Oct 25 23:01:20 2016 -0400 fixup! Bug 1070710 - Add mozilla::ViewRegion which assembles a LayoutDeviceIntRegion as NSViews. r=spohl OSX: Fix a problem where clicking and dragging in the content area of a window would sometimes cause the window to move. This is a fixup for an error introduced while backporting a Mozilla patch for Tor bug 20204. --- widget/cocoa/ViewRegion.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/widget/cocoa/ViewRegion.mm b/widget/cocoa/ViewRegion.mm index 3459849..ee31889 100644 --- a/widget/cocoa/ViewRegion.mm +++ b/widget/cocoa/ViewRegion.mm @@ -56,7 +56,6 @@ ViewRegion::UpdateRegion(const LayoutDeviceIntRegion& aRegion, } [view setNeedsDisplay:YES]; mViews.AppendElement(view); - iter.Next(); } else { // Our new region is made of fewer rects than the old region, so we can // remove this view. We only have a weak reference to it, so removing it
1 0
0 0
[tor-browser/tor-browser-45.4.0esr-6.5-1] fixup! Bug 1070710 - Add mozilla::ViewRegion which assembles a LayoutDeviceIntRegion as NSViews. r=spohl
by gk@torproject.org 26 Oct '16

26 Oct '16
commit a6b4bb9a9d2769e8be110f2f0486b9ec74882575 Author: Kathy Brade <brade(a)pearlcrescent.com> Date: Tue Oct 25 23:01:20 2016 -0400 fixup! Bug 1070710 - Add mozilla::ViewRegion which assembles a LayoutDeviceIntRegion as NSViews. r=spohl OSX: Fix a problem where clicking and dragging in the content area of a window would sometimes cause the window to move. This is a fixup for an error introduced while backporting a Mozilla patch for Tor bug 20204. --- widget/cocoa/ViewRegion.mm | 1 - 1 file changed, 1 deletion(-) diff --git a/widget/cocoa/ViewRegion.mm b/widget/cocoa/ViewRegion.mm index 3459849..ee31889 100644 --- a/widget/cocoa/ViewRegion.mm +++ b/widget/cocoa/ViewRegion.mm @@ -56,7 +56,6 @@ ViewRegion::UpdateRegion(const LayoutDeviceIntRegion& aRegion, } [view setNeedsDisplay:YES]; mViews.AppendElement(view); - iter.Next(); } else { // Our new region is made of fewer rects than the old region, so we can // remove this view. We only have a weak reference to it, so removing it
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.