Skip to content

Instantly share code, notes, and snippets.

@rhelmer
Created December 22, 2016 21:59
Show Gist options
  • Select an option

  • Save rhelmer/53c414b7b22e967b1f1789266cbdcab9 to your computer and use it in GitHub Desktop.

Select an option

Save rhelmer/53c414b7b22e967b1f1789266cbdcab9 to your computer and use it in GitHub Desktop.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
Cu.importGlobalProperties(["XMLHttpRequest"]);
this.EXPORTED_SYMBOLS = [ "ServiceRequest" ];
class ServiceRequest {
constructor() {
this.request = new XMLHttpRequest();
return this.request;
}
open(method, url, isAsync, user, password) {
this.request.open(method, url, isAsync, user, password);
// Disable cutting edge features, like TLS 1.3, where middleboxes might brick us
this.request.channel.QueryInterface(Ci.nsIHttpChannelInternal).beConservative = true;
}
}
this.ServiceRequest = new ServiceRequest();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment