test: move protocol specs to main process (#18923)
This commit is contained in:
parent
fdb2502a19
commit
ec8697bcdc
9 changed files with 304 additions and 328 deletions
|
@ -131,11 +131,12 @@ protocol.registerSchemesAsPrivileged([
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `filePath` String (optional)
|
* `filePath` String | [FilePathWithHeaders](structures/file-path-with-headers.md) (optional)
|
||||||
* `completion` Function (optional)
|
* `completion` Function (optional)
|
||||||
* `error` Error
|
* `error` Error
|
||||||
|
|
||||||
|
@ -165,6 +166,7 @@ than protocols that follow the "generic URI syntax" like `file:`.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
|
@ -197,11 +199,12 @@ protocol.registerBufferProtocol('atom', (request, callback) => {
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `data` String (optional)
|
* `data` (String | [StringProtocolResponse](structures/string-protocol-response.md)) (optional)
|
||||||
* `completion` Function (optional)
|
* `completion` Function (optional)
|
||||||
* `error` Error
|
* `error` Error
|
||||||
|
|
||||||
|
@ -217,14 +220,14 @@ should be called with either a `String` or an object that has the `data`,
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
* `headers` Object
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `redirectRequest` Object
|
* `redirectRequest` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
* `method` String
|
* `method` String (optional)
|
||||||
* `session` Object (optional)
|
* `session` Object (optional)
|
||||||
* `uploadData` Object (optional)
|
* `uploadData` Object (optional)
|
||||||
* `contentType` String - MIME type of the content.
|
* `contentType` String - MIME type of the content.
|
||||||
|
@ -249,7 +252,7 @@ For POST requests the `uploadData` object must be provided.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
* `headers` Object
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
|
@ -325,6 +328,7 @@ already a handler for `scheme`.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
|
@ -342,11 +346,12 @@ which sends a file as a response.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `data` String (optional)
|
* `data` (String | [StringProtocolResponse](structures/string-protocol-response.md)) (optional)
|
||||||
* `completion` Function (optional)
|
* `completion` Function (optional)
|
||||||
* `error` Error
|
* `error` Error
|
||||||
|
|
||||||
|
@ -359,6 +364,7 @@ which sends a `String` as a response.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
|
@ -376,15 +382,15 @@ which sends a `Buffer` as a response.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
* `headers` Object
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
* `callback` Function
|
* `callback` Function
|
||||||
* `redirectRequest` Object
|
* `redirectRequest` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
* `method` String
|
* `method` String (optional)
|
||||||
* `session` Object (optional)
|
* `session` Object | null (optional)
|
||||||
* `uploadData` Object (optional)
|
* `uploadData` Object (optional)
|
||||||
* `contentType` String - MIME type of the content.
|
* `contentType` String - MIME type of the content.
|
||||||
* `data` String - Content to be sent.
|
* `data` String - Content to be sent.
|
||||||
|
@ -400,7 +406,7 @@ which sends a new HTTP request as a response.
|
||||||
* `handler` Function
|
* `handler` Function
|
||||||
* `request` Object
|
* `request` Object
|
||||||
* `url` String
|
* `url` String
|
||||||
* `headers` Object
|
* `headers` Record<String, String>
|
||||||
* `referrer` String
|
* `referrer` String
|
||||||
* `method` String
|
* `method` String
|
||||||
* `uploadData` [UploadData[]](structures/upload-data.md)
|
* `uploadData` [UploadData[]](structures/upload-data.md)
|
||||||
|
|
4
docs/api/structures/file-path-with-headers.md
Normal file
4
docs/api/structures/file-path-with-headers.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# FilePathWithHeaders Object
|
||||||
|
|
||||||
|
* `path` String - The path to the file to send.
|
||||||
|
* `headers` Record<string, string> (optional) - Additional headers to be sent.
|
|
@ -1,5 +1,5 @@
|
||||||
# StreamProtocolResponse Object
|
# StreamProtocolResponse Object
|
||||||
|
|
||||||
* `statusCode` Number - The HTTP response code.
|
* `statusCode` Number (optional) - The HTTP response code.
|
||||||
* `headers` Object - An object containing the response headers.
|
* `headers` Record<String, String | String[]> (optional) - An object containing the response headers.
|
||||||
* `data` ReadableStream - A Node.js readable stream representing the response body.
|
* `data` ReadableStream | null - A Node.js readable stream representing the response body.
|
||||||
|
|
5
docs/api/structures/string-protocol-response.md
Normal file
5
docs/api/structures/string-protocol-response.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# StringProtocolResponse Object
|
||||||
|
|
||||||
|
* `mimeType` String (optional) - MIME type of the response.
|
||||||
|
* `charset` String (optional) - Charset of the response.
|
||||||
|
* `data` String | null - A string representing the response body.
|
|
@ -1,6 +1,7 @@
|
||||||
# UploadData Object
|
# UploadData Object
|
||||||
|
|
||||||
|
* `contentType` String (optional) - Content type of the content to be sent.
|
||||||
* `bytes` Buffer - Content being sent.
|
* `bytes` Buffer - Content being sent.
|
||||||
* `file` String - Path of file being uploaded.
|
* `file` String (optional) - Path of file being uploaded.
|
||||||
* `blobUUID` String - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier method
|
* `blobUUID` String (optional) - UUID of blob data. Use [ses.getBlobData](../session.md#sesgetblobdataidentifier) method
|
||||||
to retrieve the data.
|
to retrieve the data.
|
||||||
|
|
|
@ -75,6 +75,7 @@ auto_filenames = {
|
||||||
"docs/api/structures/display.md",
|
"docs/api/structures/display.md",
|
||||||
"docs/api/structures/event.md",
|
"docs/api/structures/event.md",
|
||||||
"docs/api/structures/file-filter.md",
|
"docs/api/structures/file-filter.md",
|
||||||
|
"docs/api/structures/file-path-with-headers.md",
|
||||||
"docs/api/structures/gpu-feature-status.md",
|
"docs/api/structures/gpu-feature-status.md",
|
||||||
"docs/api/structures/io-counters.md",
|
"docs/api/structures/io-counters.md",
|
||||||
"docs/api/structures/ipc-main-event.md",
|
"docs/api/structures/ipc-main-event.md",
|
||||||
|
@ -100,6 +101,7 @@ auto_filenames = {
|
||||||
"docs/api/structures/shortcut-details.md",
|
"docs/api/structures/shortcut-details.md",
|
||||||
"docs/api/structures/size.md",
|
"docs/api/structures/size.md",
|
||||||
"docs/api/structures/stream-protocol-response.md",
|
"docs/api/structures/stream-protocol-response.md",
|
||||||
|
"docs/api/structures/string-protocol-response.md",
|
||||||
"docs/api/structures/task.md",
|
"docs/api/structures/task.md",
|
||||||
"docs/api/structures/thumbar-button.md",
|
"docs/api/structures/thumbar-button.md",
|
||||||
"docs/api/structures/trace-categories-and-options.md",
|
"docs/api/structures/trace-categories-and-options.md",
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,9 @@ global.standardScheme = 'app'
|
||||||
protocol.registerSchemesAsPrivileged([
|
protocol.registerSchemesAsPrivileged([
|
||||||
{ scheme: global.standardScheme, privileges: { standard: true, secure: true } },
|
{ scheme: global.standardScheme, privileges: { standard: true, secure: true } },
|
||||||
{ scheme: 'cors-blob', privileges: { corsEnabled: true, supportFetchAPI: true } },
|
{ scheme: 'cors-blob', privileges: { corsEnabled: true, supportFetchAPI: true } },
|
||||||
|
{ scheme: 'cors', privileges: { corsEnabled: true, supportFetchAPI: true } },
|
||||||
|
{ scheme: 'no-cors', privileges: { supportFetchAPI: true } },
|
||||||
|
{ scheme: 'no-fetch', privileges: { corsEnabled: true } }
|
||||||
])
|
])
|
||||||
|
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
|
|
0
spec/fixtures/pages/blank.html
vendored
Normal file
0
spec/fixtures/pages/blank.html
vendored
Normal file
Loading…
Reference in a new issue