зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1325501) for xpcshell failures a=backout
Backed out changeset b6e50911ef79 (bug 1325501) Backed out changeset c0493757d21e (bug 1325501) Backed out changeset 880decff07b3 (bug 1325501)
This commit is contained in:
Родитель
b245f6d89e
Коммит
65f15b63ea
|
@ -22,7 +22,6 @@ Cu.import("resource://gre/modules/Task.jsm", this);
|
|||
Cu.import("resource://gre/modules/Log.jsm", this);
|
||||
Cu.import("resource://gre/modules/Preferences.jsm");
|
||||
Cu.import("resource://gre/modules/PromiseUtils.jsm");
|
||||
Cu.import("resource://gre/modules/ServiceRequest.jsm", this);
|
||||
Cu.import("resource://gre/modules/Services.jsm", this);
|
||||
Cu.import("resource://gre/modules/TelemetryUtils.jsm", this);
|
||||
Cu.import("resource://gre/modules/Timer.jsm", this);
|
||||
|
@ -905,7 +904,8 @@ var TelemetrySendImpl = {
|
|||
const version = isNewPing ? PING_FORMAT_VERSION : 1;
|
||||
const url = this._server + this._getSubmissionPath(ping) + "?v=" + version;
|
||||
|
||||
let request = new ServiceRequest();
|
||||
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
request.mozBackgroundRequest = true;
|
||||
request.timeout = PING_SUBMIT_TIMEOUT_MS;
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
/* 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;
|
||||
|
||||
/**
|
||||
* This module consolidates various code and data update requests, so flags
|
||||
* can be set, Telemetry collected, etc. in a central place.
|
||||
*/
|
||||
|
||||
Cu.import("resource://gre/modules/Log.jsm");
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "ServiceRequest" ];
|
||||
|
||||
const logger = Log.repository.getLogger("ServiceRequest");
|
||||
logger.level = Log.Level.Debug;
|
||||
logger.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()));
|
||||
|
||||
/**
|
||||
* ServiceRequest is intended to be a drop-in replacement for current users
|
||||
* of XMLHttpRequest.
|
||||
*
|
||||
* @param {Object} options - Options for underlying XHR, e.g. { mozAnon: bool }
|
||||
*/
|
||||
class ServiceRequest extends XMLHttpRequest {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
}
|
||||
/**
|
||||
* Opens an XMLHttpRequest, and sets the NSS "beConservative" flag.
|
||||
* Requests are always async.
|
||||
*
|
||||
* @param {String} method - HTTP method to use, e.g. "GET".
|
||||
* @param {String} url - URL to open.
|
||||
* @param {Object} options - Additional options (reserved for future use).
|
||||
*/
|
||||
open(method, url, options) {
|
||||
super.open(method, url, true);
|
||||
|
||||
// Disable cutting edge features, like TLS 1.3, where middleboxes might brick us
|
||||
if (super.channel instanceof Ci.nsIHttpChannelInternal) {
|
||||
super.channel.QueryInterface(Ci.nsIHttpChannelInternal).beConservative = true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -82,7 +82,6 @@ EXTRA_JS_MODULES += [
|
|||
'secondscreen/SimpleServiceDiscovery.jsm',
|
||||
'SelectContentHelper.jsm',
|
||||
'SelectParentHelper.jsm',
|
||||
'ServiceRequest.jsm',
|
||||
'Services.jsm',
|
||||
'SessionRecorder.jsm',
|
||||
'sessionstore/FormData.jsm',
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/ServiceRequest.jsm");
|
||||
|
||||
add_task(function* test_tls_conservative() {
|
||||
const request = new ServiceRequest();
|
||||
request.open("GET", "http://example.com", false);
|
||||
|
||||
const sr_channel = request.channel.QueryInterface(Ci.nsIHttpChannelInternal);
|
||||
ok(("beConservative" in sr_channel), "TLS setting is present in SR channel");
|
||||
ok(sr_channel.beConservative, "TLS setting in request channel is set to conservative for SR");
|
||||
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "http://example.com", false);
|
||||
|
||||
const xhr_channel = xhr.channel.QueryInterface(Ci.nsIHttpChannelInternal);
|
||||
ok(("beConservative" in xhr_channel), "TLS setting is present in XHR channel");
|
||||
ok(!xhr_channel.beConservative, "TLS setting in request channel is not set to conservative for XHR");
|
||||
|
||||
});
|
|
@ -74,4 +74,3 @@ reason = LOCALE is not defined without MOZ_UPDATER
|
|||
[test_ZipUtils.js]
|
||||
skip-if = toolkit == 'android'
|
||||
[test_Log_stackTrace.js]
|
||||
[test_servicerequest_xhr.js]
|
||||
|
|
|
@ -42,9 +42,6 @@ const PERSIST_FILES = {
|
|||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
|
||||
"resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ServiceRequest",
|
||||
"resource://gre/modules/ServiceRequest.jsm");
|
||||
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "_prefs", () => {
|
||||
return Services.prefs.getBranch("lightweightThemes.");
|
||||
|
@ -257,7 +254,8 @@ this.LightweightThemeManager = {
|
|||
if (!theme || !theme.updateURL)
|
||||
return;
|
||||
|
||||
var req = new ServiceRequest();
|
||||
var req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
|
||||
req.mozBackgroundRequest = true;
|
||||
req.overrideMimeType("text/plain");
|
||||
|
|
|
@ -26,8 +26,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
|
|||
"resource://gre/modules/Preferences.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/Promise.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ServiceRequest",
|
||||
"resource://gre/modules/ServiceRequest.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
|
@ -102,6 +100,10 @@ const INTEGER_KEY_MAP = {
|
|||
daily_users: "dailyUsers"
|
||||
};
|
||||
|
||||
// Wrap the XHR factory so that tests can override with a mock
|
||||
var XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
|
||||
"nsIXMLHttpRequest");
|
||||
|
||||
function convertHTMLToPlainText(html) {
|
||||
if (!html)
|
||||
return html;
|
||||
|
@ -1431,7 +1433,7 @@ this.AddonRepository = {
|
|||
|
||||
logger.debug("Requesting " + aURI);
|
||||
|
||||
this._request = new ServiceRequest();
|
||||
this._request = new XHRequest();
|
||||
this._request.mozBackgroundRequest = true;
|
||||
this._request.open("GET", aURI, true);
|
||||
this._request.overrideMimeType("text/xml");
|
||||
|
|
|
@ -35,9 +35,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate",
|
|||
"resource://gre/modules/AddonManager.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository",
|
||||
"resource://gre/modules/addons/AddonRepository.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ServiceRequest",
|
||||
"resource://gre/modules/ServiceRequest.jsm");
|
||||
|
||||
|
||||
// Shared code for suppressing bad cert dialogs.
|
||||
XPCOMUtils.defineLazyGetter(this, "CertUtils", function() {
|
||||
|
@ -581,7 +578,8 @@ function UpdateParser(aId, aUpdateKey, aUrl, aObserver) {
|
|||
|
||||
logger.debug("Requesting " + aUrl);
|
||||
try {
|
||||
this.request = new ServiceRequest();
|
||||
this.request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||
createInstance(Ci.nsIXMLHttpRequest);
|
||||
this.request.open("GET", this.url, true);
|
||||
this.request.channel.notificationCallbacks = new CertUtils.BadCertHandler(!requireBuiltIn);
|
||||
this.request.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||
|
|
|
@ -21,6 +21,8 @@ const LOCAL_EME_SOURCES = [{
|
|||
|
||||
this.EXPORTED_SYMBOLS = [ "ProductAddonChecker" ];
|
||||
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
@ -40,12 +42,15 @@ XPCOMUtils.defineLazyModuleGetter(this, "GMPPrefs",
|
|||
XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
||||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ServiceRequest",
|
||||
"resource://gre/modules/ServiceRequest.jsm");
|
||||
|
||||
|
||||
var logger = Log.repository.getLogger("addons.productaddons");
|
||||
|
||||
// This exists so that tests can override the XHR behaviour for downloading
|
||||
// the addon update XML file.
|
||||
var CreateXHR = function() {
|
||||
return Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||
createInstance(Ci.nsISupports);
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of milliseconds after which we need to cancel `downloadXML`.
|
||||
*
|
||||
|
@ -97,7 +102,7 @@ function getRequestStatus(request) {
|
|||
*/
|
||||
function downloadXML(url, allowNonBuiltIn = false, allowedCerts = null) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let request = new ServiceRequest();
|
||||
let request = CreateXHR();
|
||||
// This is here to let unit test code override XHR
|
||||
if (request.wrappedJSObject) {
|
||||
request = request.wrappedJSObject;
|
||||
|
@ -158,7 +163,7 @@ function downloadXML(url, allowNonBuiltIn = false, allowedCerts = null) {
|
|||
function downloadJSON(uri) {
|
||||
logger.info("fetching config from: " + uri);
|
||||
return new Promise((resolve, reject) => {
|
||||
let xmlHttp = new ServiceRequest({mozAnon: true});
|
||||
let xmlHttp = new XMLHttpRequest({mozAnon: true});
|
||||
|
||||
xmlHttp.onload = function(aResponse) {
|
||||
resolve(JSON.parse(this.responseText));
|
||||
|
@ -285,7 +290,8 @@ function downloadLocalConfig() {
|
|||
*/
|
||||
function downloadFile(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let xhr = new ServiceRequest();
|
||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||
createInstance(Ci.nsISupports);
|
||||
xhr.onload = function(response) {
|
||||
logger.info("downloadXHR File download. status=" + xhr.status);
|
||||
if (xhr.status != 200 && xhr.status != 206) {
|
||||
|
|
|
@ -29,8 +29,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
|
|||
"resource://gre/modules/UpdateUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||
"resource://gre/modules/osfile.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ServiceRequest",
|
||||
"resource://gre/modules/ServiceRequest.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
|
@ -610,7 +608,8 @@ Blocklist.prototype = {
|
|||
}
|
||||
|
||||
LOG("Blocklist::notify: Requesting " + uri.spec);
|
||||
let request = new ServiceRequest();
|
||||
var request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
|
||||
createInstance(Ci.nsIXMLHttpRequest);
|
||||
request.open("GET", uri.spec, true);
|
||||
request.channel.notificationCallbacks = new gCertUtils.BadCertHandler();
|
||||
request.overrideMimeType("text/xml");
|
||||
|
|
|
@ -17,8 +17,8 @@ var ARContext = Components.utils.import("resource://gre/modules/addons/AddonRepo
|
|||
// Mock out the XMLHttpRequest factory for AddonRepository so
|
||||
// we can reply with a timeout
|
||||
var pXHRStarted = Promise.defer();
|
||||
var oldXHRConstructor = ARContext.ServiceRequest;
|
||||
ARContext.ServiceRequest = function() {
|
||||
var oldXHRConstructor = ARContext.XHRequest;
|
||||
ARContext.XHRequest = function() {
|
||||
this._handlers = new Map();
|
||||
this.mozBackgroundRequest = false;
|
||||
this.timeout = undefined;
|
||||
|
@ -106,7 +106,7 @@ add_task(function* amo_ping_timeout() {
|
|||
xhr._handlers.get("timeout")();
|
||||
|
||||
// Put the old XHR constructor back
|
||||
ARContext.ServiceRequest = oldXHRConstructor;
|
||||
ARContext.XHRequest = oldXHRConstructor;
|
||||
// The window should close without further interaction
|
||||
yield promise_window_close(compatWindow);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче