diff options
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/webframe.h | 6 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.cc | 7 | ||||
-rw-r--r-- | webkit/glue/webframe_impl.h | 2 |
3 files changed, 15 insertions, 0 deletions
diff --git a/webkit/glue/webframe.h b/webkit/glue/webframe.h index 2169549..c8d73af 100644 --- a/webkit/glue/webframe.h +++ b/webkit/glue/webframe.h @@ -91,6 +91,12 @@ class WebFrame : public base::RefCounted<WebFrame> { bool replace, const GURL& fake_url) = 0; + // 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. + virtual void ExecuteJavaScript(const std::string& js_code, + const std::string& script_url) = 0; + // Returns a string representing the state of the previous page load for // later use when loading as well as the uri and title of the page. The // previous page is the page that was loaded before DidCommitLoadForFrame was diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc index 4710e21..ca8997e 100644 --- a/webkit/glue/webframe_impl.cc +++ b/webkit/glue/webframe_impl.cc @@ -1595,6 +1595,13 @@ void WebFrameImpl::LoadAlternateHTMLErrorPage(const WebRequest* request, error_page_url)); } +void WebFrameImpl::ExecuteJavaScript(const std::string& js_code, + const std::string& script_url) { + frame_->loader()->executeScript(webkit_glue::StdStringToString(script_url), + 1, // base line number (for errors) + webkit_glue::StdStringToString(js_code)); +} + std::wstring WebFrameImpl::GetName() { return webkit_glue::StringToStdWString(frame_->tree()->name()); } diff --git a/webkit/glue/webframe_impl.h b/webkit/glue/webframe_impl.h index fd887d5..9a8afdb 100644 --- a/webkit/glue/webframe_impl.h +++ b/webkit/glue/webframe_impl.h @@ -94,6 +94,8 @@ class WebFrameImpl : public WebFrame { const GURL& error_page_url, bool replace, const GURL& fake_url); + virtual void ExecuteJavaScript(const std::string& js_code, + const std::string& script_url); virtual bool GetPreviousState(GURL* url, std::wstring* title, std::string* history_state) const; virtual bool GetCurrentState(GURL* url, std::wstring* title, |