summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/messaging_bindings.cc
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2014-12-15 18:29:08 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-16 02:29:29 +0000
commit7e0846da8d2da2c0cda56af8c180bcdefb08c046 (patch)
treed1048329589b7898c970f3d062594e5f1807352a /extensions/renderer/messaging_bindings.cc
parent80667a2e8e2b563efb7e935a44c54d5729cbeb35 (diff)
downloadchromium_src-7e0846da8d2da2c0cda56af8c180bcdefb08c046.zip
chromium_src-7e0846da8d2da2c0cda56af8c180bcdefb08c046.tar.gz
chromium_src-7e0846da8d2da2c0cda56af8c180bcdefb08c046.tar.bz2
Revert of Update extensions::MessagingBindings to use WebScopedWindowFocusAllowedIndicator with WebDocument. (patchset #1 id:1 of https://codereview.chromium.org/786403003/)
Reason for revert: This CL or its dependency in blink (https://codereview.chromium.org/803253003/) is the suspected source of issue 441968 (very prominent renderer crash), among other crashes. Original issue's description: > Update extensions::MessagingBindings to use WebScopedWindowFocusAllowedIndicator with WebDocument. > > This will allow Blink to delete some deprecated code. > > This is part of a three-sided CL: > Part 1: https://codereview.chromium.org/777483004/ > Part 2: <this> > Part 3: https://codereview.chromium.org/722423004 > > BUG=440740 > > Committed: https://crrev.com/ebb4bf8090b06979fd44411af69304b505681f4d > Cr-Commit-Position: refs/heads/master@{#307914} TBR=scheib@chromium.org,mlamouri@chromium.org NOTREECHECKS=true NOTRY=true BUG=440740 Review URL: https://codereview.chromium.org/807593003 Cr-Commit-Position: refs/heads/master@{#308506}
Diffstat (limited to 'extensions/renderer/messaging_bindings.cc')
-rw-r--r--extensions/renderer/messaging_bindings.cc29
1 files changed, 11 insertions, 18 deletions
diff --git a/extensions/renderer/messaging_bindings.cc b/extensions/renderer/messaging_bindings.cc
index 2fd2676..cb24496 100644
--- a/extensions/renderer/messaging_bindings.cc
+++ b/extensions/renderer/messaging_bindings.cc
@@ -25,7 +25,6 @@
#include "extensions/renderer/scoped_persistent.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/script_context_set.h"
-#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
#include "third_party/WebKit/public/web/WebScopedUserGesture.h"
@@ -325,7 +324,7 @@ void DispatchOnConnectToScriptContext(
}
}
-void DeliverMessageToScriptContext(const Message& message,
+void DeliverMessageToScriptContext(const std::string& message_data,
int target_port_id,
ScriptContext* script_context) {
v8::Isolate* isolate = script_context->isolate();
@@ -345,23 +344,10 @@ void DeliverMessageToScriptContext(const Message& message,
std::vector<v8::Handle<v8::Value> > arguments;
arguments.push_back(v8::String::NewFromUtf8(isolate,
- message.data.c_str(),
+ message_data.c_str(),
v8::String::kNormalString,
- message.data.size()));
+ message_data.size()));
arguments.push_back(port_id_handle);
-
- scoped_ptr<blink::WebScopedUserGesture> web_user_gesture;
- scoped_ptr<blink::WebScopedWindowFocusAllowedIndicator> allow_window_focus;
- if (message.user_gesture) {
- web_user_gesture.reset(new blink::WebScopedUserGesture);
-
- if (script_context->web_frame()) {
- blink::WebDocument document = script_context->web_frame()->document();
- allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator(
- &document));
- }
- }
-
script_context->module_system()->CallModuleMethod(
"messaging", "dispatchOnMessage", &arguments);
}
@@ -425,13 +411,20 @@ void MessagingBindings::DeliverMessage(
int target_port_id,
const Message& message,
content::RenderFrame* restrict_to_render_frame) {
+ scoped_ptr<blink::WebScopedUserGesture> web_user_gesture;
+ scoped_ptr<blink::WebScopedWindowFocusAllowedIndicator> allow_window_focus;
+ if (message.user_gesture) {
+ web_user_gesture.reset(new blink::WebScopedUserGesture);
+ allow_window_focus.reset(new blink::WebScopedWindowFocusAllowedIndicator);
+ }
+
// TODO(robwu): ScriptContextSet.ForEach should accept RenderFrame*.
content::RenderView* restrict_to_render_view =
restrict_to_render_frame ? restrict_to_render_frame->GetRenderView()
: NULL;
context_set.ForEach(
restrict_to_render_view,
- base::Bind(&DeliverMessageToScriptContext, message, target_port_id));
+ base::Bind(&DeliverMessageToScriptContext, message.data, target_port_id));
}
// static