summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/user_script_slave.cc
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/user_script_slave.cc
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/user_script_slave.cc')
-rw-r--r--chrome/renderer/user_script_slave.cc15
1 files changed, 8 insertions, 7 deletions
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;
}
}