Skip to content

Commit

Permalink
chore: remove unused getWebPreferences method (electron#30160)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon authored Jul 19, 2021
1 parent a329842 commit 612361c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
9 changes: 0 additions & 9 deletions shell/browser/api/electron_api_web_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3052,14 +3052,6 @@ std::vector<base::FilePath> WebContents::GetPreloadPaths() const {
return result;
}

v8::Local<v8::Value> WebContents::GetWebPreferences(
v8::Isolate* isolate) const {
auto* web_preferences = WebContentsPreferences::From(web_contents());
if (!web_preferences)
return v8::Null(isolate);
return gin::ConvertToV8(isolate, *web_preferences->preference());
}

v8::Local<v8::Value> WebContents::GetLastWebPreferences(
v8::Isolate* isolate) const {
auto* web_preferences = WebContentsPreferences::From(web_contents());
Expand Down Expand Up @@ -3719,7 +3711,6 @@ v8::Local<v8::ObjectTemplate> WebContents::FillObjectTemplate(
.SetMethod("getZoomFactor", &WebContents::GetZoomFactor)
.SetMethod("getType", &WebContents::GetType)
.SetMethod("_getPreloadPaths", &WebContents::GetPreloadPaths)
.SetMethod("getWebPreferences", &WebContents::GetWebPreferences)
.SetMethod("getLastWebPreferences", &WebContents::GetLastWebPreferences)
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
.SetMethod("inspectServiceWorker", &WebContents::InspectServiceWorker)
Expand Down
10 changes: 0 additions & 10 deletions spec-main/api-web-contents-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -503,16 +503,6 @@ describe('webContents module', () => {
});
});

describe('getWebPreferences() API', () => {
afterEach(closeAllWindows);
it('should not crash when called for devTools webContents', async () => {
const w = new BrowserWindow({ show: false });
w.webContents.openDevTools();
await emittedOnce(w.webContents, 'devtools-opened');
expect(w.webContents.devToolsWebContents!.getWebPreferences()).to.be.null();
});
});

describe('openDevTools() API', () => {
afterEach(closeAllWindows);
it('can show window with activation', async () => {
Expand Down
1 change: 0 additions & 1 deletion typings/internal-electron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ declare namespace Electron {
interface WebContents {
_loadURL(url: string, options: ElectronInternal.LoadURLOptions): void;
getOwnerBrowserWindow(): Electron.BrowserWindow;
getWebPreferences(): Electron.WebPreferences;
getLastWebPreferences(): Electron.WebPreferences;
_getPreloadPaths(): string[];
equal(other: WebContents): boolean;
Expand Down

0 comments on commit 612361c

Please sign in to comment.