summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 23:26:13 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-13 23:26:13 +0000
commitbad146c5b3b1a7d0368320fecdbd5b50dbe97501 (patch)
tree8d5aad70f51fcfba24ccebd3359b7d33209370d7 /chrome/renderer
parentccef48cca72fbc8905a643759092ee0d913aca9c (diff)
downloadchromium_src-bad146c5b3b1a7d0368320fecdbd5b50dbe97501.zip
chromium_src-bad146c5b3b1a7d0368320fecdbd5b50dbe97501.tar.gz
chromium_src-bad146c5b3b1a7d0368320fecdbd5b50dbe97501.tar.bz2
Commit 40144. I had to move to to a separate CL to use gcl's
"try multiple commits" feature. Review URL: http://codereview.chromium.org/46062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11683 0039d316-1c4b-4281-b951-d872f2087c98
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;
}
}