Move DidClearWindowObject into RendererClientBase.

Also adapt AtomSandboxedRenderFrameObserver to forward DidClearWindowObject to
RendererClientBase.
This commit is contained in:
Thiago de Arruda 2017-04-08 10:43:19 -03:00
parent 91ee0ea740
commit 0227254774
5 changed files with 10 additions and 11 deletions

View file

@ -25,7 +25,6 @@
#include "native_mate/dictionary.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "atom/common/node_includes.h"
@ -68,12 +67,6 @@ void AtomRendererClient::RenderViewCreated(content::RenderView* render_view) {
RendererClientBase::RenderViewCreated(render_view);
}
void AtomRendererClient::DidClearWindowObject(
content::RenderFrame* render_frame) {
// Make sure every page will get a script context created.
render_frame->GetWebFrame()->executeScript(blink::WebScriptSource("void 0"));
}
void AtomRendererClient::RunScriptsAtDocumentStart(
content::RenderFrame* render_frame) {
// Inform the document start pharse.

View file

@ -20,7 +20,6 @@ class AtomRendererClient : public RendererClientBase {
AtomRendererClient();
virtual ~AtomRendererClient();
void DidClearWindowObject(content::RenderFrame* render_frame);
void DidCreateScriptContext(
v8::Handle<v8::Context> context, content::RenderFrame* render_frame);
void WillReleaseScriptContext(

View file

@ -100,9 +100,7 @@ class AtomSandboxedRenderFrameObserver : public content::RenderFrameObserver {
// content::RenderFrameObserver:
void DidClearWindowObject() override {
// Make sure every page will get a script context created.
render_frame_->GetWebFrame()->executeScript(
blink::WebScriptSource("void 0"));
renderer_client_->DidClearWindowObject(render_frame_);
}
void DidCreateScriptContext(v8::Handle<v8::Context> context,

View file

@ -27,6 +27,7 @@
#include "third_party/WebKit/public/web/WebFrameWidget.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebPluginParams.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
#if defined(OS_MACOSX)
@ -151,6 +152,12 @@ void RendererClientBase::RenderViewCreated(content::RenderView* render_view) {
}
}
void RendererClientBase::DidClearWindowObject(
content::RenderFrame* render_frame) {
// Make sure every page will get a script context created.
render_frame->GetWebFrame()->executeScript(blink::WebScriptSource("void 0"));
}
blink::WebSpeechSynthesizer* RendererClientBase::OverrideSpeechSynthesizer(
blink::WebSpeechSynthesizerClient* client) {
return new TtsDispatcher(client);

View file

@ -19,6 +19,8 @@ class RendererClientBase : public content::ContentRendererClient {
RendererClientBase();
virtual ~RendererClientBase();
virtual void DidClearWindowObject(content::RenderFrame* render_frame);
protected:
void AddRenderBindings(v8::Isolate* isolate,
v8::Local<v8::Object> binding_object);