diff options
author | Steve Block <steveblock@google.com> | 2010-02-15 12:23:52 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-16 11:48:32 +0000 |
commit | 8a0914b749bbe7da7768e07a7db5c6d4bb09472b (patch) | |
tree | 73f9065f370435d6fde32ae129d458a8c77c8dff /WebKitTools/DumpRenderTree | |
parent | bf14be70295513b8076f3fa47a268a7e42b2c478 (diff) | |
download | external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.zip external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.gz external_webkit-8a0914b749bbe7da7768e07a7db5c6d4bb09472b.tar.bz2 |
Merge webkit.org at r54731 : Initial merge by git
Change-Id: Ia79977b6cf3b0b00c06ef39419989b28e57e4f4a
Diffstat (limited to 'WebKitTools/DumpRenderTree')
14 files changed, 190 insertions, 29 deletions
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp index 0537d7c..c2393c3 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp +++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp @@ -465,26 +465,34 @@ static JSValueRef notifyDoneCallback(JSContextRef context, JSObjectRef function, return JSValueMakeUndefined(context); } -static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +static bool parsePageParameters(JSContextRef context, int argumentCount, const JSValueRef* arguments, JSValueRef* exception, float& pageWidthInPixels, float& pageHeightInPixels) { // FIXME: These values should sync with maxViewWidth/Height in // DumpRenderTree.mm. Factor these values out to somewhere. - float pageWidthInPixels = 800; - float pageHeightInPixels = 600; + pageWidthInPixels = 800; + pageHeightInPixels = 600; switch (argumentCount) { - case 1: - break; - case 3: - pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception)); + case 2: + pageWidthInPixels = static_cast<float>(JSValueToNumber(context, arguments[0], exception)); if (*exception) - return JSValueMakeUndefined(context); - pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[2], exception)); + return false; + pageHeightInPixels = static_cast<float>(JSValueToNumber(context, arguments[1], exception)); if (*exception) - return JSValueMakeUndefined(context); + return false; + case 0: // Fall through. break; default: - return JSValueMakeUndefined(context); + return false; } + return true; +} + +static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + float pageWidthInPixels = 0; + float pageHeightInPixels = 0; + if (!parsePageParameters(context, argumentCount - 1, arguments + 1, exception, pageWidthInPixels, pageHeightInPixels)) + return JSValueMakeUndefined(context); JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[0], exception)); if (*exception) @@ -495,6 +503,17 @@ static JSValueRef pageNumberForElementByIdCallback(JSContextRef context, JSObjec return JSValueMakeNumber(context, pageNumber); } +static JSValueRef numberOfPagesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + float pageWidthInPixels = 0; + float pageHeightInPixels = 0; + if (!parsePageParameters(context, argumentCount, arguments, exception, pageWidthInPixels, pageHeightInPixels)) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + return JSValueMakeNumber(context, controller->numberOfPages(pageWidthInPixels, pageHeightInPixels)); +} + static JSValueRef queueBackNavigationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -897,6 +916,18 @@ static JSValueRef setXSSAuditorEnabledCallback(JSContextRef context, JSObjectRef return JSValueMakeUndefined(context); } +static JSValueRef setFrameSetFlatteningEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + // Has mac & windows implementation + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject)); + controller->setFrameSetFlatteningEnabled(JSValueToBoolean(context, arguments[0])); + + return JSValueMakeUndefined(context); +} + static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { // Has mac & windows implementation @@ -1329,6 +1360,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "grantDesktopNotificationPermission", grantDesktopNotificationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "isCommandEnabled", isCommandEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "keepWebHistory", keepWebHistoryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "numberOfPages", numberOfPagesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "notifyDone", notifyDoneCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "numberOfActiveAnimations", numberOfActiveAnimationsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "overridePreference", overridePreferenceCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, @@ -1373,6 +1405,7 @@ JSStaticFunction* LayoutTestController::staticFunctions() { "setPopupBlockingEnabled", setPopupBlockingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setXSSAuditorEnabled", setXSSAuditorEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "setFrameSetFlatteningEnabled", setFrameSetFlatteningEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSelectTrailingWhitespaceEnabled", setSelectTrailingWhitespaceEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h index 76e7cb3..5f9df50 100644 --- a/WebKitTools/DumpRenderTree/LayoutTestController.h +++ b/WebKitTools/DumpRenderTree/LayoutTestController.h @@ -56,6 +56,7 @@ public: bool isCommandEnabled(JSStringRef name); void keepWebHistory(); void notifyDone(); + int numberOfPages(float pageWidthInPixels, float pageHeightInPixels); void overridePreference(JSStringRef key, JSStringRef value); int pageNumberForElementById(JSStringRef id, float pageWidthInPixels, float pageHeightInPixels); JSStringRef pathToLocalResource(JSContextRef, JSStringRef url); @@ -89,6 +90,7 @@ public: void setUserStyleSheetEnabled(bool flag); void setUserStyleSheetLocation(JSStringRef path); void setXSSAuditorEnabled(bool flag); + void setFrameSetFlatteningEnabled(bool enable); void waitForPolicyDelegate(); size_t webHistoryItemCount(); diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp index fa8aed1..e69da73 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp @@ -133,6 +133,7 @@ enum { ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM, ID_PROPERTY_PRIVATE_BROWSING_ENABLED, ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED, + ID_PROPERTY_THROW_EXCEPTION_PROPERTY, NUM_PROPERTY_IDENTIFIERS }; @@ -146,6 +147,7 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = { "returnErrorFromNewStream", "privateBrowsingEnabled", "cachedPrivateBrowsingEnabled", + "testThrowExceptionProperty" }; enum { @@ -172,6 +174,8 @@ enum { ID_DESTROY_NULL_STREAM, ID_TEST_RELOAD_PLUGINS_NO_PAGES, ID_TEST_RELOAD_PLUGINS_AND_PAGES, + ID_TEST_GET_BROWSER_PROPERTY, + ID_TEST_SET_BROWSER_PROPERTY, NUM_METHOD_IDENTIFIERS }; @@ -199,7 +203,9 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = { "testFail", "destroyNullStream", "reloadPluginsNoPages", - "reloadPluginsAndPages" + "reloadPluginsAndPages", + "testGetBrowserProperty", + "testSetBrowserProperty" }; static NPUTF8* createCStringFromNPVariant(const NPVariant* variant) @@ -264,6 +270,9 @@ static bool pluginGetProperty(NPObject* obj, NPIdentifier name, NPVariant* resul } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_CACHED_PRIVATE_BROWSING_ENABLED]) { BOOLEAN_TO_NPVARIANT(plugin->cachedPrivateBrowsingMode, *result); return true; + } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) { + browser->setexception(obj, "plugin object testThrowExceptionProperty SUCCESS"); + return true; } return false; } @@ -280,6 +289,9 @@ static bool pluginSetProperty(NPObject* obj, NPIdentifier name, const NPVariant* } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) { plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant); return true; + } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_THROW_EXCEPTION_PROPERTY]) { + browser->setexception(obj, "plugin object testThrowExceptionProperty SUCCESS"); + return true; } return false; @@ -789,6 +801,12 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a } else if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_AND_PAGES]) { browser->reloadplugins(true); return true; + } else if (name == pluginMethodIdentifiers[ID_TEST_GET_BROWSER_PROPERTY]) { + browser->getproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), result); + return true; + } else if (name == pluginMethodIdentifiers[ID_TEST_SET_BROWSER_PROPERTY]) { + browser->setproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), &args[2]); + return true; } return false; diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp index 5883ffb..8ef228a 100644 --- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp +++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp @@ -119,8 +119,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch NPBool supportsCocoa = false; #ifndef NP_NO_CARBON + // A browser that doesn't know about NPNVsupportsCarbonBool is one that only supports Carbon event model. if (browser->getvalue(instance, NPNVsupportsCarbonBool, &supportsCarbon) != NPERR_NO_ERROR) - supportsCarbon = false; + supportsCarbon = true; #endif if (browser->getvalue(instance, NPNVsupportsCocoaBool, &supportsCocoa) != NPERR_NO_ERROR) diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp index bad09fb..422e2c2 100644 --- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp +++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp @@ -55,6 +55,7 @@ void webkit_application_cache_set_maximum_size(unsigned long long size); unsigned int webkit_worker_thread_count(void); void webkit_white_list_access_from_origin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains); gchar* webkit_web_frame_counter_value_for_element_by_id(WebKitWebFrame* frame, const gchar* id); +int webkit_web_frame_page_number_for_element_by_id(WebKitWebFrame* frame, const gchar* id, float pageWidth, float pageHeight); void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script); } @@ -140,7 +141,15 @@ void LayoutTestController::keepWebHistory() // FIXME: implement } -int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) +int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWidth, float pageHeight) +{ + gchar* idGChar = JSStringCopyUTF8CString(id); + int pageNumber = webkit_web_frame_page_number_for_element_by_id(mainFrame, idGChar, pageWidth, pageHeight); + g_free(idGChar); + return pageNumber; +} + +int LayoutTestController::numberOfPages(float, float) { // FIXME: implement return -1; @@ -325,6 +334,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool flag) g_object_set(G_OBJECT(settings), "enable-xss-auditor", flag, NULL); } +void LayoutTestController::setFrameSetFlatteningEnabled(bool flag) +{ + // FIXME: implement +} + void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool flag) { WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame); diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm index 12e1941..7a4429b 100644 --- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm +++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm @@ -421,8 +421,8 @@ static void resetDefaultsToConsistentValues() [preferences setJavaScriptCanOpenWindowsAutomatically:YES]; [preferences setOfflineWebApplicationCacheEnabled:YES]; [preferences setDeveloperExtrasEnabled:NO]; - [preferences setXSSAuditorEnabled:NO]; [preferences setLoadsImagesAutomatically:YES]; + [preferences setFrameSetFlatteningEnabled:NO]; if (persistentUserStyleSheetLocation) { [preferences setUserStyleSheetLocation:[NSURL URLWithString:(NSString *)(persistentUserStyleSheetLocation.get())]]; [preferences setUserStyleSheetEnabled:YES]; diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm index 67c8c91..b726e72 100644 --- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm +++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm @@ -188,6 +188,11 @@ int LayoutTestController::pageNumberForElementById(JSStringRef id, float pageWid return [mainFrame pageNumberForElement:element:pageWidthInPixels:pageHeightInPixels]; } +int LayoutTestController::numberOfPages(float pageWidthInPixels, float pageHeightInPixels) +{ + return [mainFrame numberOfPages:pageWidthInPixels:pageHeightInPixels]; +} + size_t LayoutTestController::webHistoryItemCount() { return [[[WebHistory optionalSharedHistory] allItems] count]; @@ -319,6 +324,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled) [[[mainFrame webView] preferences] setXSSAuditorEnabled:enabled]; } +void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) +{ + [[[mainFrame webView] preferences] setFrameSetFlatteningEnabled:enabled]; +} + void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) { [[[mainFrame webView] preferences] setAllowUniversalAccessFromFileURLs:enabled]; diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index ca48003..51c1181 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -37,7 +37,9 @@ #include <qwebsettings.h> extern void qt_dump_editing_callbacks(bool b); +extern void qt_dump_frame_loader(bool b); extern void qt_dump_resource_load_callbacks(bool b); +extern void qt_drt_setFrameSetFlatteningEnabled(QWebPage*, bool); extern void qt_drt_setJavaScriptProfilingEnabled(QWebFrame*, bool enabled); extern bool qt_drt_pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId); extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId); @@ -48,6 +50,7 @@ extern void qt_drt_setDomainRelaxationForbiddenForURLScheme(bool forbidden, cons extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains); extern QString qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id); extern int qt_drt_workerThreadCount(); +extern int qt_drt_pageNumberForElementById(QWebFrame* qFrame, const QString& id, float width, float height); LayoutTestController::LayoutTestController(WebCore::DumpRenderTree* drt) : QObject() @@ -75,6 +78,7 @@ void LayoutTestController::reset() m_webHistory = 0; m_globalFlag = false; qt_dump_editing_callbacks(false); + qt_dump_frame_loader(false); qt_dump_resource_load_callbacks(false); emit hidePage(); } @@ -201,6 +205,11 @@ void LayoutTestController::dumpEditingCallbacks() qt_dump_editing_callbacks(true); } +void LayoutTestController::dumpFrameLoadCallbacks() +{ + qt_dump_frame_loader(true); +} + void LayoutTestController::dumpResourceLoadCallbacks() { qt_dump_resource_load_callbacks(true); @@ -287,6 +296,11 @@ void LayoutTestController::hideWebInspector() m_drt->webPage()->webInspector()->hide(); } +void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) +{ + qt_drt_setFrameSetFlatteningEnabled(m_drt->webPage(), enabled); +} + void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) { m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, enabled); @@ -421,6 +435,9 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian settings->setFontSize(QWebSettings::DefaultFontSize, value.toInt()); else if (name == "WebKitUsesPageCachePreferenceKey") QWebSettings::setMaximumPagesInCache(value.toInt()); + else + printf("ERROR: LayoutTestController::overridePreference() does not support the '%s' preference\n", + name.toLatin1().data()); } void LayoutTestController::setUserStyleSheetLocation(const QString& url) @@ -445,3 +462,14 @@ int LayoutTestController::workerThreadCount() { return qt_drt_workerThreadCount(); } + +int LayoutTestController::pageNumberForElementById(const QString& id, float width, float height) +{ + // If no size specified, webpage viewport size is used + if (!width && !height) { + width = m_drt->webPage()->viewportSize().width(); + height = m_drt->webPage()->viewportSize().height(); + } + + return qt_drt_pageNumberForElementById(m_drt->webPage()->mainFrame(), id, width, height); +} diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h index 365640d..64cbcc9 100644 --- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -96,6 +96,7 @@ public slots: void setGlobalFlag(bool flag) { m_globalFlag = flag; } void handleErrorPages() { m_handleErrorPages = true; } void dumpEditingCallbacks(); + void dumpFrameLoadCallbacks(); void dumpResourceLoadCallbacks(); void queueBackNavigation(int howFarBackward); void queueForwardNavigation(int howFarForward); @@ -115,6 +116,8 @@ public slots: void dumpSelectionRect() const {} void showWebInspector(); void hideWebInspector(); + + void setFrameSetFlatteningEnabled(bool enable); void setAllowUniversalAccessFromFileURLs(bool enable); void setJavaScriptProfilingEnabled(bool enable); void setFixedContentsSize(int width, int height); @@ -146,6 +149,7 @@ public slots: void setUserStyleSheetEnabled(bool enabled); void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const QString& scheme); int workerThreadCount(); + int pageNumberForElementById(const QString& id, float width = 0, float height = 0); private slots: void processWork(); diff --git a/WebKitTools/DumpRenderTree/qt/main.cpp b/WebKitTools/DumpRenderTree/qt/main.cpp index 69d3c23..efcda57 100644 --- a/WebKitTools/DumpRenderTree/qt/main.cpp +++ b/WebKitTools/DumpRenderTree/qt/main.cpp @@ -48,6 +48,11 @@ #include <fontconfig/fontconfig.h> #endif +#ifdef Q_OS_WIN +#include <io.h> +#include <fcntl.h> +#endif + #include <limits.h> #include <signal.h> @@ -101,6 +106,11 @@ static NO_RETURN void crashHandler(int sig) int main(int argc, char* argv[]) { +#ifdef Q_OS_WIN + _setmode(1, _O_BINARY); + _setmode(2, _O_BINARY); +#endif + #ifdef Q_WS_X11 FcInit(); WebCore::DumpRenderTree::initializeFonts(); diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index 1315f9e..261b9e6 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -792,6 +792,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences) prefsPrivate->setExperimentalNotificationsEnabled(TRUE); prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls <http://bugs.webkit.org/show_bug.cgi?id=25592> prefsPrivate->setXSSAuditorEnabled(FALSE); + prefsPrivate->setFrameSetFlatteningEnabled(FALSE); prefsPrivate->setOfflineWebApplicationCacheEnabled(TRUE); } setAlwaysAcceptCookies(false); diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index 4f5e925..34fd2e6 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -372,6 +372,23 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled) prefsPrivate->setXSSAuditorEnabled(enabled); } +void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebPreferences> preferences; + if (FAILED(webView->preferences(&preferences))) + return; + + COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences); + if (!prefsPrivate) + return; + + prefsPrivate->setFrameSetFlatteningEnabled(enabled); +} + void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) { COMPtr<IWebView> webView; @@ -1109,3 +1126,9 @@ int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) // FIXME: implement return -1; } + +int LayoutTestController::numberOfPages(float, float) +{ + // FIXME: implement + return -1; +} diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp index 82b1d4d..08a2f6a 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp @@ -71,6 +71,19 @@ NPError __stdcall NP_Shutdown() return NPERR_NO_ERROR; } +static void executeScript(const PluginObject* object, const char* script) +{ + NPObject *windowScriptObject; + browser->getvalue(object->npp, NPNVWindowNPObject, &windowScriptObject); + + NPString npScript; + npScript.UTF8Characters = script; + npScript.UTF8Length = strlen(script); + + NPVariant browserResult; + browser->evaluate(object->npp, windowScriptObject, &npScript, &browserResult); + browser->releasevariantvalue(&browserResult); +} NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved) { @@ -84,6 +97,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch obj->onStreamDestroy = _strdup(argv[i]); else if (_stricmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify) obj->onURLNotify = _strdup(argv[i]); + else if (_stricmp(argn[i], "onDestroy") == 0 && !obj->onDestroy) + obj->onDestroy = _strdup(argv[i]); else if (_stricmp(argn[i], "logSrc") == 0) { for (int i = 0; i < argc; i++) if (_stricmp(argn[i], "src") == 0) @@ -113,6 +128,11 @@ NPError NPP_Destroy(NPP instance, NPSavedData **save) if (obj->onStreamDestroy) free(obj->onStreamDestroy); + if (obj->onDestroy) { + executeScript(obj, obj->onDestroy); + free(obj->onDestroy); + } + if (obj->logDestroy) printf("PLUGIN: NPP_Destroy\n"); @@ -135,20 +155,6 @@ NPError NPP_SetWindow(NPP instance, NPWindow *window) return NPERR_NO_ERROR; } -static void executeScript(const PluginObject* obj, const char* script) -{ - NPObject *windowScriptObject; - browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); - - NPString npScript; - npScript.UTF8Characters = script; - npScript.UTF8Length = strlen(script); - - NPVariant browserResult; - browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult); - browser->releasevariantvalue(&browserResult); -} - NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype) { PluginObject* obj = (PluginObject*)instance->pdata; diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp index 6d3b624..3bc84cd 100644 --- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp +++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp @@ -170,6 +170,11 @@ void LayoutTestController::setXSSAuditorEnabled(bool enabled) // FIXME: implement } +void LayoutTestController::setFrameSetFlatteningEnabled(bool enabled) +{ + // FIXME: implement +} + void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled) { // FIXME: implement @@ -365,3 +370,9 @@ int LayoutTestController::pageNumberForElementById(JSStringRef, float, float) // FIXME: implement return -1; } + +int LayoutTestController::numberOfPages(float, float) +{ + // FIXME: implement + return -1; +}
\ No newline at end of file |