summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-17 00:06:27 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-17 00:06:27 +0000
commit49fed325fbf10a6c612b82360b941d500d8a2fa8 (patch)
treed4605501b1940f2df25948714a4540a7c8b33b7c /webkit
parent5df5165d0e0d7e6493dbca6d4c98a173a616467d (diff)
downloadchromium_src-49fed325fbf10a6c612b82360b941d500d8a2fa8.zip
chromium_src-49fed325fbf10a6c612b82360b941d500d8a2fa8.tar.gz
chromium_src-49fed325fbf10a6c612b82360b941d500d8a2fa8.tar.bz2
First pass as implementing the greasemonkey API. This patch
includes a javascript file with stubbed versions of all the greasemoney API methods as well as changes to the Greasemonkey slave to inject this javascript file along with other user scripts into the page.I also have a userscript I'm using for the unit testing of the API methods. I don't think there is a good place for it in the chrome tree (if there is I'd like to know), but you can view it here: http://skrul.com/greasemonkey/test.user.js Right now all the tests fail except for testLog and testUnsafeWindow. Review URL: http://codereview.chromium.org/18183 Patch from Steve Krulewitz <skrulx@gmail.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/webframe.h6
-rw-r--r--webkit/glue/webframe_impl.cc5
-rw-r--r--webkit/glue/webframe_impl.h3
3 files changed, 9 insertions, 5 deletions
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h
index 212bcab..a2a902a 100644
--- a/webkit/glue/webframe.h
+++ b/webkit/glue/webframe.h
@@ -95,9 +95,11 @@ class WebFrame : public base::RefCounted<WebFrame> {
// Executes a string of JavaScript in the web frame. The script_url param is
// the URL where the script in question can be found, if any. The renderer may
- // request this URL to show the developer the source of the error.
+ // request this URL to show the developer the source of the error. The
+ // start_line parameter is the base line number to use for error reporting.
virtual void ExecuteJavaScript(const std::string& js_code,
- const GURL& script_url) = 0;
+ const GURL& script_url,
+ int start_line) = 0;
// Returns a string representing the state of the previous page load for
// later use when loading. The previous page is the page that was loaded
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index e8e009b..a80a36c 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -1552,11 +1552,12 @@ void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request,
}
void WebFrameImpl::ExecuteJavaScript(const std::string& js_code,
- const GURL& script_url) {
+ const GURL& script_url,
+ int start_line) {
WebCore::ScriptSourceCode source_code(
webkit_glue::StdStringToString(js_code),
webkit_glue::GURLToKURL(script_url),
- 1); // base line number (for errors)
+ start_line);
frame_->loader()->executeScript(source_code);
}
diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h
index 87f630c..692cae0 100644
--- a/webkit/glue/webframe_impl.h
+++ b/webkit/glue/webframe_impl.h
@@ -96,7 +96,8 @@ class WebFrameImpl : public WebFrame {
bool replace,
const GURL& fake_url);
virtual void ExecuteJavaScript(const std::string& js_code,
- const GURL& script_url);
+ const GURL& script_url,
+ int start_line);
virtual bool GetPreviousHistoryState(std::string* history_state) const;
virtual bool GetCurrentHistoryState(std::string* history_state) const;
virtual bool HasCurrentHistoryState() const;