94610715beee98e5d69a8af9e75983b0a12f07db
[WebKit-https.git] / WebKit / gtk / Api / webkitgtkpage.cpp
1 /*
2  * Copyright (C) 2007 Holger Hans Peter Freyther
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer. 
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution. 
13  * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission. 
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28
29 #include "config.h"
30
31 #include "webkitgtkpage.h"
32 #include "webkitgtk-marshal.h"
33 #include "webkitgtkprivate.h"
34
35 #include "NotImplemented.h"
36 #include "ChromeClientGtk.h"
37 #include "ContextMenuClientGtk.h"
38 #include "DragClientGtk.h"
39 #include "EditorClientGtk.h"
40 #include "EventHandler.h"
41 #include "HitTestRequest.h"
42 #include "HitTestResult.h"
43 #include "GraphicsContext.h"
44 #include "InspectorClientGtk.h"
45 #include "FrameLoader.h"
46 #include "FrameView.h"
47 #include "PlatformKeyboardEvent.h"
48 #include "PlatformWheelEvent.h"
49 #include "SubstituteData.h"
50
51
52 using namespace WebKit;
53 using namespace WebCore;
54
55 extern "C" {
56
57 enum {
58     /* normal signals */
59     LOAD_STARTED,
60     LOAD_PROGRESS_CHANGED,
61     LOAD_FINISHED,
62     TITLE_CHANGED,
63     HOVERING_OVER_LINK,
64     STATUS_BAR_TEXT_CHANGED,
65     ICOND_LOADED,
66     SELECTION_CHANGED,
67     LAST_SIGNAL
68 };
69
70 static guint webkit_page_signals[LAST_SIGNAL] = { 0, };
71
72 G_DEFINE_TYPE(WebKitPage, webkit_page, GTK_TYPE_CONTAINER)
73
74 static gboolean webkit_page_expose_event(GtkWidget* widget, GdkEventExpose* event)
75 {
76     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
77     GdkRectangle clip;
78     gdk_region_get_clipbox(event->region, &clip);
79     cairo_t* cr = gdk_cairo_create(event->window);
80     GraphicsContext ctx(cr);
81     ctx.setGdkExposeEvent(event);
82     if (frame->renderer()) {
83         frame->view()->layoutIfNeededRecursive();
84         frame->view()->paint(&ctx, clip);
85     }
86     cairo_destroy(cr);
87
88     return FALSE;
89 }
90
91 static gboolean webkit_page_key_event(GtkWidget* widget, GdkEventKey* event)
92 {
93     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
94     return frame->eventHandler()->keyEvent(PlatformKeyboardEvent(event));
95 }
96
97 static gboolean webkit_page_button_event(GtkWidget* widget, GdkEventButton* event)
98 {
99     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
100
101     if (event->type == GDK_BUTTON_RELEASE)
102         return frame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
103
104     // FIXME: need to keep track of subframe focus for key events
105     gtk_widget_grab_focus(GTK_WIDGET(widget));
106     return frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event));
107 }
108
109 static gboolean webkit_page_motion_event(GtkWidget* widget, GdkEventMotion* event)
110 {
111     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
112     return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event));
113 }
114
115 static gboolean webkit_page_scroll_event(GtkWidget* widget, GdkEventScroll* event)
116 {
117     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
118     PlatformWheelEvent wheelEvent(event);
119     return frame->eventHandler()->handleWheelEvent(wheelEvent);
120 }
121
122 static void webkit_page_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
123 {
124     GTK_WIDGET_CLASS(webkit_page_parent_class)->size_allocate(widget,allocation);
125
126     Frame* frame = core(getFrameFromPage(WEBKIT_PAGE(widget)));
127     frame->view()->resize(allocation->width, allocation->height);
128     frame->forceLayout();
129     frame->view()->adjustViewSize();
130     frame->sendResizeEvent();
131 }
132
133 static void webkit_page_realize(GtkWidget* widget)
134 {
135     GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
136
137     GdkWindowAttr attributes;
138     attributes.window_type = GDK_WINDOW_CHILD;
139     attributes.x = widget->allocation.x;
140     attributes.y = widget->allocation.y;
141     attributes.width = widget->allocation.width;
142     attributes.height = widget->allocation.height;
143     attributes.wclass = GDK_INPUT_OUTPUT;
144     attributes.visual = gtk_widget_get_visual (widget);
145     attributes.colormap = gtk_widget_get_colormap (widget);
146     attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK
147                             | GDK_EXPOSURE_MASK
148                             | GDK_BUTTON_PRESS_MASK
149                             | GDK_BUTTON_RELEASE_MASK
150                             | GDK_POINTER_MOTION_MASK
151                             | GDK_KEY_PRESS_MASK
152                             | GDK_KEY_RELEASE_MASK
153                             | GDK_BUTTON_MOTION_MASK
154                             | GDK_BUTTON1_MOTION_MASK
155                             | GDK_BUTTON2_MOTION_MASK
156                             | GDK_BUTTON3_MOTION_MASK;
157
158     gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
159     widget->window = gdk_window_new(gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
160     gdk_window_set_user_data(widget->window, widget);
161 }
162
163 static void webkit_page_map(GtkWidget* widget)
164 {
165     GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED);
166     WebKitPagePrivate* private_data = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(widget));
167
168     HashSet<GtkWidget*>::const_iterator end = private_data->children.end();
169     for (HashSet<GtkWidget*>::const_iterator current = private_data->children.begin(); current != end; ++current)
170         if (GTK_WIDGET_VISIBLE(*current) && !GTK_WIDGET_MAPPED(*current))
171             gtk_widget_map((*current));
172
173     gdk_window_show(widget->window);
174 }
175
176 static void webkit_page_set_scroll_adjustments(WebKitPage* page, GtkAdjustment* hadj, GtkAdjustment* vadj)
177 {
178     FrameView* view = core(getFrameFromPage(page))->view();
179     view->setGtkAdjustments(hadj, vadj);
180 }
181
182 static void webkit_page_container_add(GtkContainer* container, GtkWidget* widget)
183 {
184     WebKitPage* page = WEBKIT_PAGE(container);
185     WebKitPagePrivate* private_data = WEBKIT_PAGE_GET_PRIVATE(page);
186
187     private_data->children.add(widget);
188     if (GTK_WIDGET_REALIZED(container))
189         gtk_widget_set_parent_window(widget, GTK_WIDGET(page)->window);
190     gtk_widget_set_parent(widget, GTK_WIDGET(container));
191 }
192
193 static void webkit_page_container_remove(GtkContainer* container, GtkWidget* widget)
194 {
195     WebKitPagePrivate* private_data = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(container));
196
197     if (private_data->children.contains(widget)) {
198         gtk_widget_unparent(widget);
199         private_data->children.remove(widget);
200     }
201 }
202
203 static void webkit_page_container_forall(GtkContainer* container, gboolean, GtkCallback callback, gpointer callbackData)
204 {
205     WebKitPagePrivate* privateData = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(container));
206
207     HashSet<GtkWidget*> children = privateData->children;
208     HashSet<GtkWidget*>::const_iterator end = children.end();
209     for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current)
210         (*callback)(*current, callbackData);
211 }
212
213 static WebKitPage* webkit_page_real_create_page(WebKitPage*)
214 {
215     notImplemented();
216     return 0;
217 }
218
219 static WEBKIT_NAVIGATION_REQUEST_RESPONSE webkit_page_real_navigation_requested(WebKitPage*, WebKitFrame* frame, WebKitNetworkRequest*)
220 {
221     notImplemented();
222     return WEBKIT_ACCEPT_NAVIGATION_REQUEST;
223 }
224
225 static gchar* webkit_page_real_choose_file(WebKitPage*, WebKitFrame*, const gchar* old_name)
226 {
227     notImplemented();
228     return g_strdup(old_name);
229 }
230
231 static void webkit_page_real_java_script_alert(WebKitPage*, WebKitFrame*, const gchar*)
232 {
233     notImplemented();
234 }
235
236 static gboolean webkit_page_real_java_script_confirm(WebKitPage*, WebKitFrame*, const gchar*)
237 {
238     notImplemented();
239     return FALSE;
240 }
241
242 /**
243  * WebKitPage::java_script_prompt
244  *
245  * @return: NULL to cancel the prompt
246  */
247 static gchar* webkit_page_real_java_script_prompt(WebKitPage*, WebKitFrame*, const gchar*, const gchar* defaultValue)
248 {
249     notImplemented();
250     return g_strdup(defaultValue);
251 }
252
253 static void webkit_page_real_java_script_console_message(WebKitPage*, const gchar*, unsigned int, const gchar*)
254 {
255     notImplemented();
256 }
257
258 static void webkit_page_finalize(GObject* object)
259 {
260     webkit_page_stop_loading(WEBKIT_PAGE(object));
261
262     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(object));
263     delete pageData->page;
264     delete pageData->settings;
265     g_object_unref(pageData->mainFrame);
266     delete pageData->userAgent;
267
268     G_OBJECT_CLASS(webkit_page_parent_class)->finalize(object);
269 }
270
271 static void webkit_page_class_init(WebKitPageClass* pageClass)
272 {
273     g_type_class_add_private(pageClass, sizeof(WebKitPagePrivate));
274
275
276     /*
277      * signals
278      */
279     /**
280      * WebKitPage::load-started
281      * @page: the object on which the signal is emitted
282      * @frame: the frame going to do the load
283      *
284      * When a WebKitFrame begins to load this signal is emitted.
285      */
286     webkit_page_signals[LOAD_STARTED] = g_signal_new("load_started",
287             G_TYPE_FROM_CLASS(pageClass),
288             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
289             0,
290             NULL,
291             NULL,
292             g_cclosure_marshal_VOID__OBJECT,
293             G_TYPE_NONE, 1,
294             WEBKIT_TYPE_FRAME);
295
296     /**
297      * WebKitPage::load-progress-changed
298      * @page: The WebKitPage
299      * @progress: Global progress
300      */
301     webkit_page_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load_progress_changed",
302             G_TYPE_FROM_CLASS(pageClass),
303             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
304             0,
305             NULL,
306             NULL,
307             g_cclosure_marshal_VOID__INT,
308             G_TYPE_NONE, 1,
309             G_TYPE_INT);
310     
311     webkit_page_signals[LOAD_FINISHED] = g_signal_new("load_finished",
312             G_TYPE_FROM_CLASS(pageClass),
313             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
314             0,
315             NULL,
316             NULL,
317             g_cclosure_marshal_VOID__OBJECT,
318             G_TYPE_NONE, 1,
319             WEBKIT_TYPE_FRAME);
320
321     webkit_page_signals[TITLE_CHANGED] = g_signal_new("title_changed",
322             G_TYPE_FROM_CLASS(pageClass),
323             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
324             0,
325             NULL,
326             NULL,
327             webkit_marshal_VOID__STRING_STRING,
328             G_TYPE_NONE, 2,
329             G_TYPE_STRING, G_TYPE_STRING);
330
331     webkit_page_signals[HOVERING_OVER_LINK] = g_signal_new("hovering_over_link",
332             G_TYPE_FROM_CLASS(pageClass),
333             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
334             0,
335             NULL,
336             NULL,
337             webkit_marshal_VOID__STRING_STRING,
338             G_TYPE_NONE, 2,
339             G_TYPE_STRING,
340             G_TYPE_STRING);
341
342     webkit_page_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status_bar_text_changed",
343             G_TYPE_FROM_CLASS(pageClass),
344             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
345             0,
346             NULL,
347             NULL,
348             g_cclosure_marshal_VOID__STRING,
349             G_TYPE_NONE, 1,
350             G_TYPE_STRING);
351
352     webkit_page_signals[ICOND_LOADED] = g_signal_new("icon_loaded",
353             G_TYPE_FROM_CLASS(pageClass),
354             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
355             0,
356             NULL,
357             NULL,
358             g_cclosure_marshal_VOID__VOID,
359             G_TYPE_NONE, 0);
360
361     webkit_page_signals[SELECTION_CHANGED] = g_signal_new("selection_changed",
362             G_TYPE_FROM_CLASS(pageClass),
363             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
364             0,
365             NULL,
366             NULL,
367             g_cclosure_marshal_VOID__VOID,
368             G_TYPE_NONE, 0);
369
370
371     /*
372      * implementations of virtual methods
373      */
374     pageClass->create_page = webkit_page_real_create_page;
375     pageClass->navigation_requested = webkit_page_real_navigation_requested;
376     pageClass->choose_file = webkit_page_real_choose_file;
377     pageClass->java_script_alert = webkit_page_real_java_script_alert;
378     pageClass->java_script_confirm = webkit_page_real_java_script_confirm;
379     pageClass->java_script_prompt = webkit_page_real_java_script_prompt;
380     pageClass->java_script_console_message = webkit_page_real_java_script_console_message;
381
382     G_OBJECT_CLASS(pageClass)->finalize = webkit_page_finalize;
383
384     GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(pageClass);
385     widgetClass->realize = webkit_page_realize;
386     widgetClass->map = webkit_page_map;
387     widgetClass->expose_event = webkit_page_expose_event;
388     widgetClass->key_press_event = webkit_page_key_event;
389     widgetClass->key_release_event = webkit_page_key_event;
390     widgetClass->button_press_event = webkit_page_button_event;
391     widgetClass->button_release_event = webkit_page_button_event;
392     widgetClass->motion_notify_event = webkit_page_motion_event;
393     widgetClass->scroll_event = webkit_page_scroll_event;
394     widgetClass->size_allocate = webkit_page_size_allocate;
395
396     GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(pageClass);
397     containerClass->add = webkit_page_container_add;
398     containerClass->remove = webkit_page_container_remove;
399     containerClass->forall = webkit_page_container_forall;
400
401     /*
402      * make us scrollable (e.g. addable to a GtkScrolledWindow)
403      */
404     pageClass->set_scroll_adjustments = webkit_page_set_scroll_adjustments;
405     GTK_WIDGET_CLASS(pageClass)->set_scroll_adjustments_signal = g_signal_new("set_scroll_adjustments",
406             G_TYPE_FROM_CLASS(pageClass),
407             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
408             G_STRUCT_OFFSET(WebKitPageClass, set_scroll_adjustments),
409             NULL, NULL,
410             webkit_marshal_VOID__OBJECT_OBJECT,
411             G_TYPE_NONE, 2,
412             GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
413 }
414
415 static void webkit_page_init(WebKitPage* page)
416 {
417     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(WEBKIT_PAGE(page));
418     pageData->page = new Page(new WebKit::ChromeClient(page), new WebKit::ContextMenuClient, new WebKit::EditorClient(page), new WebKit::DragClient, new WebKit::InspectorClient);
419
420     Settings* settings = pageData->page->settings();
421     settings->setLoadsImagesAutomatically(true);
422     settings->setMinimumFontSize(5);
423     settings->setMinimumLogicalFontSize(5);
424     settings->setShouldPrintBackgrounds(true);
425     settings->setJavaScriptEnabled(true);
426     settings->setDefaultFixedFontSize(14);
427     settings->setDefaultFontSize(14);
428     settings->setSerifFontFamily("Times New Roman");
429     settings->setSansSerifFontFamily("Arial");
430     settings->setFixedFontFamily("Courier");
431     settings->setStandardFontFamily("Arial");
432
433     GTK_WIDGET_SET_FLAGS(page, GTK_CAN_FOCUS);
434     pageData->mainFrame = WEBKIT_FRAME(webkit_frame_new(page));
435 }
436
437 GtkWidget* webkit_page_new(void)
438 {
439     WebKitPage* page = WEBKIT_PAGE(g_object_new(WEBKIT_TYPE_PAGE, NULL));
440
441     return GTK_WIDGET(page);
442 }
443
444 void webkit_page_set_settings(WebKitPage* page, WebKitSettings* settings)
445 {
446     notImplemented();
447 }
448
449 WebKitSettings* webkit_page_get_settings(WebKitPage* page)
450 {
451     notImplemented();
452     return 0;
453 }
454
455 void webkit_page_go_backward(WebKitPage* page)
456 {
457     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
458     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
459     frameData->frame->loader()->goBackOrForward(-1);
460 }
461
462 void webkit_page_go_forward(WebKitPage* page)
463 {
464     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
465     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
466     frameData->frame->loader()->goBackOrForward(1);
467 }
468
469 gboolean webkit_page_can_go_backward(WebKitPage* page)
470 {
471     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
472     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
473     return frameData->frame->loader()->canGoBackOrForward(-1);
474 }
475
476 gboolean webkit_page_can_go_forward(WebKitPage* page)
477 {
478     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
479     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
480     return frameData->frame->loader()->canGoBackOrForward(1);
481 }
482
483 void webkit_page_open(WebKitPage* page, const gchar* url)
484 {
485     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
486     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
487
488     DeprecatedString string = DeprecatedString::fromUtf8(url);
489     frameData->frame->loader()->load(ResourceRequest(KURL(string)));
490 }
491
492 void webkit_page_reload(WebKitPage* page)
493 {
494     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
495     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
496     frameData->frame->loader()->reload();
497 }
498
499 void webkit_page_load_string(WebKitPage* page, const gchar* content, const gchar* contentMimeType, const gchar* contentEncoding, const gchar* baseUrl)
500 {
501     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
502     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
503     
504     KURL url(DeprecatedString::fromUtf8(baseUrl));
505     RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(strdup(content), strlen(content));    
506     SubstituteData substituteData(sharedBuffer.release(), String(contentMimeType), String(contentEncoding), KURL("about:blank"), url);
507
508     frameData->frame->loader()->load(ResourceRequest(url), substituteData);
509 }
510
511 void webkit_page_load_html_string(WebKitPage* page, const gchar* content, const gchar* baseUrl)
512 {
513     webkit_page_load_string(page, content, "text/html", "UTF-8", baseUrl);
514 }
515
516 void webkit_page_stop_loading(WebKitPage* page)
517 {
518     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
519     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
520     
521     if (FrameLoader* loader = frameData->frame->loader())
522         loader->stopAllLoaders();
523         
524 }
525
526 WebKitFrame* webkit_page_get_main_frame(WebKitPage* page)
527 {
528     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
529     return pageData->mainFrame;
530 }
531
532 void webkit_page_execute_script(WebKitPage* page, const gchar* script)
533 {
534     WebKitPagePrivate* pageData = WEBKIT_PAGE_GET_PRIVATE(page);
535     WebKitFramePrivate* frameData = WEBKIT_FRAME_GET_PRIVATE(pageData->mainFrame);
536
537     if (FrameLoader* loader = frameData->frame->loader())
538         loader->executeScript(String::fromUTF8(script), true);
539 }
540 }