From 93b00632d4a0663546bd856dfd4a5d13ec3acc64 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 25 Mar 2016 21:12:39 +0100 Subject: [PATCH] Update web-frame module --- .../github-electron-renderer-tests.ts | 16 ++++++++++++++++ github-electron/github-electron.web-frame.d.ts | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index d412feed73..b827b2b566 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -50,6 +50,12 @@ remote.getCurrentWindow().capturePage(buf => { // https://github.com/atom/electron/blob/master/docs/api/web-frame.md webFrame.setZoomFactor(2); +console.log(webFrame.getZoomFactor()); + +webFrame.setZoomLevel(200); +console.log(webFrame.getZoomLevel()); + +webFrame.setZoomLevelLimits(50, 200); webFrame.setSpellCheckProvider('en-US', true, { spellCheck: text => { @@ -57,6 +63,16 @@ webFrame.setSpellCheckProvider('en-US', true, { } }); +webFrame.registerURLSchemeAsSecure('app'); +webFrame.registerURLSchemeAsBypassingCSP('app'); +webFrame.registerURLSchemeAsPrivileged('app'); + +webFrame.insertText('text'); + +webFrame.executeJavaScript('JSON.stringify({})', false, (result) => { + console.log(result); +}); + // clipboard // https://github.com/atom/electron/blob/master/docs/api/clipboard.md diff --git a/github-electron/github-electron.web-frame.d.ts b/github-electron/github-electron.web-frame.d.ts index 98ccc38b4e..4a0dd15d13 100644 --- a/github-electron/github-electron.web-frame.d.ts +++ b/github-electron/github-electron.web-frame.d.ts @@ -4,7 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Electron { - + /** + * The web-frame module allows you to customize the rendering of the current web page. + */ interface WebFrame { /** * Changes the zoom factor to the specified factor, zoom factor is @@ -25,6 +27,10 @@ declare namespace Electron { * @returns The current zoom level. */ getZoomLevel(): number; + /** + * Sets the maximum and minimum zoom level. + */ + setZoomLevelLimits(minimumLevel: number, maximumLevel: number): void; /** * Sets a provider for spell checking in input fields and text areas. */ @@ -40,6 +46,15 @@ declare namespace Electron { * corrupted by active network attackers. */ registerURLSchemeAsSecure(scheme: 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. + */ + registerURLSchemeAsPrivileged(scheme: string): void; /** * Inserts text to the focused element. */