Fix <rdar://5133816> keepWebHistory is not implemented
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Nov 2007 20:51:09 +0000 (20:51 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Nov 2007 20:51:09 +0000 (20:51 +0000)
 WebCore:

         Add wrappers around CoCreateInstance to COMPtr

         I followed the example of the Query constructor and query method by
         adding a Create constructor and create method.

         Reviewed by Darin.

         * platform/win/COMPtr.h:
         (COMPtr::COMPtr): Added a new constructor that calls
         CoCreateInstance.
         (COMPtr::create): Added.
         (COMPtr::createInstance): Added.

 WebKitTools:

         Fix <rdar://5133816> keepWebHistory is not implemented

         Fixes fast/history/clicked-link-is-visited.html.

         Reviewed by Darin.

         * DumpRenderTree/win/DumpRenderTree.cpp:
         (runTest): Clear the optionalSharedHistory.
         * DumpRenderTree/win/LayoutTestControllerWin.cpp:
         (LayoutTestController::keepWebHistory): Set the optionalSharedHistory.

 LayoutTests:

         Remove a now-passing test from the Windows Skipped file

         Reviewed by Darin.

         * platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27691 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/win/Skipped
WebCore/ChangeLog
WebCore/platform/win/COMPtr.h
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

index 5a77f61..75c3508 100644 (file)
@@ -1,3 +1,11 @@
+2007-11-11  Adam Roben  <aroben@apple.com>
+
+        Remove a now-passing test from the Windows Skipped file
+
+        Reviewed by Darin.
+
+        * platform/win/Skipped:
+
 2007-11-10  Darin Adler  <darin@apple.com>
 
         * platform/win/fast/dom/Window/window-properties-expected.txt: Update for
index 07c406e..6442c94 100644 (file)
@@ -336,9 +336,6 @@ fast/frames/iframe-window-focus.html
 # fast/frames/frame-src-attribute.html fails on boomer <rdar://problem/5134044>
 fast/frames/frame-src-attribute.html
 
-# keepWebHistory is not implemented in DRT in boomer <rdar://problem/5133816>
-fast/history/clicked-link-is-visited.html
-
 # fast/html/keygen.html is failing on boomer <rdar://problem/5133799>
 fast/html/keygen.html
 fast/invalid/residual-style.html
index 47a76f5..cf72067 100644 (file)
@@ -1,3 +1,18 @@
+2007-11-11  Adam Roben  <aroben@apple.com>
+
+        Add wrappers around CoCreateInstance to COMPtr
+
+        I followed the example of the Query constructor and query method by
+        adding a Create constructor and create method.
+
+        Reviewed by Darin.
+
+        * platform/win/COMPtr.h:
+        (COMPtr::COMPtr): Added a new constructor that calls
+        CoCreateInstance.
+        (COMPtr::create): Added.
+        (COMPtr::createInstance): Added.
+
 2007-11-11  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Darin.
index 76423b6..4fb6fbb 100644 (file)
@@ -40,6 +40,7 @@ typedef long HRESULT;
 
 enum AdoptCOMTag { AdoptCOM };
 enum QueryTag { Query };
+enum CreateTag { Create };
 
 template <typename T> class COMPtr {
 public:
@@ -51,6 +52,8 @@ public:
     inline COMPtr(QueryTag, IUnknown* ptr) : m_ptr(copyQueryInterfaceRef(ptr)) { }
     template <typename U> inline COMPtr(QueryTag, const COMPtr<U>& ptr) : m_ptr(copyQueryInterfaceRef(ptr.get())) { }
 
+    inline COMPtr(CreateTag, const IID& clsid) : m_ptr(createInstance(clsid)) { }
+
     ~COMPtr() { if (m_ptr) m_ptr->Release(); }
 
     T* get() const { return m_ptr; }
@@ -70,19 +73,30 @@ public:
     COMPtr& operator=(const COMPtr&);
     COMPtr& operator=(T*);
     template <typename U> COMPtr& operator=(const COMPtr<U>&);
-  
+
     void query(IUnknown* ptr) { adoptRef(copyQueryInterfaceRef(ptr)); }
     template <typename U> inline void query(const COMPtr<U>& ptr) { query(ptr.get()); }
 
+    void create(const IID& clsid) { adoptRef(createInstance(clsid)); }
+
     template <typename U> HRESULT copyRefTo(U**);
     void adoptRef(T*);
 
 private:
     static T* copyQueryInterfaceRef(IUnknown*);
+    static T* createInstance(const IID& clsid);
 
     T* m_ptr;
 };
 
+template <typename T> inline T* COMPtr<T>::createInstance(const IID& clsid)
+{
+    T* result;
+    if (FAILED(CoCreateInstance(clsid, 0, CLSCTX_ALL, __uuidof(result), reinterpret_cast<void**>(&result))))
+        return 0;
+    return result;
+}
+
 template <typename T> inline T* COMPtr<T>::copyQueryInterfaceRef(IUnknown* ptr)
 {
     if (!ptr)
index cee0a64..bf8aeef 100644 (file)
@@ -1,3 +1,16 @@
+2007-11-11  Adam Roben  <aroben@apple.com>
+
+        Fix <rdar://5133816> keepWebHistory is not implemented
+
+        Fixes fast/history/clicked-link-is-visited.html.
+
+        Reviewed by Darin.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (runTest): Clear the optionalSharedHistory.
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::keepWebHistory): Set the optionalSharedHistory.
+
 2007-11-10  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Tim Hatcher.
index cdd849d..49d3bb7 100644 (file)
@@ -602,6 +602,10 @@ static void runTest(const char* pathOrURL)
     topLoadingFrame = 0;
     timedOut = false;
 
+    COMPtr<IWebHistory> history(Create, CLSID_WebHistory);
+    if (history)
+        history->setOptionalSharedHistory(0);
+
     prevTestBFItem = 0;
     COMPtr<IWebView> webView;
     if (SUCCEEDED(frame->webView(&webView))) {
index 79e3727..d4187c5 100644 (file)
@@ -40,7 +40,9 @@
 #include <JavaScriptCore/Assertions.h>
 #include <JavaScriptCore/JavaScriptCore.h>
 #include <JavaScriptCore/JSRetainPtr.h>
+#include <WebKit/IWebHistory.h>
 #include <WebKit/IWebViewPrivate.h>
+#include <WebKit/WebKit.h>
 #include <string>
 #include <CoreFoundation/CoreFoundation.h>
 
@@ -120,7 +122,15 @@ void LayoutTestController::display()
 
 void LayoutTestController::keepWebHistory()
 {
-    // FIXME: Implement!
+    COMPtr<IWebHistory> history(Create, CLSID_WebHistory);
+    if (!history)
+        return;
+
+    COMPtr<IWebHistory> sharedHistory(Create, CLSID_WebHistory);
+    if (!sharedHistory)
+        return;
+
+    history->setOptionalSharedHistory(sharedHistory.get());
 }
 
 void LayoutTestController::notifyDone()