Skip to content
531ae8a fix: update docs for protocol API (#16601)
1 neutral , 3 successful , and 2 failing checks

Artifact Comparison

Neutral

ran Jan 30, 2019 in less than a minute

531ae8a by @nitsakh

schemes-api-5

Changes Detected

Looks like the electron.d.ts file changed.

Index: electron.d.ts
===================================================================
--- electron.d.ts	
+++ electron.d.ts	
@@ -2382,18 +2382,8 @@
 
     // Docs: http://electronjs.org/docs/api/content-tracing
 
     /**
-     * Get the current monitoring traced data. Child processes typically cache trace
-     * data and only rarely flush and send trace data back to the main process. This is
-     * because it may be an expensive operation to send the trace data over IPC and we
-     * would like to avoid unneeded runtime overhead from tracing. So, to end tracing,
-     * we must asynchronously ask all child processes to flush any pending trace data.
-     * Once all child processes have acknowledged the captureMonitoringSnapshot request
-     * the callback will be called with a file that contains the traced data.
-     */
-    captureMonitoringSnapshot(resultFilePath: string, callback: (resultFilePath: string) => void): void;
-    /**
      * Get a set of category groups. The category groups can change as new code paths
      * are reached. Once all child processes have acknowledged the getCategories
      * request the callback is invoked with an array of category groups.
      */
@@ -2404,27 +2394,15 @@
      * called.
      */
     getTraceBufferUsage(callback: (value: number, percentage: number) => void): void;
     /**
-     * Start monitoring on all processes. Monitoring begins immediately locally and
-     * asynchronously on child processes as soon as they receive the startMonitoring
-     * request. Once all child processes have acknowledged the startMonitoring request
-     * the callback will be called.
-     */
-    startMonitoring(options: StartMonitoringOptions, callback: Function): void;
-    /**
      * Start recording on all processes. Recording begins immediately locally and
      * asynchronously on child processes as soon as they receive the EnableRecording
      * request. The callback will be called once all child processes have acknowledged
      * the startRecording request.
      */
     startRecording(options: (TraceCategoriesAndOptions) | (TraceConfig), callback: Function): void;
     /**
-     * Stop monitoring on all processes. Once all child processes have acknowledged the
-     * stopMonitoring request the callback is called.
-     */
-    stopMonitoring(callback: Function): void;
-    /**
      * Stop recording on all processes. Child processes typically cache trace data and
      * only rarely flush and send trace data back to the main process. This helps to
      * minimize the runtime overhead of tracing since sending trace data over IPC can
      * be an expensive operation. So, to end tracing, we must asynchronously ask all
@@ -2652,8 +2630,19 @@
      */
     start(options: CrashReporterStartOptions): void;
   }
 
