зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1582666 - Enable more ESLint rules for netwerk/. r=Standard8,valentin
Differential Revision: https://phabricator.services.mozilla.com/D69257 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
6b61f09b5d
Коммит
ee093cd087
11
.eslintrc.js
11
.eslintrc.js
|
@ -30,6 +30,7 @@ const mochitestTestPaths = [
|
|||
// too many globals for that directory.
|
||||
"**/test/mochitest/",
|
||||
"**/tests/mochitest/",
|
||||
"**/test/mochitests/",
|
||||
"testing/mochitest/tests/SimpleTest/",
|
||||
"testing/mochitest/tests/Harness_sanity/",
|
||||
];
|
||||
|
@ -161,27 +162,17 @@ module.exports = {
|
|||
"netwerk/test/unit*/**",
|
||||
],
|
||||
rules: {
|
||||
"mozilla/consistent-if-bracing": "off",
|
||||
"mozilla/reject-importGlobalProperties": "off",
|
||||
"mozilla/no-arbitrary-setTimeout": "off",
|
||||
"mozilla/no-define-cc-etc": "off",
|
||||
"mozilla/use-default-preference-values": "off",
|
||||
"mozilla/use-services": "off",
|
||||
"consistent-return": "off",
|
||||
"no-array-constructor": "off",
|
||||
"no-eval": "off",
|
||||
"no-global-assign": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new-wrappers": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-return-await": "off",
|
||||
"no-sequences": "off",
|
||||
"no-shadow": "off",
|
||||
"no-throw-literal": "off",
|
||||
"no-undef": "off",
|
||||
"no-unreachable": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-useless-return": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// BroadcastChannel is not considered part of CookieJar. It's not allowed to
|
||||
// communicate with other windows with different cookie jar settings.
|
||||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("BroadcastChannel", {
|
||||
cookieJarAccessAllowed: async w => {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("document.cookies", {
|
||||
cookieJarAccessAllowed: async _ => {
|
||||
let hasCookie = !!content.document.cookie.length;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("DOM Cache", {
|
||||
cookieJarAccessAllowed: async w => {
|
||||
await w.caches.open("wow").then(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("IndexedDB", {
|
||||
cookieJarAccessAllowed: async w => {
|
||||
w.indexedDB.open("test", "1");
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
const USER_CONTEXTS = ["default", "personal", "work"];
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const OVERSIZE_DOMAIN = "http://example.com/";
|
||||
const OVERSIZE_PATH = "browser/netwerk/cookie/test/browser/";
|
||||
const OVERSIZE_TOP_PAGE = OVERSIZE_DOMAIN + OVERSIZE_PATH + "oversize.sjs";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const SAMESITE_DOMAIN = "http://example.com/";
|
||||
const SAMESITE_PATH = "browser/netwerk/cookie/test/browser/";
|
||||
const SAMESITE_TOP_PAGE = SAMESITE_DOMAIN + SAMESITE_PATH + "sameSite.sjs";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("ServiceWorker", {
|
||||
prefs: [
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true],
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("SharedWorker", {
|
||||
cookieJarAccessAllowed: async w => {
|
||||
new w.SharedWorker("a.js", "foo");
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
CookiePolicyHelper.runTest("SessionStorage", {
|
||||
cookieJarAccessAllowed: async w => {
|
||||
try {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
// This must be loaded in the remote process for this test to be useful
|
||||
const TEST_URL = "http://example.com/browser/netwerk/test/browser/dummy.html";
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* should be able to accept form POST.
|
||||
*/
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
const SCHEME = "x-bug1241377";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Tests for bug 1241100: Post to local file should not overwrite the file.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
async function createTestFile(filename, content) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Tests third party cookie blocking using a favicon loaded from a different
|
||||
// domain. The cookie should be considered third party.
|
||||
|
||||
"use strict";
|
||||
add_task(async function() {
|
||||
const iconUrl =
|
||||
"http://example.org/browser/netwerk/test/browser/damonbowling.jpg";
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
/* 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 ROOT_URL = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content/",
|
||||
"https://example.com/"
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
let cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
|
||||
|
||||
addMessageListener("getCookieCountAndClear", () => {
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
function getCookieService() {
|
||||
return Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
const SCRIPT_URL = SimpleTest.getTestFileURL("file_chromecommon.js");
|
||||
|
||||
var gExpectedCookies;
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
const SCRIPT_URL = SimpleTest.getTestFileURL(
|
||||
"file_testloadflags_chromescript.js"
|
||||
);
|
||||
|
||||
let gScript;
|
||||
var gExpectedCookies;
|
||||
var gExpectedHeaders;
|
||||
var gExpectedLoads;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* eslint-env mozilla/frame-script */
|
||||
|
||||
"use strict";
|
||||
|
||||
var gObs;
|
||||
|
||||
function info(s) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<script type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/* eslint-env mozilla/frame-script */
|
||||
var script = SpecialPowers.loadChromeScript(() => {
|
||||
const {Services} = ChromeUtils.import('resource://gre/modules/Services.jsm');
|
||||
|
||||
|
@ -34,7 +35,7 @@ script.addMessageListener('start-test', () => {
|
|||
|
||||
iframe.contentWindow.onunload = function () {
|
||||
info('initiate sync XHR during the page loading');
|
||||
xhr = new XMLHttpRequest();
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', window.location, false);
|
||||
xhr.send(null);
|
||||
ok(true, 'complete without crash');
|
||||
|
|
|
@ -46,7 +46,7 @@ function checkLoadInfoWithoutRedirects() {
|
|||
|
||||
// try to pop an element from redirectChain
|
||||
try {
|
||||
loadInfo.popRedirectedPrincipal(false);
|
||||
loadinfo.popRedirectedPrincipal(false);
|
||||
ok(false, "should not be possible to pop from redirectChain");
|
||||
}
|
||||
catch(e) {
|
||||
|
@ -55,7 +55,7 @@ function checkLoadInfoWithoutRedirects() {
|
|||
|
||||
// try to pop an element from redirectChainIncludingInternalRedirects
|
||||
try {
|
||||
loadInfo.popRedirectedPrincipal(true);
|
||||
loadinfo.popRedirectedPrincipal(true);
|
||||
ok(false, "should not be possible to pop from redirectChainIncludingInternalRedirects");
|
||||
}
|
||||
catch(e) {
|
||||
|
|
|
@ -231,7 +231,7 @@ function loadDataURIFrame(test, check)
|
|||
async function resetFrames()
|
||||
{
|
||||
let checkPromises = [];
|
||||
for (check of checksToRun) {
|
||||
for (let check of checksToRun) {
|
||||
checkPromises.push(new Promise((resolve, reject) => {
|
||||
let frame = document.getElementById(check.frameID);
|
||||
frame.onload = () => resolve();
|
||||
|
@ -247,12 +247,12 @@ async function resetFrames()
|
|||
|
||||
async function runTests()
|
||||
{
|
||||
for (test of testsToRun) {
|
||||
for (let test of testsToRun) {
|
||||
await resetFrames();
|
||||
await SpecialPowers.pushPrefEnv({"set": test.prefs});
|
||||
|
||||
let checkPromises = [];
|
||||
for (check of checksToRun) {
|
||||
for (let check of checksToRun) {
|
||||
if (check.formID) {
|
||||
checkPromises.push(submitForm(test, check));
|
||||
} else if (check.frameSrc) {
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
// 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 { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
var callbacks = new Array();
|
||||
/* import-globals-from head_cache.js */
|
||||
/* import-globals-from head_channels.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
var callbacks = [];
|
||||
|
||||
// Expect an existing entry
|
||||
const NORMAL = 0;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
/**
|
||||
* Read count bytes from stream and return as a String object
|
||||
*/
|
||||
|
||||
/* import-globals-from head_cache.js */
|
||||
/* import-globals-from head_cookies.js */
|
||||
|
||||
function read_stream(stream, count) {
|
||||
/* assume stream has non-ASCII data */
|
||||
var wrapper = Cc["@mozilla.org/binaryinputstream;1"].createInstance(
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/* import-globals-from head_cache.js */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
/* global arguments */
|
||||
|
||||
"use strict";
|
||||
|
||||
var CC = Components.Constructor;
|
||||
|
||||
const BinaryInputStream = CC(
|
||||
|
@ -47,7 +51,7 @@ function launchConnection(socks_vers, socks_port, dest_host, dest_port, dns) {
|
|||
|
||||
for (var arg of arguments) {
|
||||
print("client: running test", arg);
|
||||
test = arg.split("|");
|
||||
let test = arg.split("|");
|
||||
launchConnection(
|
||||
test[0],
|
||||
parseInt(test[1]),
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Test based on submitted one from Peter B Shalimoff
|
||||
|
||||
"use strict";
|
||||
|
||||
var test = function(s, funcName) {
|
||||
function Arg() {}
|
||||
Arg.prototype.toString = function() {
|
||||
|
@ -21,8 +23,6 @@ var test = function(s, funcName) {
|
|||
Assert.ok(true); // make sure it throws an exception instead of crashing
|
||||
return x;
|
||||
}
|
||||
// should always have an exception to catch
|
||||
Assert.ok(false);
|
||||
};
|
||||
var s = null;
|
||||
var funcs = [
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
* See also https://bugzilla.mozilla.org/show_bug.cgi?id=609667
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var BS = "\\";
|
||||
var DQUOTE = '"';
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
* This file tests the methods on NetUtil.jsm.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
// We need the profile directory so the test harness will clean up our test
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
"use strict";
|
||||
|
||||
var gIoService = Cc["@mozilla.org/network/io-service;1"].getService(
|
||||
Ci.nsIIOService
|
||||
|
|
|
@ -3,14 +3,13 @@
|
|||
// prompting for redirects of other unsafe methods (such as PUTs, DELETEs,
|
||||
// etc--see HttpBaseChannel::IsSafeMethod). Since no prompting is possible
|
||||
// in xpcshell, we get an error for prompts, and the request fails.
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
const { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
|
||||
var sSame;
|
||||
var sOther;
|
||||
var sRedirectPromptPref;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* 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 { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const gDashboard = Cc["@mozilla.org/network/dashboard;1"].getService(
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* 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";
|
||||
|
||||
var unsafeAboutModule = {
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]),
|
||||
newChannel(aURI, aLoadInfo) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var base = NetUtil.newURI("http://www.example.com");
|
||||
var about1 = NetUtil.newURI("about:blank");
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// socket should elicit NS_ERROR_SOCKET_ADDRESS_IN_USE on non-Windows
|
||||
// machines.
|
||||
|
||||
"use strict";
|
||||
|
||||
var CC = Components.Constructor;
|
||||
|
||||
const ServerSocket = CC(
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* - again we receive the data from the server.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* - this time the alt data must arive
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
* - readAltContent3 checks that it gets back the newly saved alt-data
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* - this time the alt data must arive
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
* data must be kept
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var data = "data ";
|
||||
var altData = "alt-data";
|
||||
|
||||
|
@ -16,7 +18,7 @@ function run_test() {
|
|||
do_get_profile();
|
||||
|
||||
// Expand both data to 1MB
|
||||
for (i = 0; i < 17; i++) {
|
||||
for (let i = 0; i < 17; i++) {
|
||||
data += data;
|
||||
altData += altData;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var h2Port;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
- close all and do it in the opposite way (do an anonymous req first)
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var h2Port;
|
||||
var prefs;
|
||||
var spdypref;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
// but don't allow it for cross-origin sub-resources
|
||||
// 2 - allow the cross-origin authentication as well.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function createURI(s) {
|
||||
let service = Cc["@mozilla.org/network/io-service;1"].getService(
|
||||
Ci.nsIIOService
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* <copied from="test_authentication.js"/>
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const FLAG_RETURN_FALSE = 1 << 0;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// This file tests authentication prompt callbacks
|
||||
// TODO NIT use do_check_eq(expected, actual) consistently, not sometimes eq(actual, expected)
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
"use strict";
|
||||
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
// Turn off the authentication dialog blocking for this test.
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
|
@ -690,7 +690,6 @@ function authShortDigest(metadata, response) {
|
|||
// no header, send one
|
||||
response.setStatusLine(metadata.httpVersion, 401, "Unauthorized");
|
||||
response.setHeader("WWW-Authenticate", "Digest", false);
|
||||
body = "failed, no header";
|
||||
}
|
||||
|
||||
let buildLargePayload = (function() {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
// - HTTPS
|
||||
// - Proxies
|
||||
|
||||
"use strict";
|
||||
|
||||
const nsIAuthInformation = Ci.nsIAuthInformation;
|
||||
const nsIAuthPromptAdapterFactory = Ci.nsIAuthPromptAdapterFactory;
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Globals
|
||||
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"FileUtils",
|
||||
|
@ -202,7 +204,7 @@ function promiseCopyToSaver(aSourceString, aSaverOutputStream, aCloseWhenDone) {
|
|||
if (Components.isSuccessCode(aStatusCode)) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(new Components.Exception(aResult));
|
||||
reject(new Components.Exception(aStatusCode));
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -250,7 +252,7 @@ function promisePumpToSaver(
|
|||
if (Components.isSuccessCode(aStatusCode)) {
|
||||
resolve();
|
||||
} else {
|
||||
reject(new Components.Exception(aResult));
|
||||
reject(new Components.Exception(aStatusCode));
|
||||
}
|
||||
},
|
||||
onDataAvailable: function PPTS_onDataAvailable(
|
||||
|
@ -685,7 +687,7 @@ add_task(async function test_invalid_hash() {
|
|||
do_throw("Shouldn't be able to get hash if hashing not enabled");
|
||||
} catch (ex) {
|
||||
if (ex.result != Cr.NS_ERROR_NOT_AVAILABLE) {
|
||||
throw e;
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
// Enable hashing, but don't feed any data to saver
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* - only difference is that we get a newer version of the content from the server during the second request
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
@ -64,7 +66,7 @@ function run_test() {
|
|||
|
||||
function run_test_content1a() {
|
||||
var chan = make_channel(URL + "/content1");
|
||||
caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
let caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
caching.cacheOnlyMetadata = true;
|
||||
chan.asyncOpen(new ChannelListener(contentListener1a, null));
|
||||
}
|
||||
|
@ -85,7 +87,7 @@ function cacheCheck1(status, entry) {
|
|||
}
|
||||
|
||||
var chan = make_channel(URL + "/content1");
|
||||
caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
let caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
caching.cacheOnlyMetadata = true;
|
||||
chan.asyncOpen(new ChannelListener(contentListener1b, null, CL_IGNORE_CL));
|
||||
}
|
||||
|
@ -104,7 +106,7 @@ function contentListener1b(request, buffer) {
|
|||
|
||||
function run_test_content2a() {
|
||||
var chan = make_channel(URL + "/content2");
|
||||
caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
let caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
caching.cacheOnlyMetadata = true;
|
||||
chan.asyncOpen(new ChannelListener(contentListener2a, null));
|
||||
}
|
||||
|
@ -128,7 +130,7 @@ function cacheCheck2(status, entry) {
|
|||
}
|
||||
|
||||
var chan = make_channel(URL + "/content2");
|
||||
caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
let caching = chan.QueryInterface(Ci.nsICachingChannel);
|
||||
caching.cacheOnlyMetadata = true;
|
||||
chan.asyncOpen(new ChannelListener(contentListener2b, null));
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ async function TestProxyType(chan, flags) {
|
|||
Ci.nsIProtocolProxyService.PROXYCONFIG_SYSTEM
|
||||
);
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
gProxyService.asyncResolve(chan, flags, {
|
||||
onProxyAvailable(req, uri, pi, status) {
|
||||
resolve(pi);
|
||||
|
@ -68,7 +68,7 @@ async function TestProxyType(chan, flags) {
|
|||
}
|
||||
|
||||
async function TestProxyTypeByURI(uri) {
|
||||
return await TestProxyType(makeChannel(uri), 0);
|
||||
return TestProxyType(makeChannel(uri), 0);
|
||||
}
|
||||
|
||||
add_task(async function testHttpProxy() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Test for bug 1195415
|
||||
|
||||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
var tests = [
|
||||
{ data: "", chunks: [], status: Cr.NS_OK, consume: [], dataChunks: [""] },
|
||||
{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
// Note: if the urgent request handling is broken (the urgent-marked requests
|
||||
// get blocked by queuing) this test will time out
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
var server = new HttpServer();
|
||||
server.start(-1);
|
||||
|
@ -98,7 +100,7 @@ HttpResponseListener.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
var responseQueue = new Array();
|
||||
var responseQueue = [];
|
||||
function setup_http_server() {
|
||||
log("setup_http_server");
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
// plus 4. Also, the request ids of the rest requests should be less than non-focused
|
||||
// window id + 2.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var server = new HttpServer();
|
||||
|
@ -113,7 +115,7 @@ function check_response_id(responses, maxWindowId) {
|
|||
}
|
||||
}
|
||||
|
||||
var responseQueue = new Array();
|
||||
var responseQueue = [];
|
||||
function setup_http_server() {
|
||||
log("setup_http_server");
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
// 4. When the server receive all 6 requests, check if the order in |responseQueue| is
|
||||
// equal to |transactionQueue| by comparing the value of X-ID.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var server = new HttpServer();
|
||||
|
@ -24,8 +26,8 @@ server.start(-1);
|
|||
var baseURL = "http://localhost:" + server.identity.primaryPort + "/";
|
||||
var maxConnections = 0;
|
||||
var debug = false;
|
||||
var dummyResponseQueue = new Array();
|
||||
var responseQueue = new Array();
|
||||
var dummyResponseQueue = [];
|
||||
var responseQueue = [];
|
||||
|
||||
function log(msg) {
|
||||
if (!debug) {
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
// Second, we check if the request id of the rest requests is equal to focused
|
||||
// window id.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var server = new HttpServer();
|
||||
|
@ -127,7 +129,7 @@ function check_response_id(responses, windowId) {
|
|||
}
|
||||
}
|
||||
|
||||
var responseQueue = new Array();
|
||||
var responseQueue = [];
|
||||
function setup_http_server() {
|
||||
log("setup_http_server");
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
// 3. We expect that all 6 active connections should be closed with the status
|
||||
// NS_ERROR_ABORT.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var server = new HttpServer();
|
||||
|
@ -79,7 +81,7 @@ HttpResponseListener.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
var responseQueue = new Array();
|
||||
var responseQueue = [];
|
||||
function setup_http_server() {
|
||||
log("setup_http_server");
|
||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
// 3. Check that the request isn't conditional, i.e. the entry from previous
|
||||
// load was doomed.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "URL", function() {
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
// specified in RFC 2616 section 14.9.3 by letting max-age
|
||||
// take precedence
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
const BUGID = "203271";
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* 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";
|
||||
|
||||
// names for cache devices
|
||||
const kDiskDevice = "disk";
|
||||
const kMemoryDevice = "memory";
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* 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 { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var httpserver;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var server;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const url = "http://foo.com/folder/file?/.";
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var server;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var f = do_get_file("test_bug336501.js");
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const URL = "ftp://localhost/bug365133/";
|
||||
|
||||
const tests = [
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var tld = Cc["@mozilla.org/network/effective-tld-service;1"].getService(
|
||||
Ci.nsIEffectiveTLDService
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
const BUGID = "369787";
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function test_not_too_long() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const testURLs = [
|
||||
["http://example.com/<", "http://example.com/%3C"],
|
||||
["http://example.com/>", "http://example.com/%3E"],
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var stream = Cc["@mozilla.org/io/string-input-stream;1"].createInstance(
|
||||
Ci.nsISupportsCString
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
const ios = Cc["@mozilla.org/network/io-service;1"].getService(
|
||||
Ci.nsIIOService
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
/* check resource: protocol for traversal problems */
|
||||
|
||||
"use strict";
|
||||
|
||||
const specs = [
|
||||
"resource:///chrome/../plugins",
|
||||
"resource:///chrome%2f../plugins",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
const ios = Cc["@mozilla.org/network/io-service;1"].getService(
|
||||
Ci.nsIIOService
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function round_trip(uri) {
|
||||
var objectOutStream = Cc["@mozilla.org/binaryoutputstream;1"].createInstance(
|
||||
Ci.nsIObjectOutputStream
|
||||
|
@ -45,9 +47,6 @@ function run_test() {
|
|||
Ci.nsIPrefBranch
|
||||
);
|
||||
for (var pref of prefData) {
|
||||
try {
|
||||
pref.oldVal = prefs.getBoolPref(pref.name);
|
||||
} catch (e) {}
|
||||
prefs.setBoolPref(pref.name, pref.newVal);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var httpserver = null;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
try {
|
||||
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var httpserv;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const PR_RDONLY = 0x1;
|
||||
|
||||
var etld = Cc["@mozilla.org/network/effective-tld-service;1"].getService(
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* Test for Bidi restrictions on IDNs from RFC 3454
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var idnService;
|
||||
|
||||
function expected_pass(inputIDN) {
|
||||
|
@ -43,7 +45,7 @@ function run_test() {
|
|||
// 0341; COMBINING ACUTE TONE MARK
|
||||
expected_fail("foo\u0341bar.com");
|
||||
// 200E; LEFT-TO-RIGHT MARK
|
||||
expected_fail("foo\200ebar.com");
|
||||
expected_fail("foo\u200ebar.com");
|
||||
// 200F; RIGHT-TO-LEFT MARK
|
||||
// Note: this is an RTL IDN so that it doesn't fail test 2) below
|
||||
expected_fail(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function run_test() {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
function getLinkFile() {
|
||||
if (mozinfo.os == "win") {
|
||||
return do_get_file("test_link.url");
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
// to punycode, not UTF-8 string
|
||||
// 2.only hostname-valid percent encoded ASCII characters should be decoded
|
||||
// 3.IDN convertion must not bypassed by %00
|
||||
|
||||
"use strict";
|
||||
|
||||
let reference = [
|
||||
[
|
||||
"www.example.com%e2%88%95www.mozill%d0%b0.com%e2%81%84www.mozilla.org",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
// Please see RFC 2616 section 13.2.1 6th paragraph for the
|
||||
// definition of "explicit expiration time" being used here.
|
||||
|
||||
"use strict";
|
||||
|
||||
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
|
||||
var httpserver = new HttpServer();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var CC = Components.Constructor;
|
||||
|
||||
const StreamCopier = CC(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// test that methods are not normalized
|
||||
|
||||
"use strict";
|
||||
|
||||
const testMethods = [
|
||||
["GET"],
|
||||
["get"],
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче