@@ -33,7 +33,13 @@ using namespace WebCore;
33
33
#include " third_party/WebKit/public/web/WebFrame.h"
34
34
#include " third_party/WebKit/public/web/WebView.h"
35
35
#include " third_party/WebKit/Source/web/WebFrameImpl.h"
36
+ #include " third_party/WebKit/public/web/WebScriptSource.h"
36
37
38
+ #undef CHECK
39
+ #include " V8HTMLIFrameElement.h"
40
+
41
+ using WebKit::WebScriptSource;
42
+ using WebKit::WebFrame;
37
43
38
44
namespace nwapi {
39
45
@@ -103,8 +109,24 @@ WindowBindings::CallObjectMethod(const v8::FunctionCallbackInfo<v8::Value>& args
103
109
return ;
104
110
}
105
111
106
- if (method == " setDevToolsJail" ) {
107
- WebKit::WebFrame* main_frame = render_view->GetWebView ()->mainFrame ();
112
+ WebFrame* main_frame = render_view->GetWebView ()->mainFrame ();
113
+ if (method == " EvaluateScript" ) {
114
+ v8::Handle<v8::Value> result;
115
+ v8::Handle<v8::Object> frm = v8::Handle<v8::Object>::Cast (args[2 ]);
116
+ WebFrame* web_frame = NULL ;
117
+ if (frm->IsNull ()) {
118
+ web_frame = main_frame;
119
+ }else {
120
+ WebCore::HTMLIFrameElement* iframe = WebCore::V8HTMLIFrameElement::toNative (frm);
121
+ web_frame = WebKit::WebFrameImpl::fromFrame (iframe->contentFrame ());
122
+ }
123
+ base::string16 jscript = *v8::String::Value (args[3 ]);
124
+ if (web_frame) {
125
+ result = web_frame->executeScriptAndReturnValue (WebScriptSource (jscript));
126
+ }
127
+ args.GetReturnValue ().Set (result);
128
+ return ;
129
+ } else if (method == " setDevToolsJail" ) {
108
130
v8::Handle<v8::Object> frm = v8::Handle<v8::Object>::Cast (args[2 ]);
109
131
if (frm->IsNull ()) {
110
132
main_frame->setDevtoolsJail (NULL );
0 commit comments