summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/render_view.cc5
-rw-r--r--chrome/renderer/render_view_unittest.cc5
-rw-r--r--chrome/renderer/user_script_slave.cc15
3 files changed, 12 insertions, 13 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 8e7a45e..50c98ec 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2478,9 +2478,8 @@ void RenderView::EvaluateScript(const std::wstring& frame_xpath,
if (!web_frame)
return;
- web_frame->ExecuteJavaScript(WideToUTF8(script),
- GURL(), // script url
- 1); // base line number
+ web_frame->ExecuteScript(
+ webkit_glue::WebScriptSource(WideToUTF8(script)));
}
void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath,
diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc
index 96d4704..e81cf4f 100644
--- a/chrome/renderer/render_view_unittest.cc
+++ b/chrome/renderer/render_view_unittest.cc
@@ -10,6 +10,7 @@
#include "chrome/renderer/renderer_webkitclient_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webframe.h"
+#include "webkit/glue/webscriptsource.h"
#include "webkit/glue/weburlrequest.h"
#include "webkit/glue/webview.h"
@@ -42,9 +43,7 @@ class RenderViewTest : public testing::Test {
// Executes the given JavaScript in the context of the main frame. The input
// is a NULL-terminated UTF-8 string.
void ExecuteJavaScript(const char* js) {
- GetMainFrame()->ExecuteJavaScript(js,
- GURL(), // script url
- 1); // base line number
+ GetMainFrame()->ExecuteScript(webkit_glue::WebScriptSource(js));
}
// Loads the given HTML into the main frame as a data: URL.
diff --git a/chrome/renderer/user_script_slave.cc b/chrome/renderer/user_script_slave.cc
index bc612f0..6362109 100644
--- a/chrome/renderer/user_script_slave.cc
+++ b/chrome/renderer/user_script_slave.cc
@@ -12,6 +12,7 @@
#include "chrome/common/resource_bundle.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/webframe.h"
+#include "webkit/glue/webscriptsource.h"
#include "grit/renderer_resources.h"
@@ -100,13 +101,13 @@ bool UserScriptSlave::InjectScripts(WebFrame* frame,
script != scripts_.end(); ++script) {
if ((*script)->MatchesUrl(frame->GetURL()) &&
(*script)->run_location() == location) {
- std::string inject(kUserScriptHead);
- inject.append(api_js_.as_string());
- inject.append(script_contents_[*script].as_string());
- inject.append(kUserScriptTail);
- frame->ExecuteJavaScript(inject,
- GURL((*script)->url().spec()),
- -user_script_start_line_);
+ webkit_glue::WebScriptSource sources[] = {
+ webkit_glue::WebScriptSource(api_js_.as_string()),
+ webkit_glue::WebScriptSource(
+ script_contents_[*script].as_string(), (*script)->url())
+ };
+
+ frame->ExecuteScriptInNewContext(sources, arraysize(sources));
++num_matched;
}
}