[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [meek/master] Use const in a few more places.



commit b4f23d54117ae915901d2fd3d51e97afb81b0ae1
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Sat Mar 30 11:05:49 2019 -0600

    Use const in a few more places.
---
 webextension/browser/background.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/webextension/browser/background.js b/webextension/browser/background.js
index 038e548..5a23134 100644
--- a/webextension/browser/background.js
+++ b/webextension/browser/background.js
@@ -127,8 +127,8 @@ const proxyMutex = new Mutex();
 async function roundtrip(params) {
     // Process the incoming request parameters and convert them into a Request.
     // https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#Parameters
-    let input = params.url;
-    let init = {
+    const input = params.url;
+    const init = {
         method: params.method,
         body: params.body != null ? base64_decode(params.body) : undefined,
         // headers will get further treatment below in headersFn.
@@ -152,7 +152,7 @@ async function roundtrip(params) {
     if (init.method !== "POST") {
         throw new Error("request spec failed validation: only POST is allowed");
     }
-    let request = new Request(input, init);
+    const request = new Request(input, init);
 
     // We need to use a webRequest.onBeforeSendHeaders listener to override
     // certain header fields, including Host (creating a Request with them in
@@ -162,7 +162,7 @@ async function roundtrip(params) {
     // used for a single request, by acquiring a lock here and releasing it
     // within the listener itself. The lock is acquired and released before any
     // network communication happens; i.e., it's fast.
-    let headersUnlock = await headersMutex.lock();
+    const headersUnlock = await headersMutex.lock();
     let headersCalled = false;
     function headersFn(details) {
         try {
@@ -202,7 +202,7 @@ async function roundtrip(params) {
 
     // Similarly, for controlling the proxy for each request, we set a
     // proxy.onRequest listener, use it for one request, then remove it.
-    let proxyUnlock = await proxyMutex.lock();
+    const proxyUnlock = await proxyMutex.lock();
     let proxyCalled = false;
     // async to make exceptions visible to proxy.onError.
     // https://bugzilla.mozilla.org/show_bug.cgi?id=1528873#c1
@@ -303,7 +303,7 @@ browser.webRequest.onErrorOccurred.addListener(
 browser.proxy.settings.set({value: {proxyType: "system", proxyDNS: false}});
 
 // Connect to our native process.
-let port = browser.runtime.connectNative("meek.http.helper");
+const port = browser.runtime.connectNative("meek.http.helper");
 
 port.onMessage.addListener(message => {
     switch (message.command) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits