Run content scripts at correct phase

This commit is contained in:
Cheng Zhao 2016-05-27 11:07:06 +09:00
parent 49d9446cce
commit 7e1f159185
4 changed files with 32 additions and 10 deletions

View file

@ -186,6 +186,23 @@ void AtomRendererClient::RunScriptsAtDocumentStart(
// Make sure every page will get a script context created.
render_frame->GetWebFrame()->executeScript(
blink::WebScriptSource("void 0"));
// Inform the docuemnt start pharse.
node::Environment* env = node_bindings_->uv_env();
if (env) {
v8::HandleScope handle_scope(env->isolate());
mate::EmitEvent(env->isolate(), env->process_object(), "document-start");
}
}
void AtomRendererClient::RunScriptsAtDocumentEnd(
content::RenderFrame* render_frame) {
// Inform the docuemnt end pharse.
node::Environment* env = node_bindings_->uv_env();
if (env) {
v8::HandleScope handle_scope(env->isolate());
mate::EmitEvent(env->isolate(), env->process_object(), "document-end");
}
}
blink::WebSpeechSynthesizer* AtomRendererClient::OverrideSpeechSynthesizer(