#include "FrameView.h"
#if USE(JSC)
#include "GCController.h"
+#include "JSNode.h"
+#include "qt_runtime.h"
#elif USE(V8)
#include "V8GCController.h"
#include "V8Proxy.h"
#include "GeolocationPosition.h"
#include "HistoryItem.h"
#include "HTMLInputElement.h"
+#include "InitWebCoreQt.h"
#include "InspectorController.h"
#include "NodeList.h"
#include "NotificationPresenterClientQt.h"
#include "PrintContext.h"
#include "RenderListItem.h"
#include "RenderTreeAsText.h"
+#include "SchemeRegistry.h"
#include "ScriptController.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "SecurityOrigin.h"
+#include "SecurityPolicy.h"
#include "Settings.h"
#if ENABLE(SVG)
#include "SVGDocumentExtensions.h"
return *this;
}
+#if USE(JSC)
+QDRTNode QtDRTNodeRuntime::create(WebCore::Node* node)
+{
+ return QDRTNode(node);
+}
+
+WebCore::Node* QtDRTNodeRuntime::get(const QDRTNode& node)
+{
+ return node.m_node;
+}
+
+static QVariant convertJSValueToNodeVariant(JSC::JSObject* object, int *distance, HashSet<JSC::JSObject*>*)
+{
+ if (!object || !object->inherits(&JSNode::s_info))
+ return QVariant();
+ return QVariant::fromValue<QDRTNode>(QtDRTNodeRuntime::create((static_cast<JSNode*>(object))->impl()));
+}
+
+static JSC::JSValue convertNodeVariantToJSValue(JSC::ExecState* exec, WebCore::JSDOMGlobalObject* globalObject, const QVariant& variant)
+{
+ return toJS(exec, globalObject, QtDRTNodeRuntime::get(variant.value<QDRTNode>()));
+}
+#endif
+
+void QtDRTNodeRuntime::initialize()
+{
+ static bool initialized = false;
+ if (initialized)
+ return;
+ initialized = true;
+#if USE(JSC)
+ int id = qRegisterMetaType<QDRTNode>();
+ JSC::Bindings::registerCustomType(id, convertJSValueToNodeVariant, convertNodeVariantToJSValue);
+#endif
+}
DumpRenderTreeSupportQt::DumpRenderTreeSupportQt()
{
{
}
+void DumpRenderTreeSupportQt::initialize()
+{
+ WebCore::initializeWebCoreQt();
+ QtDRTNodeRuntime::initialize();
+}
+
void DumpRenderTreeSupportQt::overwritePluginDirectories()
{
PluginDatabase* db = PluginDatabase::installedPlugins(/* populate */ false);
void DumpRenderTreeSupportQt::whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
{
- SecurityOrigin::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
+ SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
}
void DumpRenderTreeSupportQt::removeWhiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains)
{
- SecurityOrigin::removeOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
+ SecurityPolicy::removeOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);
}
void DumpRenderTreeSupportQt::resetOriginAccessWhiteLists()
{
- SecurityOrigin::resetOriginAccessWhitelists();
+ SecurityPolicy::resetOriginAccessWhitelists();
}
void DumpRenderTreeSupportQt::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme)
{
- SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
+ SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
}
void DumpRenderTreeSupportQt::setCaretBrowsingEnabled(QWebPage* page, bool value)
/* device-height */ deviceSize.height(),
/* device-dpi */ deviceDPI,
availableSize);
+ WebCore::restrictMinimumScaleFactorToViewportSize(conf, availableSize);
+ WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(conf);
QString res;
res = res.sprintf("viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n",
corePage->settings()->setInteractiveFormValidationEnabled(enable);
}
+#ifndef QT_NO_MENU
static QStringList iterateContextMenu(QMenu* menu)
{
if (!menu)
}
return items;
}
+#endif
QStringList DumpRenderTreeSupportQt::contextMenu(QWebPage* page)
{
}
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
-bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QNetworkCookieJar* jar, const QUrl& url, const QUrl& firstPartyUrl)
+bool DumpRenderTreeSupportQt::thirdPartyCookiePolicyAllows(QWebPage *page, const QUrl& url, const QUrl& firstPartyUrl)
{
- return thirdPartyCookiePolicyPermits(jar, url, firstPartyUrl);
+ Page* corePage = QWebPagePrivate::core(page);
+ return thirdPartyCookiePolicyPermits(corePage->mainFrame()->loader()->networkingContext(), url, firstPartyUrl);
}
#endif
JSContextRef context = toRef(exec);
WebCoreTestSupport::injectInternalsObject(context);
#elif USE(V8)
+ v8::HandleScope handleScope;
WebCoreTestSupport::injectInternalsObject(V8Proxy::mainWorldContext(coreFrame));
#endif
}
+void DumpRenderTreeSupportQt::injectInternalsObject(JSContextRef context)
+{
+#if USE(JSC)
+ WebCoreTestSupport::injectInternalsObject(context);
+#endif
+}
+
void DumpRenderTreeSupportQt::resetInternalsObject(QWebFrame* frame)
{
WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
JSContextRef context = toRef(exec);
WebCoreTestSupport::resetInternalsObject(context);
#elif USE(V8)
+ v8::HandleScope handleScope;
WebCoreTestSupport::resetInternalsObject(V8Proxy::mainWorldContext(coreFrame));
#endif
}
+bool DumpRenderTreeSupportQt::defaultHixie76WebSocketProtocolEnabled()
+{
+ return true;
+}
+
+void DumpRenderTreeSupportQt::setHixie76WebSocketProtocolEnabled(QWebPage* page, bool enabled)
+{
+#if ENABLE(WEB_SOCKETS)
+ if (Page* corePage = QWebPagePrivate::core(page))
+ corePage->settings()->setUseHixie76WebSocketProtocol(enabled);
+#else
+ UNUSED_PARAM(page);
+ UNUSED_PARAM(enabled);
+#endif
+}
+
// Provide a backward compatibility with previously exported private symbols as of QtWebKit 4.6 release
void QWEBKIT_EXPORT qt_resumeActiveDOMObjects(QWebFrame* frame)