From 0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 11 Aug 2009 17:01:47 +0100 Subject: Merge in WebKit r47029. --- .../win/AccessibilityUIElementWin.cpp | 67 ++- WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp | 89 +++- .../DumpRenderTree/win/DumpRenderTree.vcproj | 263 +++++++++++- WebKitTools/DumpRenderTree/win/EventSender.cpp | 2 +- .../DumpRenderTree/win/FrameLoadDelegate.cpp | 108 +++-- WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h | 23 +- WebKitTools/DumpRenderTree/win/GCControllerWin.cpp | 7 +- WebKitTools/DumpRenderTree/win/ImageDiff.vcproj | 460 ++++++++++----------- .../DumpRenderTree/win/LayoutTestControllerWin.cpp | 97 +++-- .../DumpRenderTree/win/PixelDumpSupportWin.cpp | 19 +- WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp | 87 +++- WebKitTools/DumpRenderTree/win/PolicyDelegate.h | 8 +- .../DumpRenderTree/win/ResourceLoadDelegate.cpp | 55 ++- .../DumpRenderTree/win/ResourceLoadDelegate.h | 2 +- .../win/TestNetscapePlugin/TestNetscapePlugin.def | 2 +- .../TestNetscapePlugin/TestNetscapePlugin.vcproj | 13 +- .../TestNetscapePlugin_debug.def | 6 + .../DumpRenderTree/win/TestNetscapePlugin/main.c | 183 -------- .../DumpRenderTree/win/TestNetscapePlugin/main.cpp | 5 + WebKitTools/DumpRenderTree/win/UIDelegate.cpp | 170 +++++++- WebKitTools/DumpRenderTree/win/UIDelegate.h | 100 ++++- .../DumpRenderTree/win/WorkQueueItemWin.cpp | 50 ++- 22 files changed, 1238 insertions(+), 578 deletions(-) create mode 100644 WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin_debug.def delete mode 100644 WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c (limited to 'WebKitTools/DumpRenderTree/win') diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp index 952ce5d..cfcfc54 100644 --- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp +++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp @@ -73,6 +73,18 @@ void AccessibilityUIElement::getChildrenWithRange(Vector elementVector.append(getChildAtIndex(i)); } +int AccessibilityUIElement::childrenCount() +{ + long childCount; + m_element->get_accChildCount(&childCount); + return childCount; +} + +AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y) +{ + return 0; +} + AccessibilityUIElement AccessibilityUIElement::getChildAtIndex(unsigned index) { COMPtr child; @@ -165,6 +177,27 @@ JSStringRef AccessibilityUIElement::description() return JSStringCreateWithCharacters(description.data(), description.length()); } +JSStringRef AccessibilityUIElement::language() +{ + return JSStringCreateWithCharacters(0, 0); +} + +double AccessibilityUIElement::x() +{ + long x, y, width, height; + if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) + return 0; + return x; +} + +double AccessibilityUIElement::y() +{ + long x, y, width, height; + if (FAILED(m_element->accLocation(&x, &y, &width, &height, self()))) + return 0; + return y; +} + double AccessibilityUIElement::width() { long x, y, width, height; @@ -181,6 +214,21 @@ double AccessibilityUIElement::height() return height; } +double AccessibilityUIElement::clickPointX() +{ + return 0; +} + +double AccessibilityUIElement::clickPointY() +{ + return 0; +} + +JSStringRef AccessibilityUIElement::valueDescription() +{ + return 0; +} + double AccessibilityUIElement::intValue() { BSTR valueBSTR; @@ -202,7 +250,17 @@ double AccessibilityUIElement::maxValue() return 0; } -bool AccessibilityUIElement::supportsPressAction() +bool AccessibilityUIElement::isActionSupported(JSStringRef action) +{ + return false; +} + +bool AccessibilityUIElement::isEnabled() +{ + return false; +} + +bool AccessibilityUIElement::isRequired() const { return false; } @@ -291,3 +349,10 @@ bool AccessibilityUIElement::isAttributeSettable(JSStringRef attribute) return false; } +void AccessibilityUIElement::increment() +{ +} + +void AccessibilityUIElement::decrement() +{ +} diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp index 28a0336..d262826 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp @@ -50,11 +50,13 @@ #include #include #include +#if PLATFORM(CFNETWORK) #include +#endif #include #include -#include #include +#include using namespace std; @@ -215,6 +217,7 @@ static void initialize() TEXT("Times Bold.ttf"), TEXT("Times Italic.ttf"), TEXT("Times Roman.ttf"), + TEXT("WebKit Layout Tests 2.ttf"), TEXT("WebKit Layout Tests.ttf"), TEXT("WebKitWeightWatcher100.ttf"), TEXT("WebKitWeightWatcher200.ttf"), @@ -230,7 +233,7 @@ static void initialize() wstring resourcesPath = fontsPath(); COMPtr textRenderer; - if (SUCCEEDED(CoCreateInstance(CLSID_WebTextRenderer, 0, CLSCTX_ALL, IID_IWebTextRenderer, (void**)&textRenderer))) + if (SUCCEEDED(WebKitCreateInstance(CLSID_WebTextRenderer, 0, IID_IWebTextRenderer, (void**)&textRenderer))) for (int i = 0; i < ARRAYSIZE(fontsToInstall); ++i) textRenderer->registerPrivateFont(wstring(resourcesPath + fontsToInstall[i]).c_str()); @@ -403,6 +406,24 @@ static void dumpHistoryItem(IWebHistoryItem* item, int indent, bool current) BSTR url; if (FAILED(item->URLString(&url))) return; + + if (wcsstr(url, L"file:/") == url) { + static wchar_t* layoutTestsString = L"/LayoutTests/"; + static wchar_t* fileTestString = L"(file test):"; + + wchar_t* result = wcsstr(url, layoutTestsString); + if (result == NULL) + return; + wchar_t* start = result + wcslen(layoutTestsString); + + BSTR newURL = SysAllocStringLen(NULL, SysStringLen(url)); + wcscpy(newURL, fileTestString); + wcscpy(newURL + wcslen(fileTestString), start); + + SysFreeString(url); + url = newURL; + } + printf("%S", url ? url : L""); SysFreeString(url); @@ -626,14 +647,14 @@ void dump() fail: SysFreeString(resultString); - // This will exit from our message loop + // This will exit from our message loop. PostQuitMessage(0); done = true; } static bool shouldLogFrameLoadDelegates(const char* pathOrURL) { - return strstr(pathOrURL, "loading/"); + return strstr(pathOrURL, "/loading/") || strstr(pathOrURL, "\\loading\\"); } static void resetWebViewToConsistentStateBeforeTesting() @@ -643,6 +664,8 @@ static void resetWebViewToConsistentStateBeforeTesting() return; webView->setPolicyDelegate(0); + policyDelegate->setPermissive(false); + policyDelegate->setControllerToNotifyDone(0); COMPtr webIBActions(Query, webView); if (webIBActions) { @@ -654,6 +677,7 @@ static void resetWebViewToConsistentStateBeforeTesting() if (SUCCEEDED(webView->preferences(&preferences))) { preferences->setPrivateBrowsingEnabled(FALSE); preferences->setJavaScriptCanOpenWindowsAutomatically(TRUE); + preferences->setLoadsImagesAutomatically(TRUE); if (persistentUserStyleSheetLocation) { Vector urlCharacters(CFStringGetLength(persistentUserStyleSheetLocation.get())); @@ -669,6 +693,8 @@ static void resetWebViewToConsistentStateBeforeTesting() if (prefsPrivate) { prefsPrivate->setAuthorAndUserStylesEnabled(TRUE); prefsPrivate->setDeveloperExtrasEnabled(FALSE); + prefsPrivate->setShouldPaintNativeControls(FALSE); // FIXME - need to make DRT pass with Windows native controls + prefsPrivate->setXSSAuditorEnabled(FALSE); } } @@ -689,6 +715,8 @@ static void resetWebViewToConsistentStateBeforeTesting() SetFocus(viewWindow); webViewPrivate->clearMainFrameName(); + + sharedUIDelegate->resetUndoManager(); } static void runTest(const string& testPathOrURL) @@ -735,12 +763,11 @@ static void runTest(const string& testPathOrURL) if (shouldLogFrameLoadDelegates(pathOrURL.c_str())) gLayoutTestController->setDumpFrameLoadCallbacks(true); - COMPtr history(Create, CLSID_WebHistory); - if (history) + COMPtr history; + if (SUCCEEDED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast(&history)))) history->setOptionalSharedHistory(0); resetWebViewToConsistentStateBeforeTesting(); - sharedUIDelegate->resetUndoManager(); prevTestBFItem = 0; COMPtr webView; @@ -757,7 +784,7 @@ static void runTest(const string& testPathOrURL) webView->hostWindow(reinterpret_cast(&hostWindow)); COMPtr request; - HRESULT hr = CoCreateInstance(CLSID_WebMutableURLRequest, 0, CLSCTX_ALL, IID_IWebMutableURLRequest, (void**)&request); + HRESULT hr = WebKitCreateInstance(CLSID_WebMutableURLRequest, 0, IID_IWebMutableURLRequest, (void**)&request); if (FAILED(hr)) goto exit; @@ -777,6 +804,8 @@ static void runTest(const string& testPathOrURL) DispatchMessage(&msg); } + resetWebViewToConsistentStateBeforeTesting(); + frame->stopLoading(); if (::gLayoutTestController->closeRemainingWindowsWhenComplete()) { @@ -963,7 +992,7 @@ IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) IWebView* webView; - HRESULT hr = CoCreateInstance(CLSID_WebView, 0, CLSCTX_ALL, IID_IWebView, (void**)&webView); + HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, (void**)&webView); if (FAILED(hr)) { fprintf(stderr, "Failed to create CLSID_WebView instance, error 0x%x\n", hr); return 0; @@ -1034,6 +1063,27 @@ IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow) return webView; } +#if PLATFORM(CFNETWORK) +RetainPtr sharedCFURLCache() +{ + HMODULE module = GetModuleHandle(TEXT("CFNetwork_debug.dll")); + if (!module) + module = GetModuleHandle(TEXT("CFNetwork.dll")); + if (!module) + return 0; + + typedef CFURLCacheRef (*CFURLCacheCopySharedURLCacheProcPtr)(void); + if (CFURLCacheCopySharedURLCacheProcPtr copyCache = reinterpret_cast(GetProcAddress(module, "CFURLCacheCopySharedURLCache"))) + return RetainPtr(AdoptCF, copyCache()); + + typedef CFURLCacheRef (*CFURLCacheSharedURLCacheProcPtr)(void); + if (CFURLCacheSharedURLCacheProcPtr sharedCache = reinterpret_cast(GetProcAddress(module, "CFURLCacheSharedURLCache"))) + return sharedCache(); + + return 0; +} +#endif + int main(int argc, char* argv[]) { leakChecking = false; @@ -1075,13 +1125,27 @@ int main(int argc, char* argv[]) sharedEditingDelegate.adoptRef(new EditingDelegate); sharedResourceLoadDelegate.adoptRef(new ResourceLoadDelegate); + // FIXME - need to make DRT pass with Windows native controls + COMPtr tmpPreferences; + if (FAILED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, reinterpret_cast(&tmpPreferences)))) + return -1; + COMPtr standardPreferences; + if (FAILED(tmpPreferences->standardPreferences(&standardPreferences))) + return -1; + COMPtr standardPreferencesPrivate; + if (FAILED(standardPreferences->QueryInterface(&standardPreferencesPrivate))) + return -1; + standardPreferencesPrivate->setShouldPaintNativeControls(FALSE); + standardPreferences->setJavaScriptEnabled(TRUE); + standardPreferences->setDefaultFontSize(16); + COMPtr webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow)); if (!webView) return -1; COMPtr iconDatabase; COMPtr tmpIconDatabase; - if (FAILED(CoCreateInstance(CLSID_WebIconDatabase, 0, CLSCTX_ALL, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) + if (FAILED(WebKitCreateInstance(CLSID_WebIconDatabase, 0, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) return -1; if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) return -1; @@ -1089,7 +1153,10 @@ int main(int argc, char* argv[]) if (FAILED(webView->mainFrame(&frame))) return -1; - CFURLCacheRemoveAllCachedResponses(CFURLCacheSharedURLCache()); +#if PLATFORM(CFNETWORK) + RetainPtr urlCache = sharedCFURLCache(); + CFURLCacheRemoveAllCachedResponses(urlCache.get()); +#endif #ifdef _DEBUG _CrtMemState entryToMainMemCheckpoint; diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj index e094bde..b1bd3ab 100644 --- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj +++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.vcproj @@ -39,7 +39,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -374,16 +513,108 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1) { - JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], exception); + JSObjectRef modifiersArray = JSValueToObject(context, arguments[1], 0); if (modifiersArray) { int modifiersCount = JSValueToNumber(context, JSObjectGetProperty(context, modifiersArray, lengthProperty, 0), 0); for (int i = 0; i < modifiersCount; ++i) { diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp index b18b961..5f0e02b 100644 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -99,8 +99,6 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::QueryInterface(REFIID riid, void** *ppvObject = static_cast(this); else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate)) *ppvObject = static_cast(this); - else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate2)) - *ppvObject = static_cast(this); else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegatePrivate)) *ppvObject = static_cast(this); else @@ -126,12 +124,11 @@ ULONG STDMETHODCALLTYPE FrameLoadDelegate::Release(void) HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) + /* [in] */ IWebView* webView, + /* [in] */ IWebFrame* frame) { if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didStartProvisionalLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); + printf("%s - didStartProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); // Make sure we only set this once per test. If it gets cleared, and then set again, we might // end up doing two dumps for one test. @@ -141,14 +138,23 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didStartProvisionalLoadForFrame( return S_OK; } +HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveServerRedirectForProvisionalLoadForFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) +{ + if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) + printf("%s - didReceiveServerRedirectForProvisionalLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); + + return S_OK; +} + HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailProvisionalLoadWithError( /* [in] */ IWebView *webView, /* [in] */ IWebError *error, /* [in] */ IWebFrame *frame) { if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didFailProvisionalLoadWithError\n", - descriptionSuitableForTestResult(frame).c_str()); + printf("%s - didFailProvisionalLoadWithError\n", descriptionSuitableForTestResult(frame).c_str()); return S_OK; } @@ -157,24 +163,22 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCommitLoadForFrame( /* [in] */ IWebView *webView, /* [in] */ IWebFrame *frame) { + if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) + printf("%s - didCommitLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); + COMPtr webViewPrivate; HRESULT hr = webView->QueryInterface(&webViewPrivate); if (FAILED(hr)) return hr; webViewPrivate->updateFocusedAndActiveState(); - if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didCommitLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); - - return S_OK; } HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveTitle( - /* [in] */ IWebView *webView, - /* [in] */ BSTR title, - /* [in] */ IWebFrame *frame) + /* [in] */ IWebView *webView, + /* [in] */ BSTR title, + /* [in] */ IWebFrame *frame) { if (::gLayoutTestController->dumpTitleChanges() && !done) printf("TITLE CHANGED: %S\n", title ? title : L""); @@ -183,15 +187,12 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didReceiveTitle( void FrameLoadDelegate::processWork() { - // quit doing work once a load is in progress - while (!topLoadingFrame && WorkQueue::shared()->count()) { - WorkQueueItem* item = WorkQueue::shared()->dequeue(); - ASSERT(item); - item->invoke(); - } + // if another load started, then wait for it to complete. + if (topLoadingFrame) + return; - // if we didn't start a new load, then we finished all the commands, so we're ready to dump state - if (!topLoadingFrame && !::gLayoutTestController->waitToDump()) + // if we finish all the commands, we're ready to dump state + if (WorkQueue::shared()->processWork() && !::gLayoutTestController->waitToDump()) dump(); } @@ -225,12 +226,11 @@ void FrameLoadDelegate::locationChangeDone(IWebError*, IWebFrame* frame) } HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishLoadForFrame( - /* [in] */ IWebView* webView, - /* [in] */ IWebFrame* frame) + /* [in] */ IWebView* webView, + /* [in] */ IWebFrame* frame) { if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) - printf("%s - didFinishLoadForFrame\n", - descriptionSuitableForTestResult(frame).c_str()); + printf("%s - didFinishLoadForFrame\n", descriptionSuitableForTestResult(frame).c_str()); locationChangeDone(0, frame); return S_OK; @@ -239,24 +239,52 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFinishLoadForFrame( HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFailLoadWithError( /* [in] */ IWebView* webView, /* [in] */ IWebError* error, - /* [in] */ IWebFrame* forFrame) + /* [in] */ IWebFrame* frame) { - locationChangeDone(error, forFrame); + if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) + printf("%s - didFailLoadWithError\n", descriptionSuitableForTestResult(frame).c_str()); + + locationChangeDone(error, frame); return S_OK; } +HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willPerformClientRedirectToURL( + /* [in] */ IWebView *webView, + /* [in] */ BSTR url, + /* [in] */ double delaySeconds, + /* [in] */ DATE fireDate, + /* [in] */ IWebFrame *frame) +{ + if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) + printf("%s - willPerformClientRedirectToURL: %S \n", descriptionSuitableForTestResult(frame).c_str(), + urlSuitableForTestResult(std::wstring(url, ::SysStringLen(url))).c_str()); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didCancelClientRedirectForFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) +{ + if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) + printf("%s - didCancelClientRedirectForFrame\n", descriptionSuitableForTestResult(frame).c_str()); + + return S_OK; +} + + HRESULT STDMETHODCALLTYPE FrameLoadDelegate::willCloseFrame( - /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didClearWindowObject( - /* [in] */ IWebView*webView, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject, - /* [in] */ IWebFrame* frame) + /* [in] */ IWebView*webView, + /* [in] */ JSContextRef context, + /* [in] */ JSObjectRef windowObject, + /* [in] */ IWebFrame* frame) { JSValueRef exception = 0; @@ -312,3 +340,9 @@ HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didHandleOnloadEventsForFrame( return S_OK; } +HRESULT STDMETHODCALLTYPE FrameLoadDelegate::didFirstVisuallyNonEmptyLayoutInFrame( + /* [in] */ IWebView *sender, + /* [in] */ IWebFrame *frame) +{ + return S_OK; +} diff --git a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h index 1a134fc..526e1b4 100644 --- a/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h +++ b/WebKitTools/DumpRenderTree/win/FrameLoadDelegate.h @@ -35,7 +35,7 @@ class AccessibilityController; class GCController; -class FrameLoadDelegate : public IWebFrameLoadDelegate2, public IWebFrameLoadDelegatePrivate { +class FrameLoadDelegate : public IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate { public: FrameLoadDelegate(); virtual ~FrameLoadDelegate(); @@ -54,7 +54,7 @@ public: virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } + /* [in] */ IWebFrame *frame); virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( /* [in] */ IWebView *webView, @@ -93,11 +93,11 @@ public: /* [in] */ BSTR url, /* [in] */ double delaySeconds, /* [in] */ DATE fireDate, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } + /* [in] */ IWebFrame *frame); virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( /* [in] */ IWebView *webView, - /* [in] */ IWebFrame *frame) { return E_NOTIMPL; } + /* [in] */ IWebFrame *frame); virtual HRESULT STDMETHODCALLTYPE willCloseFrame( /* [in] */ IWebView *webView, @@ -108,6 +108,12 @@ public: /* [in] */ JSContextRef context, /* [in] */ JSObjectRef windowObject) { return E_NOTIMPL; } + virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( + /* [in] */ IWebView* webView, + /* [in] */ JSContextRef context, + /* [in] */ JSObjectRef windowObject, + /* [in] */ IWebFrame* frame); + // IWebFrameLoadDelegatePrivate virtual HRESULT STDMETHODCALLTYPE didFinishDocumentLoadForFrame( /* [in] */ IWebView *sender, @@ -121,12 +127,9 @@ public: /* [in] */ IWebView *sender, /* [in] */ IWebFrame *frame); - // IWebFrameLoadDelegate2 - virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( - /* [in] */ IWebView* webView, - /* [in] */ JSContextRef context, - /* [in] */ JSObjectRef windowObject, - /* [in] */ IWebFrame* frame); + virtual HRESULT STDMETHODCALLTYPE didFirstVisuallyNonEmptyLayoutInFrame( + /* [in] */ IWebView *sender, + /* [in] */ IWebFrame *frame); protected: void locationChangeDone(IWebError*, IWebFrame*); diff --git a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp b/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp index 547aabc..b867250 100644 --- a/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/GCControllerWin.cpp @@ -32,11 +32,12 @@ #include "DumpRenderTree.h" #include #include +#include void GCController::collect() const { COMPtr collector; - if (FAILED(::CoCreateInstance(CLSID_WebJavaScriptCollector, 0, CLSCTX_ALL, IID_IWebJavaScriptCollector, (void**)&collector))) + if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) return; collector->collect(); } @@ -44,7 +45,7 @@ void GCController::collect() const void GCController::collectOnAlternateThread(bool waitUntilDone) const { COMPtr collector; - if (FAILED(::CoCreateInstance(CLSID_WebJavaScriptCollector, 0, CLSCTX_ALL, IID_IWebJavaScriptCollector, (void**)&collector))) + if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) return; collector->collectOnAlternateThread(waitUntilDone ? TRUE : FALSE); } @@ -52,7 +53,7 @@ void GCController::collectOnAlternateThread(bool waitUntilDone) const size_t GCController::getJSObjectCount() const { COMPtr collector; - if (FAILED(::CoCreateInstance(CLSID_WebJavaScriptCollector, 0, CLSCTX_ALL, IID_IWebJavaScriptCollector, (void**)&collector))) + if (FAILED(WebKitCreateInstance(CLSID_WebJavaScriptCollector, 0, IID_IWebJavaScriptCollector, (void**)&collector))) return 0; UINT objects = 0; collector->objectCount(&objects); diff --git a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj index c045026..8d79717 100644 --- a/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj +++ b/WebKitTools/DumpRenderTree/win/ImageDiff.vcproj @@ -1,230 +1,230 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp index 56d0a80..7a80bab 100644 --- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp +++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -120,6 +121,24 @@ JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name) return 0; } +void LayoutTestController::disableImageLoading() +{ + COMPtr webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr preferences; + if (FAILED(webView->preferences(&preferences))) + return; + + preferences->setLoadsImagesAutomatically(FALSE); +} + +void LayoutTestController::dispatchPendingLoadRequests() +{ + // FIXME: Implement for testing fix for 6727495 +} + void LayoutTestController::display() { displayWebView(); @@ -127,21 +146,26 @@ void LayoutTestController::display() void LayoutTestController::keepWebHistory() { - COMPtr history(Create, CLSID_WebHistory); - if (!history) + COMPtr history; + if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast(&history)))) return; - COMPtr sharedHistory(Create, CLSID_WebHistory); - if (!sharedHistory) + COMPtr sharedHistory; + if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(sharedHistory), reinterpret_cast(&sharedHistory)))) return; history->setOptionalSharedHistory(sharedHistory.get()); } +void LayoutTestController::waitForPolicyDelegate() +{ + // FIXME: Implement this. +} + size_t LayoutTestController::webHistoryItemCount() { - COMPtr history(Create, CLSID_WebHistory); - if (!history) + COMPtr history; + if (FAILED(WebKitCreateInstance(CLSID_WebHistory, 0, __uuidof(history), reinterpret_cast(&history)))) return 0; COMPtr sharedHistory; @@ -180,18 +204,6 @@ JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSSt return JSStringCreateWithCharacters(localPath.c_str(), localPath.length()); } -void LayoutTestController::queueBackNavigation(int howFarBack) -{ - // Same as on mac. This can be shared. - WorkQueue::shared()->queue(new BackItem(howFarBack)); -} - -void LayoutTestController::queueForwardNavigation(int howFarForward) -{ - // Same as on mac. This can be shared. - WorkQueue::shared()->queue(new ForwardItem(howFarForward)); -} - static wstring jsStringRefToWString(JSStringRef jsStr) { size_t length = JSStringGetLength(jsStr); @@ -230,16 +242,6 @@ void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target) WorkQueue::shared()->queue(new LoadItem(jsAbsoluteURL.get(), target)); } -void LayoutTestController::queueReload() -{ - WorkQueue::shared()->queue(new ReloadItem); -} - -void LayoutTestController::queueScript(JSStringRef script) -{ - WorkQueue::shared()->queue(new ScriptItem(script)); -} - void LayoutTestController::setAcceptsEditing(bool acceptsEditing) { COMPtr webView; @@ -285,7 +287,7 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis policyDelegate->setPermissive(permissive); webView->setPolicyDelegate(policyDelegate); } else - webView->setPolicyDelegate(NULL); + webView->setPolicyDelegate(0); } void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) @@ -293,7 +295,7 @@ void LayoutTestController::setIconDatabaseEnabled(bool iconDatabaseEnabled) // See also COMPtr iconDatabase; COMPtr tmpIconDatabase; - if (FAILED(CoCreateInstance(CLSID_WebIconDatabase, 0, CLSCTX_ALL, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) + if (FAILED(WebKitCreateInstance(CLSID_WebIconDatabase, 0, IID_IWebIconDatabase, (void**)&tmpIconDatabase))) return; if (FAILED(tmpIconDatabase->sharedIconDatabase(&iconDatabase))) return; @@ -319,7 +321,7 @@ void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled preferences->setPrivateBrowsingEnabled(privateBrowsingEnabled); } -void LayoutTestController::setPopupBlockingEnabled(bool privateBrowsingEnabled) +void LayoutTestController::setXSSAuditorEnabled(bool enabled) { COMPtr webView; if (FAILED(frame->webView(&webView))) @@ -329,7 +331,24 @@ void LayoutTestController::setPopupBlockingEnabled(bool privateBrowsingEnabled) if (FAILED(webView->preferences(&preferences))) return; - preferences->setJavaScriptCanOpenWindowsAutomatically(!privateBrowsingEnabled); + COMPtr prefsPrivate(Query, preferences); + if (!prefsPrivate) + return; + + prefsPrivate->setXSSAuditorEnabled(enabled); +} + +void LayoutTestController::setPopupBlockingEnabled(bool enabled) +{ + COMPtr webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr preferences; + if (FAILED(webView->preferences(&preferences))) + return; + + preferences->setJavaScriptCanOpenWindowsAutomatically(!enabled); } void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle) @@ -665,6 +684,11 @@ void LayoutTestController::execCommand(JSStringRef name, JSStringRef value) SysFreeString(valueBSTR); } +void LayoutTestController::setCacheModel(int) +{ + // FIXME: Implement +} + bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/) { printf("ERROR: LayoutTestController::isCommandEnabled() not implemented\n"); @@ -673,7 +697,14 @@ bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/) void LayoutTestController::clearAllDatabases() { - printf("ERROR: LayoutTestController::clearAllDatabases() not implemented\n"); + COMPtr databaseManager; + COMPtr tmpDatabaseManager; + if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) + return; + if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) + return; + + databaseManager->deleteAllDatabases(); } void LayoutTestController::setDatabaseQuota(unsigned long long quota) diff --git a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp b/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp index 3c1cf95..b0c76d6 100644 --- a/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp +++ b/WebKitTools/DumpRenderTree/win/PixelDumpSupportWin.cpp @@ -27,10 +27,20 @@ */ #include "config.h" + +#if PLATFORM(CG) #include "PixelDumpSupportCG.h" +#elif PLATFORM(CAIRO) +#include "PixelDumpSupportCairo.h" +#endif #include "DumpRenderTree.h" + +#if PLATFORM(CG) +// Note: Must be included *after* DumpRenderTree.h to avoid compile error. #include +#endif + #include #include @@ -60,9 +70,16 @@ PassRefPtr createBitmapContextFromWebView(bool onscreen, bool inc GetObject(bitmap, sizeof(info), &info); ASSERT(info.bmBitsPixel == 32); +#if PLATFORM(CG) RetainPtr colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB()); CGContextRef context = CGBitmapContextCreate(info.bmBits, info.bmWidth, info.bmHeight, 8, info.bmWidthBytes, colorSpace.get(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst); +#elif PLATFORM(CAIRO) + cairo_surface_t* image = cairo_image_surface_create_for_data((unsigned char*)info.bmBits, CAIRO_FORMAT_ARGB32, + info.bmWidth, info.bmHeight, info.bmWidthBytes); + cairo_t* context = cairo_create(image); + cairo_surface_destroy(image); +#endif - return BitmapContext::createByAdoptingBitmapAndContext(bitmap, context); + return BitmapContext::createByAdoptingBitmapAndContext(bitmap, context); } diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp b/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp index 4b6ab10..7d87c45 100644 --- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/PolicyDelegate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,14 +30,34 @@ #include "PolicyDelegate.h" #include "DumpRenderTree.h" - +#include "LayoutTestController.h" #include using std::wstring; +static wstring dumpPath(IDOMNode* node) +{ + ASSERT(node); + + wstring result; + + BSTR name; + if (FAILED(node->nodeName(&name))) + return result; + result.assign(name, SysStringLen(name)); + SysFreeString(name); + + COMPtr parent; + if (SUCCEEDED(node->parentNode(&parent))) + result += TEXT(" > ") + dumpPath(parent.get()); + + return result; +} + PolicyDelegate::PolicyDelegate() : m_refCount(1) , m_permissiveDelegate(false) + , m_controllerToNotifyDone(0) { } @@ -79,6 +99,7 @@ HRESULT STDMETHODCALLTYPE PolicyDelegate::decidePolicyForNavigationAction( { BSTR url; request->URL(&url); + wstring wurl = urlSuitableForTestResult(wstring(url, SysStringLen(url))); int navType = 0; VARIANT var; @@ -87,31 +108,43 @@ HRESULT STDMETHODCALLTYPE PolicyDelegate::decidePolicyForNavigationAction( navType = V_I4(&var); } - const char* typeDescription; + LPCTSTR typeDescription; switch (navType) { case WebNavigationTypeLinkClicked: - typeDescription = "link clicked"; + typeDescription = TEXT("link clicked"); break; case WebNavigationTypeFormSubmitted: - typeDescription = "form submitted"; + typeDescription = TEXT("form submitted"); break; case WebNavigationTypeBackForward: - typeDescription = "back/forward"; + typeDescription = TEXT("back/forward"); break; case WebNavigationTypeReload: - typeDescription = "reload"; + typeDescription = TEXT("reload"); break; case WebNavigationTypeFormResubmitted: - typeDescription = "form resubmitted"; + typeDescription = TEXT("form resubmitted"); break; case WebNavigationTypeOther: - typeDescription = "other"; + typeDescription = TEXT("other"); break; default: - typeDescription = "illegal value"; + typeDescription = TEXT("illegal value"); } - - printf("Policy delegate: attempt to load %S with navigation type '%s'\n", url ? url : TEXT(""), typeDescription); + + wstring message = TEXT("Policy delegate: attempt to load ") + wurl + TEXT(" with navigation type '") + typeDescription + TEXT("'"); + + VARIANT actionElementVar; + if (SUCCEEDED(actionInformation->Read(WebActionElementKey, &actionElementVar, 0))) { + COMPtr actionElement(Query, V_UNKNOWN(&actionElementVar)); + VARIANT originatingNodeVar; + if (SUCCEEDED(actionElement->Read(WebElementDOMNodeKey, &originatingNodeVar, 0))) { + COMPtr originatingNode(Query, V_UNKNOWN(&originatingNodeVar)); + message += TEXT(" originating from ") + dumpPath(originatingNode.get()); + } + } + + printf("%S\n", message.c_str()); SysFreeString(url); @@ -120,5 +153,35 @@ HRESULT STDMETHODCALLTYPE PolicyDelegate::decidePolicyForNavigationAction( else listener->ignore(); + if (m_controllerToNotifyDone) { + m_controllerToNotifyDone->notifyDone(); + m_controllerToNotifyDone = 0; + } + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE PolicyDelegate::unableToImplementPolicyWithError( + /*[in]*/ IWebView* /*webView*/, + /*[in]*/ IWebError* error, + /*[in]*/ IWebFrame* frame) +{ + BSTR domainStr; + error->domain(&domainStr); + wstring domainMessage = domainStr; + + int code; + error->code(&code); + + BSTR frameName; + frame->name(&frameName); + wstring frameNameMessage = frameName; + + printf("Policy delegate: unable to implement policy with error domain '%S', error code %d, in frame '%S'", domainMessage.c_str(), code, frameNameMessage.c_str()); + + SysFreeString(domainStr); + SysFreeString(frameName); + return S_OK; } diff --git a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h b/WebKitTools/DumpRenderTree/win/PolicyDelegate.h index 29574ee..c808dc9 100644 --- a/WebKitTools/DumpRenderTree/win/PolicyDelegate.h +++ b/WebKitTools/DumpRenderTree/win/PolicyDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,6 +31,8 @@ #include +class LayoutTestController; + class PolicyDelegate : public IWebPolicyDelegate { public: PolicyDelegate(); @@ -65,14 +67,16 @@ public: virtual HRESULT STDMETHODCALLTYPE unableToImplementPolicyWithError( /* [in] */ IWebView *webView, /* [in] */ IWebError *error, - /* [in] */ IWebFrame *frame){ return E_NOTIMPL; } + /* [in] */ IWebFrame *frame); // PolicyDelegate void setPermissive(bool permissive) { m_permissiveDelegate = permissive; } + void setControllerToNotifyDone(LayoutTestController* controller) { m_controllerToNotifyDone = controller; } private: ULONG m_refCount; bool m_permissiveDelegate; + LayoutTestController* m_controllerToNotifyDone; }; #endif // PolicyDelegate_h diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp index 9c89614..06476e7 100644 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.cpp @@ -87,8 +87,15 @@ static wstring descriptionSuitableForTestResult(IWebURLRequest* request) wstring mainDocumentURL = urlSuitableForTestResult(wstringFromBSTR(mainDocumentURLBSTR)); ::SysFreeString(mainDocumentURLBSTR); + + BSTR httpMethodBSTR; + if (FAILED(request->HTTPMethod(&httpMethodBSTR))) + return wstring(); + + wstring httpMethod = wstringFromBSTR(httpMethodBSTR); + ::SysFreeString(httpMethodBSTR); - return L""; + return L""; } static wstring descriptionSuitableForTestResult(IWebURLResponse* response) @@ -103,7 +110,12 @@ static wstring descriptionSuitableForTestResult(IWebURLResponse* response) wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); ::SysFreeString(urlBSTR); - return L""; + int statusCode = 0; + COMPtr httpResponse; + if (response && SUCCEEDED(response->QueryInterface(&httpResponse))) + httpResponse->statusCode(&statusCode); + + return L""; } static wstring descriptionSuitableForTestResult(IWebError* error, unsigned long identifier) @@ -228,11 +240,50 @@ HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::willSendRequest( descriptionSuitableForTestResult(redirectResponse).c_str()); } + if (!done && gLayoutTestController->willSendRequestReturnsNullOnRedirect() && redirectResponse) { + printf("Returning null for this redirect\n"); + *newRequest = 0; + return S_OK; + } + request->AddRef(); *newRequest = request; return S_OK; } +HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didReceiveResponse( + /* [in] */ IWebView* webView, + /* [in] */ unsigned long identifier, + /* [in] */ IWebURLResponse* response, + /* [in] */ IWebDataSource* dataSource) +{ + if (!done && gLayoutTestController->dumpResourceLoadCallbacks()) { + printf("%S - didReceiveResponse %S\n", + descriptionSuitableForTestResult(identifier).c_str(), + descriptionSuitableForTestResult(response).c_str()); + } + if (!done && gLayoutTestController->dumpResourceResponseMIMETypes()) { + BSTR mimeTypeBSTR; + if (FAILED(response->MIMEType(&mimeTypeBSTR))) + E_FAIL; + + wstring mimeType = wstringFromBSTR(mimeTypeBSTR); + ::SysFreeString(mimeTypeBSTR); + + BSTR urlBSTR; + if (FAILED(response->URL(&urlBSTR))) + E_FAIL; + + wstring url = urlSuitableForTestResult(wstringFromBSTR(urlBSTR)); + ::SysFreeString(urlBSTR); + + printf("%S has MIME type %S\n", url.c_str(), mimeType.c_str()); + } + + return S_OK; +} + + HRESULT STDMETHODCALLTYPE ResourceLoadDelegate::didFinishLoadingFromDataSource( /* [in] */ IWebView* webView, /* [in] */ unsigned long identifier, diff --git a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h index e259adc..c708147 100644 --- a/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h +++ b/WebKitTools/DumpRenderTree/win/ResourceLoadDelegate.h @@ -72,7 +72,7 @@ public: /* [in] */ IWebView *webView, /* [in] */ unsigned long identifier, /* [in] */ IWebURLResponse *response, - /* [in] */ IWebDataSource *dataSource) { return E_NOTIMPL; } + /* [in] */ IWebDataSource *dataSource); virtual HRESULT STDMETHODCALLTYPE didReceiveContentLength( /* [in] */ IWebView *webView, diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def index 92cdb12..ac41e7e 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.def @@ -1,4 +1,4 @@ -LIBRARY "TestNetscapePlugin" +LIBRARY "npTestNetscapePlugin" EXPORTS NP_GetEntryPoints @1 diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj index eced57e..5ccd6ce 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin.vcproj @@ -41,6 +41,7 @@ Name="VCCLCompilerTool" AdditionalIncludeDirectories=""$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(ProjectDir)..\..\TestNetscapePlugin.subproj";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility"" PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf" + DisableSpecificWarnings="4819" /> + + diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin_debug.def b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin_debug.def new file mode 100644 index 0000000..158fb7c --- /dev/null +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/TestNetscapePlugin_debug.def @@ -0,0 +1,6 @@ +LIBRARY "npTestNetscapePlugin_debug" + +EXPORTS + NP_GetEntryPoints @1 + NP_Initialize @2 + NP_Shutdown @3 diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c deleted file mode 100644 index 829a32c..0000000 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginObject.h" - -#include - -extern "C" -NPError __stdcall NP_Initialize(NPNetscapeFuncs* browserFuncs) -{ - browser = browserFuncs; - return NPERR_NO_ERROR; -} - -extern "C" -NPError __stdcall NP_GetEntryPoints(NPPluginFuncs* pluginFuncs) -{ - pluginFuncs->version = 11; - pluginFuncs->size = sizeof(pluginFuncs); - pluginFuncs->newp = NPP_New; - pluginFuncs->destroy = NPP_Destroy; - pluginFuncs->setwindow = NPP_SetWindow; - pluginFuncs->newstream = NPP_NewStream; - pluginFuncs->destroystream = NPP_DestroyStream; - pluginFuncs->asfile = NPP_StreamAsFile; - pluginFuncs->writeready = NPP_WriteReady; - pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; - pluginFuncs->print = NPP_Print; - pluginFuncs->event = NPP_HandleEvent; - pluginFuncs->urlnotify = NPP_URLNotify; - pluginFuncs->getvalue = NPP_GetValue; - pluginFuncs->setvalue = NPP_SetValue; - - return NPERR_NO_ERROR; -} - - -extern "C" -NPError __stdcall NP_Shutdown() -{ - return NPERR_NO_ERROR; -} - - -NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved) -{ - if (browser->version >= 14) { - PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass()); - - obj->onStreamLoad = NULL; - - for (int16 i = 0; i < argc; i++) { - if (_stricmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) - obj->onStreamLoad = _strdup(argv[i]); - } - - instance->pdata = obj; - } - - return NPERR_NO_ERROR; -} - -NPError NPP_Destroy(NPP instance, NPSavedData **save) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - if (obj) { - if (obj->onStreamLoad) - free(obj->onStreamLoad); - - if (obj->logDestroy) - printf("PLUGIN: NPP_Destroy\n"); - - browser->releaseobject(&obj->header); - } - return NPERR_NO_ERROR; -} - -NPError NPP_SetWindow(NPP instance, NPWindow *window) -{ - return NPERR_NO_ERROR; -} - -NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype) -{ - PluginObject* obj = (PluginObject*)instance->pdata; - obj->stream = stream; - *stype = NP_ASFILEONLY; - - if (obj->onStreamLoad) { - NPObject *windowScriptObject; - browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); - - NPString script; - script.UTF8Characters = obj->onStreamLoad; - script.UTF8Length = strlen(obj->onStreamLoad); - - NPVariant browserResult; - browser->evaluate(obj->npp, windowScriptObject, &script, &browserResult); - browser->releasevariantvalue(&browserResult); - } - - return NPERR_NO_ERROR; -} - -NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) -{ - return NPERR_NO_ERROR; -} - -int32 NPP_WriteReady(NPP instance, NPStream *stream) -{ - return 0; -} - -int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer) -{ - return 0; -} - -void NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname) -{ -} - -void NPP_Print(NPP instance, NPPrint *platformPrint) -{ -} - -int16 NPP_HandleEvent(NPP instance, void *event) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - if (!obj->eventLogging) - return 0; - - // FIXME: Implement this - return 0; -} - -void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData) -{ - PluginObject *obj = (PluginObject*)instance->pdata; - - handleCallback(obj, url, reason, notifyData); -} - -NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value) -{ - if (variable == NPPVpluginScriptableNPObject) { - void **v = (void **)value; - PluginObject *obj = (PluginObject*)instance->pdata; - // Return value is expected to be retained - browser->retainobject((NPObject *)obj); - *v = obj; - return NPERR_NO_ERROR; - } - return NPERR_GENERIC_ERROR; -} - -NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) -{ - return NPERR_GENERIC_ERROR; -} diff --git a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp index ab54872..7175d33 100644 --- a/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp +++ b/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp @@ -84,6 +84,11 @@ 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], "logSrc") == 0) { + for (int i = 0; i < argc; i++) + if (_stricmp(argn[i], "src") == 0) + pluginLog(instance, "src: %s", argv[i]); + } } instance->pdata = obj; diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp index a2532a5..63f5441 100755 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.cpp +++ b/WebKitTools/DumpRenderTree/win/UIDelegate.cpp @@ -176,10 +176,6 @@ HRESULT STDMETHODCALLTYPE UIDelegate::QueryInterface(REFIID riid, void** ppvObje *ppvObject = static_cast(this); else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate)) *ppvObject = static_cast(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate2)) - *ppvObject = static_cast(this); - else if (IsEqualGUID(riid, IID_IWebUIDelegatePrivate3)) - *ppvObject = static_cast(this); else return E_NOINTERFACE; @@ -274,6 +270,142 @@ HRESULT STDMETHODCALLTYPE UIDelegate::canRedo( return S_OK; } +HRESULT STDMETHODCALLTYPE UIDelegate::printFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::ftpDirectoryTemplatePath( + /* [in] */ IWebView *webView, + /* [retval][out] */ BSTR *path) +{ + if (!path) + return E_POINTER; + *path = 0; + return E_NOTIMPL; +} + + +HRESULT STDMETHODCALLTYPE UIDelegate::webViewHeaderHeight( + /* [in] */ IWebView *webView, + /* [retval][out] */ float *result) +{ + if (!result) + return E_POINTER; + *result = 0; + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::webViewFooterHeight( + /* [in] */ IWebView *webView, + /* [retval][out] */ float *result) +{ + if (!result) + return E_POINTER; + *result = 0; + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::drawHeaderInRect( + /* [in] */ IWebView *webView, + /* [in] */ RECT *rect, + /* [in] */ OLE_HANDLE drawingContext) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::drawFooterInRect( + /* [in] */ IWebView *webView, + /* [in] */ RECT *rect, + /* [in] */ OLE_HANDLE drawingContext, + /* [in] */ UINT pageIndex, + /* [in] */ UINT pageCount) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::webViewPrintingMarginRect( + /* [in] */ IWebView *webView, + /* [retval][out] */ RECT *rect) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::canRunModal( + /* [in] */ IWebView *webView, + /* [retval][out] */ BOOL *canRunBoolean) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::createModalDialog( + /* [in] */ IWebView *sender, + /* [in] */ IWebURLRequest *request, + /* [retval][out] */ IWebView **newWebView) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::runModal( + /* [in] */ IWebView *webView) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::isMenuBarVisible( + /* [in] */ IWebView *webView, + /* [retval][out] */ BOOL *visible) +{ + if (!visible) + return E_POINTER; + *visible = false; + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::setMenuBarVisible( + /* [in] */ IWebView *webView, + /* [in] */ BOOL visible) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::runDatabaseSizeLimitPrompt( + /* [in] */ IWebView *webView, + /* [in] */ BSTR displayName, + /* [in] */ IWebFrame *initiatedByFrame, + /* [retval][out] */ BOOL *allowed) +{ + if (!allowed) + return E_POINTER; + *allowed = false; + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollbar( + /* [in] */ IWebView *webView, + /* [in] */ HDC hDC, + /* [in] */ RECT rect, + /* [in] */ WebScrollBarControlSize size, + /* [in] */ WebScrollbarControlState state, + /* [in] */ WebScrollbarControlPart pressedPart, + /* [in] */ BOOL vertical, + /* [in] */ float value, + /* [in] */ float proportion, + /* [in] */ WebScrollbarControlPartMask parts) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::paintCustomScrollCorner( + /* [in] */ IWebView *webView, + /* [in] */ HDC hDC, + /* [in] */ RECT rect) +{ + return E_NOTIMPL; +} + HRESULT STDMETHODCALLTYPE UIDelegate::setFrame( /* [in] */ IWebView* /*sender*/, /* [in] */ RECT* frame) @@ -435,6 +567,36 @@ HRESULT STDMETHODCALLTYPE UIDelegate::exceededDatabaseQuota( return S_OK; } +HRESULT STDMETHODCALLTYPE UIDelegate::embeddedViewWithArguments( + /* [in] */ IWebView *sender, + /* [in] */ IWebFrame *frame, + /* [in] */ IPropertyBag *arguments, + /* [retval][out] */ IWebEmbeddedView **view) +{ + if (!view) + return E_POINTER; + *view = 0; + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::webViewClosing( + /* [in] */ IWebView *sender) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::webViewSetCursor( + /* [in] */ IWebView *sender, + /* [in] */ OLE_HANDLE cursor) +{ + return E_NOTIMPL; +} + +HRESULT STDMETHODCALLTYPE UIDelegate::webViewDidInvalidate( + /* [in] */ IWebView *sender) +{ + return E_NOTIMPL; +} HRESULT STDMETHODCALLTYPE UIDelegate::setStatusText(IWebView*, BSTR text) { diff --git a/WebKitTools/DumpRenderTree/win/UIDelegate.h b/WebKitTools/DumpRenderTree/win/UIDelegate.h index 2113957..853031f 100755 --- a/WebKitTools/DumpRenderTree/win/UIDelegate.h +++ b/WebKitTools/DumpRenderTree/win/UIDelegate.h @@ -35,7 +35,7 @@ class DRTUndoManager; -class UIDelegate : public IWebUIDelegate, IWebUIDelegatePrivate3 { +class UIDelegate : public IWebUIDelegate, IWebUIDelegatePrivate { public: UIDelegate(); @@ -186,7 +186,8 @@ public: /* [in] */ IWebView *webView, /* [in] */ WebDragSourceAction action, /* [in] */ LPPOINT point, - /* [in] */ IDataObject *pasteboard) { return E_NOTIMPL; } + /* [in] */ IDataObject *pasteboard, + /* [retval][out] */ IDataObject **newPasteboard) { return E_NOTIMPL; } virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected( /* [in] */ IWebView *sender, @@ -247,6 +248,81 @@ public: virtual HRESULT STDMETHODCALLTYPE canRedo( /* [retval][out] */ BOOL *result); + virtual HRESULT STDMETHODCALLTYPE printFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame); + + virtual HRESULT STDMETHODCALLTYPE ftpDirectoryTemplatePath( + /* [in] */ IWebView *webView, + /* [retval][out] */ BSTR *path); + + virtual HRESULT STDMETHODCALLTYPE webViewHeaderHeight( + /* [in] */ IWebView *webView, + /* [retval][out] */ float *result); + + virtual HRESULT STDMETHODCALLTYPE webViewFooterHeight( + /* [in] */ IWebView *webView, + /* [retval][out] */ float *result); + + virtual HRESULT STDMETHODCALLTYPE drawHeaderInRect( + /* [in] */ IWebView *webView, + /* [in] */ RECT *rect, + /* [in] */ OLE_HANDLE drawingContext); + + virtual HRESULT STDMETHODCALLTYPE drawFooterInRect( + /* [in] */ IWebView *webView, + /* [in] */ RECT *rect, + /* [in] */ OLE_HANDLE drawingContext, + /* [in] */ UINT pageIndex, + /* [in] */ UINT pageCount); + + virtual HRESULT STDMETHODCALLTYPE webViewPrintingMarginRect( + /* [in] */ IWebView *webView, + /* [retval][out] */ RECT *rect); + + virtual HRESULT STDMETHODCALLTYPE canRunModal( + /* [in] */ IWebView *webView, + /* [retval][out] */ BOOL *canRunBoolean); + + virtual HRESULT STDMETHODCALLTYPE createModalDialog( + /* [in] */ IWebView *sender, + /* [in] */ IWebURLRequest *request, + /* [retval][out] */ IWebView **newWebView); + + virtual HRESULT STDMETHODCALLTYPE runModal( + /* [in] */ IWebView *webView); + + virtual HRESULT STDMETHODCALLTYPE isMenuBarVisible( + /* [in] */ IWebView *webView, + /* [retval][out] */ BOOL *visible); + + virtual HRESULT STDMETHODCALLTYPE setMenuBarVisible( + /* [in] */ IWebView *webView, + /* [in] */ BOOL visible); + + virtual HRESULT STDMETHODCALLTYPE runDatabaseSizeLimitPrompt( + /* [in] */ IWebView *webView, + /* [in] */ BSTR displayName, + /* [in] */ IWebFrame *initiatedByFrame, + /* [retval][out] */ BOOL *allowed); + + virtual HRESULT STDMETHODCALLTYPE paintCustomScrollbar( + /* [in] */ IWebView *webView, + /* [in] */ HDC hDC, + /* [in] */ RECT rect, + /* [in] */ WebScrollBarControlSize size, + /* [in] */ WebScrollbarControlState state, + /* [in] */ WebScrollbarControlPart pressedPart, + /* [in] */ BOOL vertical, + /* [in] */ float value, + /* [in] */ float proportion, + /* [in] */ WebScrollbarControlPartMask parts); + + virtual HRESULT STDMETHODCALLTYPE paintCustomScrollCorner( + /* [in] */ IWebView *webView, + /* [in] */ HDC hDC, + /* [in] */ RECT rect); + protected: // IWebUIDelegatePrivate @@ -298,19 +374,31 @@ protected: /* [in] */ UINT keyCode, /* [retval][out] */ LONG_PTR *code); - // IWebUIDelegatePrivate2 - virtual HRESULT STDMETHODCALLTYPE webViewPainted( /* [in] */ IWebView *sender); - // IWebUIDelegatePrivate3 - virtual HRESULT STDMETHODCALLTYPE exceededDatabaseQuota( /* [in] */ IWebView *sender, /* [in] */ IWebFrame *frame, /* [in] */ IWebSecurityOrigin *origin, /* [in] */ BSTR databaseIdentifier); + virtual HRESULT STDMETHODCALLTYPE embeddedViewWithArguments( + /* [in] */ IWebView *sender, + /* [in] */ IWebFrame *frame, + /* [in] */ IPropertyBag *arguments, + /* [retval][out] */ IWebEmbeddedView **view); + + virtual HRESULT STDMETHODCALLTYPE webViewClosing( + /* [in] */ IWebView *sender); + + virtual HRESULT STDMETHODCALLTYPE webViewSetCursor( + /* [in] */ IWebView *sender, + /* [in] */ OLE_HANDLE cursor); + + virtual HRESULT STDMETHODCALLTYPE webViewDidInvalidate( + /* [in] */ IWebView *sender); + ULONG m_refCount; private: diff --git a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp index a489498..7c60d3d 100644 --- a/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp +++ b/WebKitTools/DumpRenderTree/win/WorkQueueItemWin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ #include "DumpRenderTree.h" #include #include +#include #include #include #include @@ -50,9 +51,9 @@ static wstring jsStringRefToWString(JSStringRef jsStr) return buffer.data(); } -void LoadItem::invoke() const +bool LoadItem::invoke() const { - wstring targetString = jsStringRefToWString(target()); + wstring targetString = jsStringRefToWString(m_target.get()); COMPtr targetFrame; if (targetString.empty()) @@ -62,73 +63,80 @@ void LoadItem::invoke() const bool failed = FAILED(frame->findFrameNamed(targetBSTR, &targetFrame)); SysFreeString(targetBSTR); if (failed) - return; + return false; } COMPtr request; - if (FAILED(CoCreateInstance(CLSID_WebURLRequest, 0, CLSCTX_ALL, IID_IWebURLRequest, (void**)&request))) - return; + if (FAILED(WebKitCreateInstance(CLSID_WebURLRequest, 0, IID_IWebURLRequest, (void**)&request))) + return false; - wstring urlString = jsStringRefToWString(url()); + wstring urlString = jsStringRefToWString(m_url.get()); BSTR urlBSTR = SysAllocString(urlString.c_str()); bool failed = FAILED(request->initWithURL(urlBSTR, WebURLRequestUseProtocolCachePolicy, 60)); SysFreeString(urlBSTR); if (failed) - return; + return false; targetFrame->loadRequest(request.get()); + return true; } -void ReloadItem::invoke() const +bool ReloadItem::invoke() const { COMPtr webView; if (FAILED(frame->webView(&webView))) - return; + return false; COMPtr webActions; - if (SUCCEEDED(webView->QueryInterface(&webActions))) - webActions->reload(0); + if (FAILED(webView->QueryInterface(&webActions))) + return false; + + webActions->reload(0); + return true; } -void ScriptItem::invoke() const +bool ScriptItem::invoke() const { COMPtr webView; if (FAILED(frame->webView(&webView))) - return; + return false; - wstring scriptString = jsStringRefToWString(script()); + wstring scriptString = jsStringRefToWString(m_script.get()); BSTR result; BSTR scriptBSTR = SysAllocString(scriptString.c_str()); webView->stringByEvaluatingJavaScriptFromString(scriptBSTR, &result); SysFreeString(result); SysFreeString(scriptBSTR); + + return true; } -void BackForwardItem::invoke() const +bool BackForwardItem::invoke() const { COMPtr webView; if (FAILED(frame->webView(&webView))) - return; + return false; BOOL result; if (m_howFar == 1) { webView->goForward(&result); - return; + return true; } if (m_howFar == -1) { webView->goBack(&result); - return; + return true; } COMPtr bfList; if (FAILED(webView->backForwardList(&bfList))) - return; + return false; COMPtr item; if (FAILED(bfList->itemAtIndex(m_howFar, &item))) - return; + return false; webView->goToBackForwardItem(item.get(), &result); + return true; } -- cgit v1.1