From 7678a0aebb0fc539e9be4e9aa568fcc1393ab819 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 7 Jan 2022 09:52:47 +0100 Subject: [PATCH] chore: cleanup spec-main/ambient.d.ts (#32363) --- shell/browser/api/electron_api_web_contents.h | 1 - spec-main/ambient.d.ts | 12 +---------- spec-main/api-protocol-spec.ts | 4 ---- spec-main/api-web-contents-spec.ts | 21 +++++++++---------- spec-main/chromium-spec.ts | 2 -- 5 files changed, 11 insertions(+), 29 deletions(-) diff --git a/shell/browser/api/electron_api_web_contents.h b/shell/browser/api/electron_api_web_contents.h index 01cf5cb9095b3..8cd2a316d4c28 100644 --- a/shell/browser/api/electron_api_web_contents.h +++ b/shell/browser/api/electron_api_web_contents.h @@ -317,7 +317,6 @@ class WebContents : public ExclusiveAccessContext, std::vector GetPreloadPaths() const; // Returns the web preferences of current WebContents. - v8::Local GetWebPreferences(v8::Isolate* isolate) const; v8::Local GetLastWebPreferences(v8::Isolate* isolate) const; // Returns the owner window. diff --git a/spec-main/ambient.d.ts b/spec-main/ambient.d.ts index 36d9261b98b70..97fda55407db7 100644 --- a/spec-main/ambient.d.ts +++ b/spec-main/ambient.d.ts @@ -1,14 +1,4 @@ declare let standardScheme: string; - -declare namespace Electron { - interface WebContents { - getOwnerBrowserWindow(): BrowserWindow | null; - getWebPreferences(): WebPreferences | null; - } - - interface Session { - destroy(): void; - } -} +declare let serviceWorkerScheme: string; declare module 'dbus-native'; diff --git a/spec-main/api-protocol-spec.ts b/spec-main/api-protocol-spec.ts index 4f92a046b33fc..71437da6fe102 100644 --- a/spec-main/api-protocol-spec.ts +++ b/spec-main/api-protocol-spec.ts @@ -743,7 +743,6 @@ describe('protocol module', () => { }); describe('protocol.registerSchemesAsPrivileged allowServiceWorkers', () => { - const { serviceWorkerScheme } = global as any; protocol.registerStringProtocol(serviceWorkerScheme, (request, cb) => { if (request.url.endsWith('.js')) { cb({ @@ -773,7 +772,6 @@ describe('protocol module', () => { }); describe('protocol.registerSchemesAsPrivileged standard', () => { - const standardScheme = (global as any).standardScheme; const origin = `${standardScheme}://fake-host`; const imageURL = `${origin}/test.png`; const filePath = path.join(fixturesPath, 'pages', 'b.html'); @@ -854,7 +852,6 @@ describe('protocol module', () => { }); describe('protocol.registerSchemesAsPrivileged cors-fetch', function () { - const standardScheme = (global as any).standardScheme; let w: BrowserWindow = null as unknown as BrowserWindow; beforeEach(async () => { w = new BrowserWindow({ show: false }); @@ -957,7 +954,6 @@ describe('protocol module', () => { const pagePath = path.join(fixturesPath, 'pages', 'video.html'); const videoSourceImagePath = path.join(fixturesPath, 'video-source-image.webp'); const videoPath = path.join(fixturesPath, 'video.webm'); - const standardScheme = (global as any).standardScheme; let w: BrowserWindow = null as unknown as BrowserWindow; before(async () => { diff --git a/spec-main/api-web-contents-spec.ts b/spec-main/api-web-contents-spec.ts index c8e325dab76ae..c4aa16b67729b 100644 --- a/spec-main/api-web-contents-spec.ts +++ b/spec-main/api-web-contents-spec.ts @@ -893,7 +893,6 @@ describe('webContents module', () => { }); describe('zoom api', () => { - const scheme = (global as any).standardScheme; const hostZoomMap: Record = { host1: 0.3, host2: 0.7, @@ -902,7 +901,7 @@ describe('webContents module', () => { before(() => { const protocol = session.defaultSession.protocol; - protocol.registerStringProtocol(scheme, (request, callback) => { + protocol.registerStringProtocol(standardScheme, (request, callback) => { const response = `