Move DomainRelaxationForbidden scheme registry to SchemeRegistry
[WebKit-https.git] / Source / WebKit / qt / WebCoreSupport / DumpRenderTreeSupportQt.cpp
1 /*
2     Copyright (C) 2010 Robert Hogan <robert@roberthogan.net>
3     Copyright (C) 2008,2009,2010 Nokia Corporation and/or its subsidiary(-ies)
4     Copyright (C) 2007 Staikos Computing Services Inc.
5     Copyright (C) 2007 Apple Inc.
6
7     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Library General Public
9     License as published by the Free Software Foundation; either
10     version 2 of the License, or (at your option) any later version.
11
12     This library is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15     Library General Public License for more details.
16
17     You should have received a copy of the GNU Library General Public License
18     along with this library; see the file COPYING.LIB.  If not, write to
19     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20     Boston, MA 02110-1301, USA.
21 */
22
23 #include "config.h"
24 #include "DumpRenderTreeSupportQt.h"
25
26 #if USE(JSC)
27 #include "APICast.h"
28 #endif
29 #include "ApplicationCacheStorage.h"
30 #include "CSSComputedStyleDeclaration.h"
31 #include "ChromeClientQt.h"
32 #include "ContainerNode.h"
33 #include "ContextMenu.h"
34 #include "ContextMenuClientQt.h"
35 #include "ContextMenuController.h"
36 #include "DeviceOrientation.h"
37 #include "DeviceOrientationClientMockQt.h"
38 #include "DocumentLoader.h"
39 #include "Editor.h"
40 #include "EditorClientQt.h"
41 #include "Element.h"
42 #include "FocusController.h"
43 #include "Frame.h"
44 #include "FrameLoaderClientQt.h"
45 #include "FrameView.h"
46 #if USE(JSC)
47 #include "GCController.h"
48 #elif USE(V8)
49 #include "V8GCController.h"
50 #include "V8Proxy.h"
51 #endif
52 #include "GeolocationClient.h"
53 #include "GeolocationClientMock.h"
54 #include "GeolocationController.h"
55 #include "GeolocationError.h"
56 #include "GeolocationPosition.h"
57 #include "HistoryItem.h"
58 #include "HTMLInputElement.h"
59 #include "InspectorController.h"
60 #include "NodeList.h"
61 #include "NotificationPresenterClientQt.h"
62 #include "Page.h"
63 #include "PageGroup.h"
64 #include "PluginDatabase.h"
65 #include "PositionError.h"
66 #include "PrintContext.h"
67 #include "RenderListItem.h"
68 #include "RenderTreeAsText.h"
69 #include "SchemeRegistry.h"
70 #include "ScriptController.h"
71 #include "ScriptSourceCode.h"
72 #include "ScriptValue.h"
73 #include "SecurityOrigin.h"
74 #include "Settings.h"
75 #if ENABLE(SVG)
76 #include "SVGDocumentExtensions.h"
77 #include "SVGSMILElement.h"
78 #endif
79 #include "TextIterator.h"
80 #include "ThirdPartyCookiesQt.h"
81 #include "WebCoreTestSupport.h"
82 #include "WorkerThread.h"
83 #include <wtf/CurrentTime.h>
84
85 #include "qwebelement.h"
86 #include "qwebframe.h"
87 #include "qwebframe_p.h"
88 #include "qwebhistory.h"
89 #include "qwebhistory_p.h"
90 #include "qwebpage.h"
91 #include "qwebpage_p.h"
92 #include "qwebscriptworld.h"
93
94 #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
95 #include "HTMLVideoElement.h"
96 #include "MediaPlayerPrivateQt.h"
97 #endif
98
99 using namespace WebCore;
100
101 QMap<int, QWebScriptWorld*> m_worldMap;
102
103 #if ENABLE(CLIENT_BASED_GEOLOCATION)
104 GeolocationClientMock* toGeolocationClientMock(GeolocationClient* client)
105 {
106      ASSERT(QWebPagePrivate::drtRun);
107      return static_cast<GeolocationClientMock*>(client);
108 }
109 #endif
110
111 QDRTNode::QDRTNode()
112     : m_node(0)
113 {
114 }
115
116 QDRTNode::QDRTNode(WebCore::Node* node)
117     : m_node(0)
118 {
119     if (node) {
120         m_node = node;
121         m_node->ref();
122     }
123 }
124
125 QDRTNode::~QDRTNode()
126 {
127     if (m_node)
128         m_node->deref();
129 }
130
131 QDRTNode::QDRTNode(const QDRTNode& other)
132     :m_node(other.m_node)
133 {
134     if (m_node)
135         m_node->ref();
136 }
137
138 QDRTNode& QDRTNode::operator=(const QDRTNode& other)
139 {
140     if (this != &other) {
141         Node* otherNode = other.m_node;
142         if (otherNode)
143             otherNode->ref();
144         if (m_node)
145             m_node->deref();
146         m_node = otherNode;
147     }
148     return *this;
149 }
150
151
152 DumpRenderTreeSupportQt::DumpRenderTreeSupportQt()
153 {
154 }
155
156 DumpRenderTreeSupportQt::~DumpRenderTreeSupportQt()
157 {
158 }
159
160 void DumpRenderTreeSupportQt::overwritePluginDirectories()
161 {
162     PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false);
163
164     Vector<String> paths;
165     String qtPath(qgetenv("QTWEBKIT_PLUGIN_PATH").data());
166     qtPath.split(UChar(':'), /* allowEmptyEntries */ false, paths);
167
168     db->setPluginDirectories(paths);
169     db->refresh();
170 }
171
172 int DumpRenderTreeSupportQt::workerThreadCount()
173 {
174 #if ENABLE(WORKERS)
175     return WebCore::WorkerThread::workerThreadCount();
176 #else
177     return 0;
178 #endif
179 }
180
181 void DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(bool b)
182 {
183     QWebPagePrivate::drtRun = b;
184 }
185
186 void DumpRenderTreeSupportQt::setFrameFlatteningEnabled(QWebPage* page, bool enabled)
187 {
188     QWebPagePrivate::core(page)->settings()->setFrameFlatteningEnabled(enabled);
189 }
190
191 void DumpRenderTreeSupportQt::webPageSetGroupName(QWebPage* page, const QString& groupName)
192 {
193     page->handle()->page->setGroupName(groupName);
194 }
195
196 QString DumpRenderTreeSupportQt::webPageGroupName(QWebPage* page)
197 {
198     return page->handle()->page->groupName();
199 }
200
201 void DumpRenderTreeSupportQt::webInspectorExecuteScript(QWebPage* page, long callId, const QString& script)
202 {
203 #if ENABLE(INSPECTOR)
204     if (!page->handle()->page->inspectorController())
205         return;
206     page->handle()->page->inspectorController()->evaluateForTestInFrontend(callId, script);
207 #endif
208 }
209
210 void DumpRenderTreeSupportQt::webInspectorClose(QWebPage* page)
211 {
212 #if ENABLE(INSPECTOR)
213     if (!page->handle()->page->inspectorController())
214         return;
215     page->handle()->page->inspectorController()->close();
216 #endif
217 }
218
219 void DumpRenderTreeSupportQt::webInspectorShow(QWebPage* page)
220 {
221 #if ENABLE(INSPECTOR)
222     if (!page->handle()->page->inspectorController())
223         return;
224     page->handle()->page->inspectorController()->show();
225 #endif
226 }
227
228 bool DumpRenderTreeSupportQt::hasDocumentElement(QWebFrame* frame)
229 {
230     return QWebFramePrivate::core(frame)->document()->documentElement();
231 }
232
233 void DumpRenderTreeSupportQt::setAutofilled(const QWebElement& element, bool isAutofilled)
234 {
235     WebCore::Element* webElement = element.m_element;
236     if (!webElement)
237         return;
238     HTMLInputElement* inputElement = webElement->toInputElement();
239     if (!inputElement)
240         return;
241
242     inputElement->setAutofilled(isAutofilled);
243 }
244
245 void DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled)
246 {
247 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
248     Frame* coreFrame = QWebFramePrivate::core(frame);
249     InspectorController* controller = coreFrame->page()->inspectorController();
250     if (!controller)
251         return;
252     if (enabled)
253         controller->enableProfiler();
254     else
255         controller->disableProfiler();
256 #endif
257 }
258
259 void DumpRenderTreeSupportQt::setValueForUser(const QWebElement& element, const QString& value)
260 {
261     WebCore::Element* webElement = element.m_element;
262     if (!webElement)
263         return;
264     HTMLInputElement* inputElement = webElement->toInputElement();
265     if (!inputElement)
266         return;
267
268     inputElement->setValueForUser(value);
269 }
270
271 // Pause a given CSS animation or transition on the target node at a specific time.
272 // If the animation or transition is already paused, it will update its pause time.
273 // This method is only intended to be used for testing the CSS animation and transition system.
274 bool DumpRenderTreeSupportQt::pauseAnimation(QWebFrame *frame, const QString &animationName, double time, const QString &elementId)
275 {
276     Frame* coreFrame = QWebFramePrivate::core(frame);
277     if (!coreFrame)
278         return false;
279
280     AnimationController* controller = coreFrame->animation();
281     if (!controller)
282         return false;
283
284     Document* doc = coreFrame->document();
285     Q_ASSERT(doc);
286
287     Node* coreNode = doc->getElementById(elementId);
288     if (!coreNode || !coreNode->renderer())
289         return false;
290
291     return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
292 }
293
294 bool DumpRenderTreeSupportQt::pauseTransitionOfProperty(QWebFrame *frame, const QString &propertyName, double time, const QString &elementId)
295 {
296     Frame* coreFrame = QWebFramePrivate::core(frame);
297     if (!coreFrame)
298         return false;
299
300     AnimationController* controller = coreFrame->animation();
301     if (!controller)
302         return false;
303
304     Document* doc = coreFrame->document();
305     Q_ASSERT(doc);
306
307     Node* coreNode = doc->getElementById(elementId);
308     if (!coreNode || !coreNode->renderer())
309         return false;
310
311     return controller->pauseTransitionAtTime(coreNode->renderer(), propertyName, time);
312 }
313
314 // Pause a given SVG animation on the target node at a specific time.
315 // This method is only intended to be used for testing the SVG animation system.
316 bool DumpRenderTreeSupportQt::pauseSVGAnimation(QWebFrame *frame, const QString &animationId, double time, const QString &elementId)
317 {
318 #if !ENABLE(SVG)
319     return false;
320 #else
321     Frame* coreFrame = QWebFramePrivate::core(frame);
322     if (!coreFrame)
323         return false;
324
325     Document* doc = coreFrame->document();
326     Q_ASSERT(doc);
327
328     if (!doc->svgExtensions())
329         return false;
330
331     Node* coreNode = doc->getElementById(animationId);
332     if (!coreNode || !SVGSMILElement::isSMILElement(coreNode))
333         return false;
334
335     return doc->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time);
336 #endif
337 }
338
339 // Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
340 int DumpRenderTreeSupportQt::numberOfActiveAnimations(QWebFrame *frame)
341 {
342     Frame* coreFrame = QWebFramePrivate::core(frame);
343     if (!coreFrame)
344         return false;
345
346     AnimationController* controller = coreFrame->animation();
347     if (!controller)
348         return false;
349
350     return controller->numberOfActiveAnimations(coreFrame->document());
351 }
352
353 void DumpRenderTreeSupportQt::suspendAnimations(QWebFrame *frame)
354 {
355     Frame* coreFrame = QWebFramePrivate::core(frame);
356     if (!coreFrame)
357         return;
358
359     AnimationController* controller = coreFrame->animation();
360     if (!controller)
361         return;
362
363     controller->suspendAnimations();
364 }
365
366 void DumpRenderTreeSupportQt::resumeAnimations(QWebFrame *frame)
367 {
368     Frame* coreFrame = QWebFramePrivate::core(frame);
369     if (!coreFrame)
370         return;
371
372     AnimationController* controller = coreFrame->animation();
373     if (!controller)
374         return;
375
376     controller->resumeAnimations();
377 }
378
379 void DumpRenderTreeSupportQt::clearFrameName(QWebFrame* frame)
380 {
381     Frame* coreFrame = QWebFramePrivate::core(frame);
382     coreFrame->tree()->clearName();
383 }
384
385 int DumpRenderTreeSupportQt::javaScriptObjectsCount()
386 {
387 #if USE(JSC)
388     return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount();
389 #elif USE(V8)
390     // FIXME: Find a way to do this using V8.
391     return 1;
392 #endif
393 }
394
395 void DumpRenderTreeSupportQt::garbageCollectorCollect()
396 {
397 #if USE(JSC)
398     gcController().garbageCollectNow();
399 #elif USE(V8)
400     v8::V8::LowMemoryNotification();
401 #endif
402 }
403
404 void DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(bool waitUntilDone)
405 {
406 #if USE(JSC)
407     gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone);
408 #elif USE(V8)
409     // FIXME: Find a way to do this using V8.
410     garbageCollectorCollect();
411 #endif
412 }
413
414 // Returns the value of counter in the element specified by \a id.
415 QString DumpRenderTreeSupportQt::counterValueForElementById(QWebFrame* frame, const QString& id)
416 {
417     Frame* coreFrame = QWebFramePrivate::core(frame);
418     if (Document* document = coreFrame->document()) {
419         if (Element* element = document->getElementById(id))
420             return WebCore::counterValueForElement(element);
421     }
422     return QString();
423 }
424
425 int DumpRenderTreeSupportQt::pageNumberForElementById(QWebFrame* frame, const QString& id, float width, float height)
426 {
427     Frame* coreFrame = QWebFramePrivate::core(frame);
428     if (!coreFrame)
429         return -1;
430
431     Element* element = coreFrame->document()->getElementById(AtomicString(id));
432     if (!element)
433         return -1;
434
435     return PrintContext::pageNumberForElement(element, FloatSize(width, height));
436 }
437
438 int DumpRenderTreeSupportQt::numberOfPages(QWebFrame* frame, float width, float height)
439 {
440     Frame* coreFrame = QWebFramePrivate::core(frame);
441     if (!coreFrame)
442         return -1;
443
444     return PrintContext::numberOfPages(coreFrame, FloatSize(width, height));
445 }
446
447 // Suspend active DOM objects in this frame.
448 void DumpRenderTreeSupportQt::suspendActiveDOMObjects(QWebFrame* frame)
449 {
450     Frame* coreFrame = QWebFramePrivate::core(frame);
451     if (coreFrame->document())
452         // FIXME: This function should be changed take a ReasonForSuspension parameter 
453         // https://bugs.webkit.org/show_bug.cgi?id=45732
454         coreFrame->document()->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
455 }
456
457 // Resume active DOM objects in this frame.
458 void DumpRenderTreeSupportQt::resumeActiveDOMObjects(QWebFrame* frame)
459 {
460     Frame* coreFrame = QWebFramePrivate::core(frame);
461     if (coreFrame->document())
462         coreFrame->document()->resumeActiveDOMObjects();
463 }
464
465 void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
466 {
467     SecurityOrigin::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
468 }
469
470 void DumpRenderTreeSupportQt::removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
471 {
472     SecurityOrigin::removeOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
473 }
474
475 void DumpRenderTreeSupportQt::resetOriginAccessWhiteLists()
476 {
477     SecurityOrigin::resetOriginAccessWhitelists();
478 }
479
480 void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme)
481 {
482     SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
483 }
484
485 void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value)
486 {
487     page->handle()->page->settings()->setCaretBrowsingEnabled(value);
488 }
489
490 void DumpRenderTreeSupportQt::setAuthorAndUserStylesEnabled(QWebPage* page, bool value)
491 {
492     page->handle()->page->settings()->setAuthorAndUserStylesEnabled(value);
493 }
494
495 void DumpRenderTreeSupportQt::setMediaType(QWebFrame* frame, const QString& type)
496 {
497     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
498     WebCore::FrameView* view = coreFrame->view();
499     view->setMediaType(type);
500     coreFrame->document()->styleSelectorChanged(RecalcStyleImmediately);
501     view->layout();
502 }
503
504 void DumpRenderTreeSupportQt::setSmartInsertDeleteEnabled(QWebPage* page, bool enabled)
505 {
506     page->d->smartInsertDeleteEnabled = enabled;
507 }
508
509
510 void DumpRenderTreeSupportQt::setSelectTrailingWhitespaceEnabled(QWebPage* page, bool enabled)
511 {
512     page->d->selectTrailingWhitespaceEnabled = enabled;
513 }
514
515
516 void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPage* page, const QString& name, const QString& value)
517 {
518     page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
519 }
520
521 bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPage* page, const QString& name)
522 {
523     return page->handle()->page->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
524 }
525
526 bool DumpRenderTreeSupportQt::findString(QWebPage* page, const QString& string, const QStringList& optionArray)
527 {
528     // 1. Parse the options from the array
529     WebCore::FindOptions options = 0;
530     const int optionCount = optionArray.size();
531     for (int i = 0; i < optionCount; ++i) {
532         const QString& option = optionArray.at(i);
533         if (option == QLatin1String("CaseInsensitive"))
534             options |= WebCore::CaseInsensitive;
535         else if (option == QLatin1String("AtWordStarts"))
536             options |= WebCore::AtWordStarts;
537         else if (option == QLatin1String("TreatMedialCapitalAsWordStart"))
538             options |= WebCore::TreatMedialCapitalAsWordStart;
539         else if (option == QLatin1String("Backwards"))
540             options |= WebCore::Backwards;
541         else if (option == QLatin1String("WrapAround"))
542             options |= WebCore::WrapAround;
543         else if (option == QLatin1String("StartInSelection"))
544             options |= WebCore::StartInSelection;
545     }
546
547     // 2. find the string
548     WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
549     return frame && frame->editor()->findString(string, options);
550 }
551
552 QString DumpRenderTreeSupportQt::markerTextForListItem(const QWebElement& listItem)
553 {
554     return WebCore::markerTextForListItem(listItem.m_element);
555 }
556
557 static QString convertToPropertyName(const QString& name)
558 {
559     QStringList parts = name.split(QLatin1Char('-'));
560     QString camelCaseName;
561     for (int j = 0; j < parts.count(); ++j) {
562         QString part = parts.at(j);
563         if (j)
564             camelCaseName.append(part.replace(0, 1, part.left(1).toUpper()));
565         else
566             camelCaseName.append(part);
567     }
568     return camelCaseName;
569 }
570
571 QVariantMap DumpRenderTreeSupportQt::computedStyleIncludingVisitedInfo(const QWebElement& element)
572 {
573     QVariantMap res;
574
575     WebCore::Element* webElement = element.m_element;
576     if (!webElement)
577         return res;
578
579     RefPtr<WebCore::CSSComputedStyleDeclaration> style = computedStyle(webElement, true);
580     for (unsigned i = 0; i < style->length(); i++) {
581         QString name = style->item(i);
582         QString value = (static_cast<WebCore::CSSStyleDeclaration*>(style.get()))->getPropertyValue(name);
583         res[convertToPropertyName(name)] = QVariant(value);
584     }
585     return res;
586 }
587
588 QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPage* page)
589 {
590     WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
591     QVariantList selectedRange;
592     RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
593
594     Element* selectionRoot = frame->selection()->rootEditableElement();
595     Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
596
597     RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
598     ASSERT(testRange->startContainer() == scope);
599     int startPosition = TextIterator::rangeLength(testRange.get());
600
601     ExceptionCode ec;
602     testRange->setEnd(range->endContainer(), range->endOffset(), ec);
603     ASSERT(testRange->startContainer() == scope);
604     int endPosition = TextIterator::rangeLength(testRange.get());
605
606     selectedRange << startPosition << (endPosition - startPosition);
607
608     return selectedRange;
609
610 }
611
612 QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page, int location, int length)
613 {
614     WebCore::Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
615     QVariantList rect;
616
617     if ((location + length < location) && (location + length))
618         length = 0;
619
620     RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
621
622     if (!range)
623         return QVariantList();
624
625     QRect resultRect = frame->editor()->firstRectForRange(range.get());
626     rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height();
627     return rect;
628 }
629
630 bool DumpRenderTreeSupportQt::elementDoesAutoCompleteForElementWithId(QWebFrame* frame, const QString& elementId)
631 {
632     Frame* coreFrame = QWebFramePrivate::core(frame);
633     if (!coreFrame)
634         return false;
635
636     Document* doc = coreFrame->document();
637     Q_ASSERT(doc);
638
639     Node* coreNode = doc->getElementById(elementId);
640     if (!coreNode || !coreNode->renderer())
641         return false;
642
643     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(coreNode);
644
645     return inputElement->isTextField() && !inputElement->isPasswordField() && inputElement->shouldAutocomplete();
646 }
647
648 void DumpRenderTreeSupportQt::setEditingBehavior(QWebPage* page, const QString& editingBehavior)
649 {
650     WebCore::EditingBehaviorType coreEditingBehavior;
651
652     if (editingBehavior == QLatin1String("win"))
653         coreEditingBehavior = EditingWindowsBehavior;
654     else if (editingBehavior == QLatin1String("mac"))
655         coreEditingBehavior = EditingMacBehavior;
656     else if (editingBehavior == QLatin1String("unix"))
657         coreEditingBehavior = EditingUnixBehavior;
658     else {
659         ASSERT_NOT_REACHED();
660         return;
661     }
662
663     Page* corePage = QWebPagePrivate::core(page);
664     if (!corePage)
665         return;
666
667     corePage->settings()->setEditingBehaviorType(coreEditingBehavior);
668 }
669
670 void DumpRenderTreeSupportQt::clearAllApplicationCaches()
671 {
672     WebCore::cacheStorage().empty();
673     WebCore::cacheStorage().vacuumDatabaseFile();
674 }
675
676 void DumpRenderTreeSupportQt::dumpFrameLoader(bool b)
677 {
678     FrameLoaderClientQt::dumpFrameLoaderCallbacks = b;
679 }
680
681 void DumpRenderTreeSupportQt::dumpProgressFinishedCallback(bool b)
682 {
683     FrameLoaderClientQt::dumpProgressFinishedCallback = b;
684 }
685
686 void DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(bool b)
687 {
688     FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = b;
689 }
690
691 void DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(bool b)
692 {
693     FrameLoaderClientQt::dumpResourceLoadCallbacks = b;
694 }
695
696 void DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(const QString& path)
697 {
698     FrameLoaderClientQt::dumpResourceLoadCallbacksPath = path;
699 }
700
701 void DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(bool b)
702 {
703     FrameLoaderClientQt::dumpResourceResponseMIMETypes = b;
704 }
705
706 void DumpRenderTreeSupportQt::setWillSendRequestReturnsNullOnRedirect(bool b)
707 {
708     FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = b;
709 }
710
711 void DumpRenderTreeSupportQt::setWillSendRequestReturnsNull(bool b)
712 {
713     FrameLoaderClientQt::sendRequestReturnsNull = b;
714 }
715
716 void DumpRenderTreeSupportQt::setWillSendRequestClearHeaders(const QStringList& headers)
717 {
718     FrameLoaderClientQt::sendRequestClearHeaders = headers;
719 }
720
721 void DumpRenderTreeSupportQt::setDeferMainResourceDataLoad(bool b)
722 {
723     FrameLoaderClientQt::deferMainResourceDataLoad = b;
724 }
725
726 void DumpRenderTreeSupportQt::setCustomPolicyDelegate(bool enabled, bool permissive)
727 {
728     FrameLoaderClientQt::policyDelegateEnabled = enabled;
729     FrameLoaderClientQt::policyDelegatePermissive = permissive;
730 }
731
732 void DumpRenderTreeSupportQt::dumpHistoryCallbacks(bool b)
733 {
734     FrameLoaderClientQt::dumpHistoryCallbacks = b;
735 }
736
737 void DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(bool b)
738 {
739     ChromeClientQt::dumpVisitedLinksCallbacks = b;
740 }
741
742 void DumpRenderTreeSupportQt::dumpEditingCallbacks(bool b)
743 {
744     EditorClientQt::dumpEditingCallbacks = b;
745 }
746
747 void DumpRenderTreeSupportQt::dumpSetAcceptsEditing(bool b)
748 {
749     EditorClientQt::acceptsEditing = b;
750 }
751
752 void DumpRenderTreeSupportQt::dumpNotification(bool b)
753 {
754 #if ENABLE(NOTIFICATIONS)
755     NotificationPresenterClientQt::dumpNotification = b;
756 #endif
757 }
758
759 QString DumpRenderTreeSupportQt::viewportAsText(QWebPage* page, int deviceDPI, const QSize& deviceSize, const QSize& availableSize)
760 {
761     WebCore::ViewportArguments args = page->d->viewportArguments();
762
763     WebCore::ViewportAttributes conf = WebCore::computeViewportAttributes(args,
764         /* desktop-width */ 980,
765         /* device-width  */ deviceSize.width(),
766         /* device-height */ deviceSize.height(),
767         /* device-dpi    */ deviceDPI,
768         availableSize);
769     WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
770     WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
771
772     QString res;
773     res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
774             conf.layoutSize.width(),
775             conf.layoutSize.height(),
776             conf.initialScale,
777             conf.minimumScale,
778             conf.maximumScale,
779             conf.userScalable);
780
781     return res;
782 }
783
784 void DumpRenderTreeSupportQt::scalePageBy(QWebFrame* frame, float scalefactor, const QPoint& origin)
785 {
786     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
787     if (Page* page = coreFrame->page())
788         page->setPageScaleFactor(scalefactor, origin);
789 }
790
791 void DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(bool b)
792 {
793 #if ENABLE(DEVICE_ORIENTATION)
794     DeviceOrientationClientMockQt::mockIsActive = b;
795 #endif
796 }
797
798 void DumpRenderTreeSupportQt::removeMockDeviceOrientation()
799 {
800 #if ENABLE(DEVICE_ORIENTATION)
801     DeviceOrientationClientMockQt* client = DeviceOrientationClientMockQt::client();
802     delete client;
803 #endif
804 }
805
806 void DumpRenderTreeSupportQt::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
807 {
808 #if ENABLE(DEVICE_ORIENTATION)
809     DeviceOrientationClientMockQt::client()->setOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
810 #endif
811 }
812
813 void DumpRenderTreeSupportQt::resetGeolocationMock(QWebPage* page)
814 {
815 #if ENABLE(CLIENT_BASED_GEOLOCATION)
816     Page* corePage = QWebPagePrivate::core(page);
817     GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
818     mockClient->reset();
819 #endif
820 }
821
822 void DumpRenderTreeSupportQt::setMockGeolocationPermission(QWebPage* page, bool allowed)
823 {
824 #if ENABLE(CLIENT_BASED_GEOLOCATION)
825     Page* corePage = QWebPagePrivate::core(page);
826     GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
827     mockClient->setPermission(allowed);
828 #endif
829 }
830
831 void DumpRenderTreeSupportQt::setMockGeolocationPosition(QWebPage* page, double latitude, double longitude, double accuracy)
832 {
833 #if ENABLE(CLIENT_BASED_GEOLOCATION)
834     Page* corePage = QWebPagePrivate::core(page);
835     GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
836     mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy));
837 #endif
838 }
839
840 void DumpRenderTreeSupportQt::setMockGeolocationError(QWebPage* page, int errorCode, const QString& message)
841 {
842 #if ENABLE(CLIENT_BASED_GEOLOCATION)
843     Page* corePage = QWebPagePrivate::core(page);
844
845     GeolocationError::ErrorCode code = GeolocationError::PositionUnavailable;
846     switch (errorCode) {
847     case PositionError::PERMISSION_DENIED:
848         code = GeolocationError::PermissionDenied;
849         break;
850     case PositionError::POSITION_UNAVAILABLE:
851         code = GeolocationError::PositionUnavailable;
852         break;
853     }
854
855     GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(corePage->geolocationController()->client());
856     mockClient->setError(GeolocationError::create(code, message));
857 #endif
858 }
859
860 int DumpRenderTreeSupportQt::numberOfPendingGeolocationPermissionRequests(QWebPage* page)
861 {
862 #if ENABLE(CLIENT_BASED_GEOLOCATION)
863     Page* corePage = QWebPagePrivate::core(page);
864     GeolocationClientMock* mockClient = toGeolocationClientMock(corePage->geolocationController()->client());
865     return mockClient->numberOfPendingPermissionRequests();
866 #else
867     return -1;
868 #endif
869 }
870
871 bool DumpRenderTreeSupportQt::isTargetItem(const QWebHistoryItem& historyItem)
872 {
873     QWebHistoryItem it = historyItem;
874     if (QWebHistoryItemPrivate::core(&it)->isTargetItem())
875         return true;
876     return false;
877 }
878
879 QString DumpRenderTreeSupportQt::historyItemTarget(const QWebHistoryItem& historyItem)
880 {
881     QWebHistoryItem it = historyItem;
882     return (QWebHistoryItemPrivate::core(&it)->target());
883 }
884
885 QMap<QString, QWebHistoryItem> DumpRenderTreeSupportQt::getChildHistoryItems(const QWebHistoryItem& historyItem)
886 {
887     QWebHistoryItem it = historyItem;
888     HistoryItem* item = QWebHistoryItemPrivate::core(&it);
889     const WebCore::HistoryItemVector& children = item->children();
890
891     unsigned size = children.size();
892     QMap<QString, QWebHistoryItem> kids;
893     for (unsigned i = 0; i < size; ++i) {
894         QWebHistoryItem kid(new QWebHistoryItemPrivate(children[i].get()));
895         kids.insert(DumpRenderTreeSupportQt::historyItemTarget(kid), kid);
896     }
897     return kids;
898 }
899
900 bool DumpRenderTreeSupportQt::shouldClose(QWebFrame* frame)
901 {
902     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
903     return coreFrame->loader()->shouldClose();
904 }
905
906 void DumpRenderTreeSupportQt::clearScriptWorlds()
907 {
908     m_worldMap.clear();
909 }
910
911 void DumpRenderTreeSupportQt::evaluateScriptInIsolatedWorld(QWebFrame* frame, int worldID, const QString& script)
912 {
913     QWebScriptWorld* scriptWorld;
914     if (!worldID) {
915         scriptWorld = new QWebScriptWorld();
916     } else if (!m_worldMap.contains(worldID)) {
917         scriptWorld = new QWebScriptWorld();
918         m_worldMap.insert(worldID, scriptWorld);
919     } else
920         scriptWorld = m_worldMap.value(worldID);
921
922     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
923
924     ScriptController* proxy = coreFrame->script();
925
926     if (!proxy)
927         return;
928 #if USE(JSC)
929     proxy->executeScriptInWorld(scriptWorld->world(), script, true);
930 #elif USE(V8)
931     ScriptSourceCode source(script);
932     Vector<ScriptSourceCode> sources;
933     sources.append(source);
934     proxy->evaluateInIsolatedWorld(0, sources, true);
935 #endif
936 }
937
938 bool DumpRenderTreeSupportQt::isPageBoxVisible(QWebFrame* frame, int pageIndex)
939 {
940     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
941     return coreFrame->document()->isPageBoxVisible(pageIndex);
942 }
943
944 QString DumpRenderTreeSupportQt::pageSizeAndMarginsInPixels(QWebFrame* frame, int pageIndex, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft)
945 {
946     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
947     return PrintContext::pageSizeAndMarginsInPixels(coreFrame, pageIndex, width, height,
948                                                     marginTop, marginRight, marginBottom, marginLeft);
949 }
950
951 QString DumpRenderTreeSupportQt::pageProperty(QWebFrame* frame, const QString& propertyName, int pageNumber)
952 {
953     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
954     return PrintContext::pageProperty(coreFrame, propertyName.toUtf8().constData(), pageNumber);
955 }
956
957 void DumpRenderTreeSupportQt::addUserStyleSheet(QWebPage* page, const QString& sourceCode)
958 {
959     page->handle()->page->group().addUserStyleSheetToWorld(mainThreadNormalWorld(), sourceCode, QUrl(), nullptr, nullptr, WebCore::InjectInAllFrames);
960 }
961
962 void DumpRenderTreeSupportQt::simulateDesktopNotificationClick(const QString& title)
963 {
964 #if ENABLE(NOTIFICATIONS)
965     NotificationPresenterClientQt::notificationPresenter()->notificationClicked(title);
966 #endif
967 }
968
969 QString DumpRenderTreeSupportQt::plainText(const QVariant& range)
970 {
971     QMap<QString, QVariant> map = range.toMap();
972     QVariant startContainer  = map.value(QLatin1String("startContainer"));
973     map = startContainer.toMap();
974
975     return map.value(QLatin1String("innerText")).toString();
976 }
977
978 QVariantList DumpRenderTreeSupportQt::nodesFromRect(const QWebElement& document, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping)
979 {
980     QVariantList res;
981     WebCore::Element* webElement = document.m_element;
982     if (!webElement)
983         return res;
984
985     Document* doc = webElement->document();
986     if (!doc)
987         return res;
988     RefPtr<NodeList> nodes = doc->nodesFromRect(x, y, top, right, bottom, left, ignoreClipping);
989     for (unsigned i = 0; i < nodes->length(); i++) {
990         // QWebElement will be null if the Node is not an HTML Element
991         if (nodes->item(i)->isHTMLElement())
992             res << QVariant::fromValue(QWebElement(nodes->item(i)));
993         else
994             res << QVariant::fromValue(QDRTNode(nodes->item(i)));
995     }
996     return res;
997 }
998
999 void DumpRenderTreeSupportQt::setDefersLoading(QWebPage* page, bool flag)
1000 {
1001     Page* corePage = QWebPagePrivate::core(page);
1002     if (corePage)
1003         corePage->setDefersLoading(flag);
1004 }
1005
1006 void DumpRenderTreeSupportQt::goBack(QWebPage* page)
1007 {
1008     Page* corePage = QWebPagePrivate::core(page);
1009     if (corePage)
1010         corePage->goBack();
1011 }
1012
1013 // API Candidate?
1014 QString DumpRenderTreeSupportQt::responseMimeType(QWebFrame* frame)
1015 {
1016     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1017     WebCore::DocumentLoader* docLoader = coreFrame->loader()->documentLoader();
1018     return docLoader->responseMIMEType();
1019 }
1020
1021 void DumpRenderTreeSupportQt::clearOpener(QWebFrame* frame)
1022 {
1023     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1024     coreFrame->loader()->setOpener(0);
1025 }
1026
1027 void DumpRenderTreeSupportQt::addURLToRedirect(const QString& origin, const QString& destination)
1028 {
1029     FrameLoaderClientQt::URLsToRedirect[origin] = destination;
1030 }
1031
1032 void DumpRenderTreeSupportQt::setInteractiveFormValidationEnabled(QWebPage* page, bool enable)
1033 {
1034     Page* corePage = QWebPagePrivate::core(page);
1035     if (corePage)
1036         corePage->settings()->setInteractiveFormValidationEnabled(enable);
1037 }
1038
1039 #ifndef QT_NO_MENU
1040 static QStringList iterateContextMenu(QMenu* menu)
1041 {
1042     if (!menu)
1043         return QStringList();
1044
1045     QStringList items;
1046     QList<QAction *> actions = menu->actions();
1047     for (int i = 0; i < actions.count(); ++i) {
1048         if (actions.at(i)->isSeparator())
1049             items << QLatin1String("<separator>");
1050         else
1051             items << actions.at(i)->text();
1052         if (actions.at(i)->menu())
1053             items << iterateContextMenu(actions.at(i)->menu());
1054     }
1055     return items;
1056 }
1057 #endif
1058
1059 QStringList DumpRenderTreeSupportQt::contextMenu(QWebPage* page)
1060 {
1061 #ifndef QT_NO_CONTEXTMENU
1062     return iterateContextMenu(page->d->currentContextMenu.data());
1063 #else
1064     return QStringList();
1065 #endif
1066 }
1067
1068 double DumpRenderTreeSupportQt::defaultMinimumTimerInterval()
1069 {
1070     return Settings::defaultMinDOMTimerInterval();
1071 }
1072
1073 void DumpRenderTreeSupportQt::setMinimumTimerInterval(QWebPage* page, double interval)
1074 {
1075     Page* corePage = QWebPagePrivate::core(page);
1076     if (!corePage)
1077         return;
1078
1079     corePage->settings()->setMinDOMTimerInterval(interval);
1080 }
1081
1082 #if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
1083 bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QNetworkCookieJar* jar, const QUrl& url, const QUrl& firstPartyUrl)
1084 {
1085     return thirdPartyCookiePolicyPermits(jar, url, firstPartyUrl);
1086 }
1087 #endif
1088
1089 QUrl DumpRenderTreeSupportQt::mediaContentUrlByElementId(QWebFrame* frame, const QString& elementId)
1090 {
1091     QUrl res;
1092
1093 #if ENABLE(VIDEO) && USE(QT_MULTIMEDIA)
1094     Frame* coreFrame = QWebFramePrivate::core(frame);
1095     if (!coreFrame)
1096         return res;
1097
1098     Document* doc = coreFrame->document();
1099     if (!doc)
1100         return res;
1101
1102     Node* coreNode = doc->getElementById(elementId);
1103     if (!coreNode)
1104         return res;
1105
1106     HTMLVideoElement* videoElement = static_cast<HTMLVideoElement*>(coreNode);
1107     PlatformMedia platformMedia = videoElement->platformMedia();
1108     if (platformMedia.type != PlatformMedia::QtMediaPlayerType)
1109         return res;
1110
1111     MediaPlayerPrivateQt* mediaPlayerQt = static_cast<MediaPlayerPrivateQt*>(platformMedia.media.qtMediaPlayer);
1112     if (mediaPlayerQt && mediaPlayerQt->mediaPlayer())
1113         res = mediaPlayerQt->mediaPlayer()->media().canonicalUrl();
1114 #endif
1115
1116     return res;
1117 }
1118
1119 // API Candidate?
1120 void DumpRenderTreeSupportQt::setAlternateHtml(QWebFrame* frame, const QString& html, const QUrl& baseUrl, const QUrl& failingUrl)
1121 {
1122     KURL kurl(baseUrl);
1123     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1124     WebCore::ResourceRequest request(kurl);
1125     const QByteArray utf8 = html.toUtf8();
1126     WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
1127     WebCore::SubstituteData substituteData(data, WTF::String("text/html"), WTF::String("utf-8"), failingUrl);
1128     coreFrame->loader()->load(request, substituteData, false);
1129 }
1130
1131 void DumpRenderTreeSupportQt::confirmComposition(QWebPage* page, const char* text)
1132 {
1133     Frame* frame = page->handle()->page->focusController()->focusedOrMainFrame();
1134     if (!frame)
1135         return;
1136
1137     Editor* editor = frame->editor();
1138     if (!editor || (!editor->hasComposition() && !text))
1139         return;
1140
1141     if (editor->hasComposition()) {
1142         if (text)
1143             editor->confirmComposition(String::fromUTF8(text));
1144         else
1145             editor->confirmComposition();
1146     } else
1147         editor->insertText(String::fromUTF8(text), 0);
1148 }
1149
1150 QString DumpRenderTreeSupportQt::layerTreeAsText(QWebFrame* frame)
1151 {
1152     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1153     return coreFrame->layerTreeAsText();
1154 }
1155
1156 void DumpRenderTreeSupportQt::injectInternalsObject(QWebFrame* frame)
1157 {
1158     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1159 #if USE(JSC)
1160     JSC::JSLock lock(JSC::SilenceAssertionsOnly);
1161
1162     JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
1163     Q_ASSERT(window);
1164
1165     JSC::ExecState* exec = window->globalExec();
1166     Q_ASSERT(exec);
1167
1168     JSContextRef context = toRef(exec);
1169     WebCoreTestSupport::injectInternalsObject(context);
1170 #elif USE(V8)
1171     WebCoreTestSupport::injectInternalsObject(V8Proxy::mainWorldContext(coreFrame));
1172 #endif
1173 }
1174
1175 void DumpRenderTreeSupportQt::injectInternalsObject(JSContextRef context)
1176 {
1177 #if USE(JSC)
1178     WebCoreTestSupport::injectInternalsObject(context);
1179 #endif
1180 }
1181
1182 void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame)
1183 {
1184     WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
1185 #if USE(JSC)
1186     JSC::JSLock lock(JSC::SilenceAssertionsOnly);
1187
1188     JSDOMWindow* window = toJSDOMWindow(coreFrame, mainThreadNormalWorld());
1189     Q_ASSERT(window);
1190
1191     JSC::ExecState* exec = window->globalExec();
1192     Q_ASSERT(exec);
1193
1194     JSContextRef context = toRef(exec);
1195     WebCoreTestSupport::resetInternalsObject(context);
1196 #elif USE(V8)
1197     WebCoreTestSupport::resetInternalsObject(V8Proxy::mainWorldContext(coreFrame));
1198 #endif
1199 }
1200
1201 // Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
1202
1203 void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)
1204 {
1205     DumpRenderTreeSupportQt::resumeActiveDOMObjects(frame);
1206 }
1207
1208 void QWEBKIT_EXPORT qt_suspendActiveDOMObjects(QWebFrame* frame)
1209 {
1210     DumpRenderTreeSupportQt::suspendActiveDOMObjects(frame);
1211 }
1212
1213 void QWEBKIT_EXPORT qt_drt_clearFrameName(QWebFrame* frame)
1214 {
1215     DumpRenderTreeSupportQt::clearFrameName(frame);
1216 }
1217
1218 void QWEBKIT_EXPORT qt_drt_garbageCollector_collect()
1219 {
1220     DumpRenderTreeSupportQt::garbageCollectorCollect();
1221 }
1222
1223 void QWEBKIT_EXPORT qt_drt_garbageCollector_collectOnAlternateThread(bool waitUntilDone)
1224 {
1225     DumpRenderTreeSupportQt::garbageCollectorCollectOnAlternateThread(waitUntilDone);
1226 }
1227
1228 int QWEBKIT_EXPORT qt_drt_javaScriptObjectsCount()
1229 {
1230     return DumpRenderTreeSupportQt::javaScriptObjectsCount();
1231 }
1232
1233 int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame* frame)
1234 {
1235     return DumpRenderTreeSupportQt::numberOfActiveAnimations(frame);
1236 }
1237
1238 void QWEBKIT_EXPORT qt_drt_overwritePluginDirectories()
1239 {
1240     DumpRenderTreeSupportQt::overwritePluginDirectories();
1241 }
1242
1243 bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame* frame, const QString& animationName, double time, const QString& elementId)
1244 {
1245     return DumpRenderTreeSupportQt::pauseAnimation(frame, animationName, time, elementId);
1246 }
1247
1248 bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame* frame, const QString& propertyName, double time, const QString &elementId)
1249 {
1250     return DumpRenderTreeSupportQt::pauseTransitionOfProperty(frame, propertyName, time, elementId);
1251 }
1252
1253 void QWEBKIT_EXPORT qt_drt_resetOriginAccessWhiteLists()
1254 {
1255     DumpRenderTreeSupportQt::resetOriginAccessWhiteLists();
1256 }
1257
1258 void QWEBKIT_EXPORT qt_drt_run(bool b)
1259 {
1260     DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(b);
1261 }
1262
1263 void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* frame, bool enabled)
1264 {
1265     DumpRenderTreeSupportQt::setJavaScriptProfilingEnabled(frame, enabled);
1266 }
1267
1268 void QWEBKIT_EXPORT qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
1269 {
1270     DumpRenderTreeSupportQt::whiteListAccessFromOrigin(sourceOrigin, destinationProtocol, destinationHost, allowDestinationSubdomains);
1271 }
1272
1273 QString QWEBKIT_EXPORT qt_webpage_groupName(QWebPage* page)
1274 {
1275     return DumpRenderTreeSupportQt::webPageGroupName(page);
1276 }
1277
1278 void QWEBKIT_EXPORT qt_webpage_setGroupName(QWebPage* page, const QString& groupName)
1279 {
1280     DumpRenderTreeSupportQt::webPageSetGroupName(page, groupName);
1281 }
1282
1283 void QWEBKIT_EXPORT qt_dump_frame_loader(bool b)
1284 {
1285     DumpRenderTreeSupportQt::dumpFrameLoader(b);
1286 }
1287
1288 void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b)
1289 {
1290     DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(b);
1291 }
1292
1293 void QWEBKIT_EXPORT qt_dump_editing_callbacks(bool b)
1294 {
1295     DumpRenderTreeSupportQt::dumpEditingCallbacks(b);
1296 }
1297
1298 void QWEBKIT_EXPORT qt_dump_set_accepts_editing(bool b)
1299 {
1300     DumpRenderTreeSupportQt::dumpSetAcceptsEditing(b);
1301 }
1302