Compare commits

..

1 Commits

Author SHA1 Message Date
Keeley Hammond
0be6d43f4c build: add ensure_bootstrap command to depot_tools install 2025-05-19 21:11:36 -07:00
6 changed files with 3 additions and 103 deletions

View File

@@ -15,6 +15,7 @@ runs:
fi
export BUILD_TOOLS_SHA=6e8526315ea3b4828882497e532b8340e64e053c
npm i -g @electron/build-tools
e d ensure_bootstrap
e auto-update disable
e d auto-update disable
if [ "$(expr substr $(uname -s) 1 10)" == "MSYS_NT-10" ]; then

View File

@@ -60,10 +60,6 @@ following properties:
`strict-origin-when-cross-origin`.
* `cache` string (optional) - can be `default`, `no-store`, `reload`,
`no-cache`, `force-cache` or `only-if-cached`.
* `priority` string (optional) - can be `throttled`, `idle`, `lowest`,
`low`, `medium`, or `highest`. Defaults to `idle`.
* `priorityIncremental` boolean (optional) - the incremental loading flag as part
of HTTP extensible priorities (RFC 9218). Default is `true`.
`options` properties such as `protocol`, `host`, `hostname`, `port` and `path`
strictly follow the Node.js model as described in the

View File

@@ -288,12 +288,8 @@ function parseOptions (optionsIn: ClientRequestConstructorOptions | string): Nod
origin: options.origin,
referrerPolicy: options.referrerPolicy,
cache: options.cache,
allowNonHttpProtocols: Object.hasOwn(options, kAllowNonHttpProtocols),
priority: options.priority
allowNonHttpProtocols: Object.hasOwn(options, kAllowNonHttpProtocols)
};
if ('priorityIncremental' in options) {
urlLoaderOptions.priorityIncremental = options.priorityIncremental;
}
const headers: Record<string, string | string[]> = options.headers || {};
for (const [name, value] of Object.entries(headers)) {
validateHeader(name, value);

View File

@@ -638,24 +638,6 @@ gin::Handle<SimpleURLLoaderWrapper> SimpleURLLoaderWrapper::Create(
break;
}
if (std::string priority; opts.Get("priority", &priority)) {
static constexpr auto Lookup =
base::MakeFixedFlatMap<std::string_view, net::RequestPriority>({
{"throttled", net::THROTTLED},
{"idle", net::IDLE},
{"lowest", net::LOWEST},
{"low", net::LOW},
{"medium", net::MEDIUM},
{"highest", net::HIGHEST},
});
if (auto iter = Lookup.find(priority); iter != Lookup.end())
request->priority = iter->second;
}
if (bool priorityIncremental = request->priority_incremental;
opts.Get("priorityIncremental", &priorityIncremental)) {
request->priority_incremental = priorityIncremental;
}
const bool use_session_cookies =
opts.ValueOrDefault("useSessionCookies", false);
int options = network::mojom::kURLLoadOptionSniffMimeType;

View File

@@ -1,19 +1,15 @@
import { net, session, ClientRequest, ClientRequestConstructorOptions, utilityProcess } from 'electron/main';
import { net, ClientRequest, ClientRequestConstructorOptions, utilityProcess } from 'electron/main';
import { expect } from 'chai';
import { once } from 'node:events';
import * as fs from 'node:fs';
import * as http from 'node:http';
import * as http2 from 'node:http2';
import * as path from 'node:path';
import { setTimeout } from 'node:timers/promises';
import { collectStreamBody, collectStreamBodyBuffer, getResponse, kOneKiloByte, kOneMegaByte, randomBuffer, randomString, respondNTimes, respondOnce } from './lib/net-helpers';
import { listen, defer } from './lib/spec-helpers';
const utilityFixturePath = path.resolve(__dirname, 'fixtures', 'api', 'utility-process', 'api-net-spec.js');
const fixturesPath = path.resolve(__dirname, 'fixtures');
async function itUtility (name: string, fn?: Function, args?: {[key:string]: any}) {
it(`${name} in utility process`, async () => {
@@ -50,34 +46,6 @@ describe('net module', () => {
}
});
let http2URL: string;
const certPath = path.join(fixturesPath, 'certificates');
const h2server = http2.createSecureServer({
key: fs.readFileSync(path.join(certPath, 'server.key')),
cert: fs.readFileSync(path.join(certPath, 'server.pem'))
}, async (req, res) => {
if (req.method === 'POST') {
const chunks = [];
for await (const chunk of req) chunks.push(chunk);
res.end(Buffer.concat(chunks).toString('utf8'));
} else if (req.method === 'GET' && req.headers[':path'] === '/get') {
res.end(JSON.stringify({
headers: req.headers
}));
} else {
res.end('<html></html>');
}
});
before(async () => {
http2URL = (await listen(h2server)).url + '/';
});
after(() => {
h2server.close();
});
for (const test of [itIgnoringArgs, itUtility]) {
describe('HTTP basics', () => {
test('should be able to issue a basic GET request', async () => {
@@ -1647,45 +1615,4 @@ describe('net module', () => {
});
});
}
for (const test of [itIgnoringArgs]) {
describe('ClientRequest API', () => {
for (const [priorityName, urgency] of Object.entries({
throttled: 'u=5',
idle: 'u=4',
lowest: '',
low: 'u=2',
medium: 'u=1',
highest: 'u=0'
})) {
for (const priorityIncremental of [true, false]) {
test(`should set priority to ${priorityName}/${priorityIncremental} if requested`, async () => {
// Priority header is available on HTTP/2, which is only
// supported over TLS, so...
session.defaultSession.setCertificateVerifyProc((req, cb) => cb(0));
defer(() => {
session.defaultSession.setCertificateVerifyProc(null);
});
const urlRequest = net.request({
url: `${http2URL}get`,
priority: priorityName as any,
priorityIncremental
});
const response = await getResponse(urlRequest);
const data = JSON.parse(await collectStreamBody(response));
let expectedPriority = urgency;
if (priorityIncremental) {
expectedPriority = expectedPriority ? expectedPriority + ', i' : 'i';
}
if (expectedPriority === '') {
expect(data.headers.priority).to.be.undefined();
} else {
expect(data.headers.priority).to.be.a('string').and.equal(expectedPriority);
}
}, { priorityName, urgency, priorityIncremental });
}
}
});
}
});

View File

@@ -177,8 +177,6 @@ declare namespace NodeJS {
mode?: string;
destination?: string;
bypassCustomProtocolHandlers?: boolean;
priority?: 'throttled' | 'idle' | 'lowest' | 'low' | 'medium' | 'highest';
priorityIncremental?: boolean;
};
type ResponseHead = {
statusCode: number;