+  interface CustomScheme {
+
+    // Docs: http://electronjs.org/docs/api/structures/custom-scheme
+
+    privileges?: Privileges;
+    /**
+     * Custom schemes to be registered with options.
+     */
+    scheme: string;
+  }
+
   class Debugger extends EventEmitter {
 
     // Docs: http://electronjs.org/docs/api/debugger
 
@@ -3931,14 +3920,14 @@
      * Intercepts scheme protocol and uses handler as the protocol's new handler which
      * sends a String as a response.
      */
     interceptStringProtocol(scheme: string, handler: (request: InterceptStringProtocolRequest, callback: (data?: string) => void) => void, completion?: (error: Error) => void): void;
-    isProtocolHandled(scheme: string): Promise<Boolean>;
     /**
      * The callback will be called with a boolean that indicates whether there is
      * already a handler for scheme. Deprecated Soon
      */
     isProtocolHandled(scheme: string, callback: (handled: boolean) => void): void;
+    isProtocolHandled(scheme: string): Promise<Boolean>;
     /**
      * Registers a protocol of scheme that will send a Buffer as a response. The usage
      * is the same with registerFileProtocol, except that the callback should be called
      * with either a Buffer object or an object that has the data, mimeType, and
@@ -3972,26 +3961,29 @@
      * current session. If you want the request to have a different session you should
      * set session to null. For POST requests the uploadData object must be provided.
      */
     registerHttpProtocol(scheme: string, handler: (request: RegisterHttpProtocolRequest, callback: (redirectRequest: RedirectRequest) => void) => void, completion?: (error: Error) => void): void;
-    registerServiceWorkerSchemes(schemes: string[]): void;
     /**
-     * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
-     * http and https are standard schemes, while file is not. Registering a scheme as
-     * standard, will allow relative and absolute resources to be resolved correctly
-     * when served. Otherwise the scheme will behave like the file protocol, but
-     * without the ability to resolve relative URLs. For example when you load
-     * following page with custom protocol without registering it as standard scheme,
-     * the image will not be loaded because non-standard schemes can not recognize
-     * relative URLs: Registering a scheme as standard will allow access to files
-     * through the FileSystem API. Otherwise the renderer will throw a security error
-     * for the scheme. By default web storage apis (localStorage, sessionStorage,
-     * webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general
-     * if you want to register a custom protocol to replace the http protocol, you have
-     * to register it as a standard scheme: Note: This method can only be used before
-     * the ready event of the app module gets emitted.
+     * Note: This method can only be used before the ready event of the app module gets
+     * emitted and can be called only once. Registers the scheme as standard, secure,
+     * bypasses content security policy for resources, allows registering ServiceWorker
+     * and supports fetch API. Specify a privilege with the value of true to enable the
+     * capability. An example of registering a privileged scheme, with bypassing
+     * Content Security Policy: A standard scheme adheres to what RFC 3986 calls
+     * generic URI syntax. For example http and https are standard schemes, while file
+     * is not. Registering a scheme as standard, will allow relative and absolute
+     * resources to be resolved correctly when served. Otherwise the scheme will behave
+     * like the file protocol, but without the ability to resolve relative URLs. For
+     * example when you load following page with custom protocol without registering it
+     * as standard scheme, the image will not be loaded because non-standard schemes
+     * can not recognize relative URLs: Registering a scheme as standard will allow
+     * access to files through the FileSystem API. Otherwise the renderer will throw a
+     * security error for the scheme. By default web storage apis (localStorage,
+     * sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard
+     * schemes. So in general if you want to register a custom protocol to replace the
+     * http protocol, you have to register it as a standard scheme.
      */
-    registerStandardSchemes(schemes: string[], options?: RegisterStandardSchemesOptions): void;
+    registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
     /**
      * Registers a protocol of scheme that will send a Readable as a response. The
      * usage is similar to the other register{Any}Protocol, except that the callback
      * should be called with either a Readable object or an object that has the data,
@@ -6767,20 +6759,8 @@
      * Inserts text to the focused element.
      */
     insertText(text: string): void;
     /**
-     * Resources will be loaded from this scheme regardless of the current page's
-     * Content Security Policy.
-     */
-    registerURLSchemeAsBypassingCSP(scheme: string): void;
-    /**
-     * Registers the scheme as secure, bypasses content security policy for resources,
-     * allows registering ServiceWorker and supports fetch API. Specify an option with
-     * the value of false to omit it from the registration. An example of registering a
-     * privileged scheme, without bypassing Content Security Policy:
-     */
-    registerURLSchemeAsPrivileged(scheme: string, options?: RegisterURLSchemeAsPrivilegedOptions): void;
-    /**
      * Set the content security policy of the isolated world.
      */
     setIsolatedWorldContentSecurityPolicy(worldId: number, csp: string): void;
     /**
@@ -8813,9 +8793,9 @@
     urls: string[];
   }
 
   interface OnHeadersReceivedResponse {
-    cancel: boolean;
+    cancel?: boolean;
     /**
      * When provided, the server is assumed to have responded with these headers.
      */
     responseHeaders?: ResponseHeaders;
@@ -9071,8 +9051,35 @@
      */
     landscape?: boolean;
   }
 
+  interface Privileges {
+    /**
+     * Default false.
+     */
+    standard?: boolean;
+    /**
+     * Default false.
+     */
+    secure?: boolean;
+    /**
+     * Default false.
+     */
+    bypassCSP?: boolean;
+    /**
+     * Default false.
+     */
+    allowServiceWorkers?: boolean;
+    /**
+     * Default false.
+     */
+    supportFetchAPI?: boolean;
+    /**
+     * Default false.
+     */
+    corsEnabled?: boolean;
+  }
+
   interface ProcessMemoryInfo {
     /**
      * and The amount of memory currently pinned to actual physical RAM in Kilobytes.
      */
@@ -9136,15 +9143,8 @@
     method: string;
     uploadData: UploadData[];
   }
 
-  interface RegisterStandardSchemesOptions {
-    /**
-     * true to register the scheme as secure. Default false.
-     */
-    secure?: boolean;
-  }
-
   interface RegisterStreamProtocolRequest {
     url: string;
     headers: Headers;
     referrer: string;
@@ -9158,31 +9158,8 @@
     method: string;
     uploadData: UploadData[];
   }
 
-  interface RegisterURLSchemeAsPrivilegedOptions {
-    /**
-     * Default true.
-     */
-    secure?: boolean;
-    /**
-     * Default true.
-     */
-    bypassCSP?: boolean;
-    /**
-     * Default true.
-     */
-    allowServiceWorkers?: boolean;
-    /**
-     * Default true.
-     */
-    supportFetchAPI?: boolean;
-    /**
-     * Default true.
-     */
-    corsEnabled?: boolean;
-  }
-
   interface RelaunchOptions {
     args?: string[];
     execPath?: string;
   }
@@ -9320,13 +9297,8 @@
      */
     fetchWindowIcons?: boolean;
   }
 
-  interface StartMonitoringOptions {
-    categoryFilter: string;
-    traceOptions: string;
-  }
-
   interface SystemMemoryInfo {
     /**
      * The total amount of physical memory in Kilobytes available to the system.
      */
You can’t perform that action at this time.