diff --git a/shell/browser/api/electron_api_web_frame_main.cc b/shell/browser/api/electron_api_web_frame_main.cc index d1d3dfd9125d..9dc570aa9805 100644 --- a/shell/browser/api/electron_api_web_frame_main.cc +++ b/shell/browser/api/electron_api_web_frame_main.cc @@ -156,7 +156,7 @@ v8::Local WebFrameMain::ExecuteJavaScriptInIsolatedWorld( return handle; } -bool WebFrameMain::Reload(v8::Isolate* isolate) { +bool WebFrameMain::Reload() { if (!CheckRenderFrame()) return false; return render_frame_->Reload(); @@ -219,19 +219,19 @@ void WebFrameMain::PostMessage(v8::Isolate* isolate, std::move(transferable_message)); } -int WebFrameMain::FrameTreeNodeID(v8::Isolate* isolate) const { +int WebFrameMain::FrameTreeNodeID() const { if (!CheckRenderFrame()) return -1; return render_frame_->GetFrameTreeNodeId(); } -std::string WebFrameMain::Name(v8::Isolate* isolate) const { +std::string WebFrameMain::Name() const { if (!CheckRenderFrame()) return std::string(); return render_frame_->GetFrameName(); } -base::ProcessId WebFrameMain::OSProcessID(v8::Isolate* isolate) const { +base::ProcessId WebFrameMain::OSProcessID() const { if (!CheckRenderFrame()) return -1; base::ProcessHandle process_handle = @@ -239,38 +239,37 @@ base::ProcessId WebFrameMain::OSProcessID(v8::Isolate* isolate) const { return base::GetProcId(process_handle); } -int WebFrameMain::ProcessID(v8::Isolate* isolate) const { +int WebFrameMain::ProcessID() const { if (!CheckRenderFrame()) return -1; return render_frame_->GetProcess()->GetID(); } -int WebFrameMain::RoutingID(v8::Isolate* isolate) const { +int WebFrameMain::RoutingID() const { if (!CheckRenderFrame()) return -1; return render_frame_->GetRoutingID(); } -GURL WebFrameMain::URL(v8::Isolate* isolate) const { +GURL WebFrameMain::URL() const { if (!CheckRenderFrame()) return GURL::EmptyGURL(); return render_frame_->GetLastCommittedURL(); } -content::RenderFrameHost* WebFrameMain::Top(v8::Isolate* isolate) const { +content::RenderFrameHost* WebFrameMain::Top() const { if (!CheckRenderFrame()) return nullptr; return render_frame_->GetMainFrame(); } -content::RenderFrameHost* WebFrameMain::Parent(v8::Isolate* isolate) const { +content::RenderFrameHost* WebFrameMain::Parent() const { if (!CheckRenderFrame()) return nullptr; return render_frame_->GetParent(); } -std::vector WebFrameMain::Frames( - v8::Isolate* isolate) const { +std::vector WebFrameMain::Frames() const { std::vector frame_hosts; if (!CheckRenderFrame()) return frame_hosts; @@ -283,8 +282,7 @@ std::vector WebFrameMain::Frames( return frame_hosts; } -std::vector WebFrameMain::FramesInSubtree( - v8::Isolate* isolate) const { +std::vector WebFrameMain::FramesInSubtree() const { std::vector frame_hosts; if (!CheckRenderFrame()) return frame_hosts; diff --git a/shell/browser/api/electron_api_web_frame_main.h b/shell/browser/api/electron_api_web_frame_main.h index 462f1f98ff57..84b62476d263 100644 --- a/shell/browser/api/electron_api_web_frame_main.h +++ b/shell/browser/api/electron_api_web_frame_main.h @@ -76,7 +76,7 @@ class WebFrameMain : public gin::Wrappable, gin::Arguments* args, int world_id, const base::string16& code); - bool Reload(v8::Isolate* isolate); + bool Reload(); void Send(v8::Isolate* isolate, bool internal, const std::string& channel, @@ -86,18 +86,17 @@ class WebFrameMain : public gin::Wrappable, v8::Local message_value, base::Optional> transfer); - int FrameTreeNodeID(v8::Isolate* isolate) const; - std::string Name(v8::Isolate* isolate) const; - base::ProcessId OSProcessID(v8::Isolate* isolate) const; - int ProcessID(v8::Isolate* isolate) const; - int RoutingID(v8::Isolate* isolate) const; - GURL URL(v8::Isolate* isolate) const; + int FrameTreeNodeID() const; + std::string Name() const; + base::ProcessId OSProcessID() const; + int ProcessID() const; + int RoutingID() const; + GURL URL() const; - content::RenderFrameHost* Top(v8::Isolate* isolate) const; - content::RenderFrameHost* Parent(v8::Isolate* isolate) const; - std::vector Frames(v8::Isolate* isolate) const; - std::vector FramesInSubtree( - v8::Isolate* isolate) const; + content::RenderFrameHost* Top() const; + content::RenderFrameHost* Parent() const; + std::vector Frames() const; + std::vector FramesInSubtree() const; content::RenderFrameHost* render_frame_ = nullptr; diff --git a/spec-main/api-web-frame-main-spec.ts b/spec-main/api-web-frame-main-spec.ts index 21f63d973eb7..51fe5b13bd15 100644 --- a/spec-main/api-web-frame-main-spec.ts +++ b/spec-main/api-web-frame-main-spec.ts @@ -126,11 +126,12 @@ describe('webFrameMain module', () => { const w = new BrowserWindow({ show: false, webPreferences: { contextIsolation: true } }); await w.loadFile(path.join(subframesPath, 'frame.html')); const webFrame = w.webContents.mainFrame; - expect(webFrame).to.haveOwnProperty('frameTreeNodeId'); - expect(webFrame).to.haveOwnProperty('name'); - expect(webFrame).to.haveOwnProperty('osProcessId'); - expect(webFrame).to.haveOwnProperty('processId'); - expect(webFrame).to.haveOwnProperty('routingId'); + expect(webFrame).to.have.ownProperty('url').that.is.a('string'); + expect(webFrame).to.have.ownProperty('frameTreeNodeId').that.is.a('number'); + expect(webFrame).to.have.ownProperty('name').that.is.a('string'); + expect(webFrame).to.have.ownProperty('osProcessId').that.is.a('number'); + expect(webFrame).to.have.ownProperty('processId').that.is.a('number'); + expect(webFrame).to.have.ownProperty('routingId').that.is.a('number'); }); });