[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
beidson at apple.com
beidson at apple.com
Thu Oct 29 20:36:38 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit b0b8ef703549e0ede7beb33e76223b8e93d8d9ed
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 30 01:35:33 2009 +0000
WebKit Mac API should provide a delegate interface for global history.
<rdar://problem/7042773> and https://webkit.org/b/29904
Reviewed by John Sullivan.
WebKit:
* WebKit.xcodeproj/project.pbxproj:
WebKit/mac:
* WebView/WebHistoryDelegate.h: Added. New interface for WebKit clients to implement to manage
their own global history store.
Object to store all of the bits of data relevant to a page visit:
* WebView/WebNavigationData.h: Added.
* WebView/WebNavigationData.mm: Added.
(-[WebNavigationDataPrivate dealloc]):
(-[WebNavigationData initWithURLString:title:originalRequest:response:hasSubstituteData:clientRedirectSource:]):
(-[WebNavigationData url]):
(-[WebNavigationData title]):
(-[WebNavigationData originalRequest]):
(-[WebNavigationData response]):
(-[WebNavigationData hasSubstituteData]):
(-[WebNavigationData clientRedirectSource]):
(-[WebNavigationData dealloc]):
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::updateGlobalHistory): If the delegate exists, don't use the built-in WebHistory.
If the implementation for this method exists, call it.
(WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Ditto
* WebView/WebDelegateImplementationCaching.h:
* WebView/WebDelegateImplementationCaching.mm:
(WebViewGetHistoryDelegateImplementations):
(CallHistoryDelegate):
* WebView/WebView.mm:
(-[WebView _cacheHistoryDelegateImplementations]):
(-[WebView setHistoryDelegate:]):
(-[WebView historyDelegate]):
* WebView/WebViewData.h:
* WebView/WebViewPrivate.h:
WebKitTools:
Adding the dumping of global history delegate callbacks.
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Automatically dump history delegate callbacks for tests with "globalhistory/" in their URL:
* DumpRenderTree/mac/DumpRenderTree.mm:
(createWebViewAndOffscreenWindow):
(allocateGlobalControllers):
(shouldLogFrameLoadDelegates):
(shouldLogHistoryDelegates):
(runTest):
Dump history delegate callbacks:
* DumpRenderTree/mac/HistoryDelegate.h: Added.
* DumpRenderTree/mac/HistoryDelegate.mm: Added.
(-[HistoryDelegate webView:didNavigateWithNavigationData:inFrame:]):
(-[HistoryDelegate webView:didPerformClientRedirectFromURL:toURL:inFrame:]):
(-[HistoryDelegate webView:didPerformServerRedirectFromURL:toURL:inFrame:]):
LayoutTests:
* http/tests/globalhistory: Added.
* http/tests/globalhistory/history-delegate-basic-302-redirect-expected.txt: Added.
* http/tests/globalhistory/history-delegate-basic-302-redirect.html: Added.
* http/tests/globalhistory/history-delegate-basic-refresh-redirect-expected.txt: Added.
* http/tests/globalhistory/history-delegate-basic-refresh-redirect.html: Added.
* http/tests/resources/notify-done.html: Added.
* http/tests/resources/redirect.php: Augment to optionally do "Refresh:"-style redirects.
Skip these new tests on all platforms that don't have history delegates (yet):
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48914 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 64d6a67..46f404c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2009-09-29 Brady Eidson <beidson at apple.com>
+
+ Reviewed by John Sullivan.
+
+ WebKit Mac API should provide a delegate interface for global history.
+ <rdar://problem/7042773> and https://webkit.org/b/29904
+
+ * http/tests/globalhistory: Added.
+ * http/tests/globalhistory/history-delegate-basic-302-redirect-expected.txt: Added.
+ * http/tests/globalhistory/history-delegate-basic-302-redirect.html: Added.
+ * http/tests/globalhistory/history-delegate-basic-refresh-redirect-expected.txt: Added.
+ * http/tests/globalhistory/history-delegate-basic-refresh-redirect.html: Added.
+ * http/tests/resources/notify-done.html: Added.
+ * http/tests/resources/redirect.php: Augment to optionally do "Refresh:"-style redirects.
+
+ Skip these new tests on all platforms that don't have history delegates (yet):
+ * platform/gtk/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+
2009-09-29 Daniel Bates <dbates at webkit.org>
Reviewed by Adam Barth.
diff --git a/LayoutTests/http/tests/globalhistory/history-delegate-basic-302-redirect-expected.txt b/LayoutTests/http/tests/globalhistory/history-delegate-basic-302-redirect-expected.txt
new file mode 100644
index 0000000..9d34e7a
--- /dev/null
+++ b/LayoutTests/http/tests/globalhistory/history-delegate-basic-302-redirect-expected.txt
@@ -0,0 +1,15 @@
+WebView navigated to url "http://127.0.0.1:8000/globalhistory/history-delegate-basic-302-redirect.html" with title "" with HTTP equivalent method "GET". The navigation was successful and was not a client redirect.
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html
+main frame - didStartProvisionalLoadForFrame
+main frame - didReceiveServerRedirectForProvisionalLoadForFrame
+WebView performed a client redirect from "http://127.0.0.1:8000/globalhistory/history-delegate-basic-302-redirect.html" to "http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html".
+WebView performed a server redirect from "http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html" to "http://127.0.0.1:8000/resources/notify-done.html".
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+
diff --git a/LayoutTests/http/tests/globalhistory/history-delegate-basic-302-redirect.html b/LayoutTests/http/tests/globalhistory/history-delegate-basic-302-redirect.html
new file mode 100644
index 0000000..790b5bc
--- /dev/null
+++ b/LayoutTests/http/tests/globalhistory/history-delegate-basic-302-redirect.html
@@ -0,0 +1,16 @@
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ layoutTestController.dumpFrameLoadCallbacks();
+}
+
+function runTest() {
+ window.location.replace('http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html');
+}
+
+</script>
+<body onload="setTimeout('runTest();', 10);">
+This tests basic functionality of the HistoryDelegate, including tracking a few forms of redirects.<br>
+</body>
diff --git a/LayoutTests/http/tests/globalhistory/history-delegate-basic-refresh-redirect-expected.txt b/LayoutTests/http/tests/globalhistory/history-delegate-basic-refresh-redirect-expected.txt
new file mode 100644
index 0000000..9c8bc4c
--- /dev/null
+++ b/LayoutTests/http/tests/globalhistory/history-delegate-basic-refresh-redirect-expected.txt
@@ -0,0 +1,21 @@
+WebView navigated to url "http://127.0.0.1:8000/globalhistory/history-delegate-basic-refresh-redirect.html" with title "" with HTTP equivalent method "GET". The navigation was successful and was not a client redirect.
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html&refresh=0
+main frame - didStartProvisionalLoadForFrame
+WebView performed a client redirect from "http://127.0.0.1:8000/globalhistory/history-delegate-basic-refresh-redirect.html" to "http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html&refresh=0".
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - willPerformClientRedirectToURL: http://127.0.0.1:8000/resources/notify-done.html
+main frame - didFinishLoadForFrame
+main frame - didStartProvisionalLoadForFrame
+WebView performed a client redirect from "http://127.0.0.1:8000/globalhistory/history-delegate-basic-refresh-redirect.html" to "http://127.0.0.1:8000/resources/notify-done.html".
+main frame - didCancelClientRedirectForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+main frame - didFinishLoadForFrame
+
diff --git a/LayoutTests/http/tests/globalhistory/history-delegate-basic-refresh-redirect.html b/LayoutTests/http/tests/globalhistory/history-delegate-basic-refresh-redirect.html
new file mode 100644
index 0000000..7216051
--- /dev/null
+++ b/LayoutTests/http/tests/globalhistory/history-delegate-basic-refresh-redirect.html
@@ -0,0 +1,16 @@
+<script>
+
+if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.dumpAsText();
+ layoutTestController.dumpFrameLoadCallbacks();
+}
+
+function runTest() {
+ window.location.replace('http://127.0.0.1:8000/resources/redirect.php?url=notify-done.html&refresh=0');
+}
+
+</script>
+<body onload="setTimeout('runTest();', 10);">
+This tests basic functionality of the HistoryDelegate, including tracking a few forms of redirects.<br>
+</body>
diff --git a/LayoutTests/http/tests/resources/notify-done.html b/LayoutTests/http/tests/resources/notify-done.html
new file mode 100644
index 0000000..8d692ed
--- /dev/null
+++ b/LayoutTests/http/tests/resources/notify-done.html
@@ -0,0 +1,7 @@
+<script>
+function loaded() {
+ if (window.layoutTestController)
+ setTimeout("layoutTestController.notifyDone();", 0);
+}
+</script>
+<body onload="loaded();"></body>
diff --git a/LayoutTests/http/tests/resources/redirect.php b/LayoutTests/http/tests/resources/redirect.php
index d47819f..cfeb37d 100644
--- a/LayoutTests/http/tests/resources/redirect.php
+++ b/LayoutTests/http/tests/resources/redirect.php
@@ -1,5 +1,13 @@
<?php
$url = $_GET['url'];
+ $refresh = $_GET['refresh'];
+
+ if (isset($refresh)) {
+ header("HTTP/1.1 200");
+ header("Refresh: $refresh; url=$url");
+ return;
+ }
+
$code = $_GET['code'];
if (!isset($code))
$code = 302;
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 66f2e41..36620ff 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5718,3 +5718,6 @@ transforms/2d/hindi-rotated.html
# See https://bugs.webkit.org/show_bug.cgi?id=29683
plugins/destroy-during-npp-new.html
+
+# This port doesn't have a global history delegate yet
+http/tests/globalhistory
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index a0f9e67..e2fd74d 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -4845,3 +4845,6 @@ http/tests/loading/basic-credentials-sent-automatically.html
# This port doesn't support detecting slow unload handlers.
fast/dom/Window/slow_unload_handler.html
+
+# This port doesn't have a global history delegate yet
+http/tests/globalhistory
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index dff8eee..6a9211c 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -686,4 +686,7 @@ plugins/destroy-during-npp-new.html
http/tests/xmlhttprequest/xmlhttprequest-missing-file-exception.html
# This port doesn't support detecting slow unload handlers.
-fast/dom/Window/slow_unload_handler.html
\ No newline at end of file
+fast/dom/Window/slow_unload_handler.html
+
+# This port doesn't have a global history delegate yet
+http/tests/globalhistory
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f914a11..2f8f18f 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-29 Brady Eidson <beidson at apple.com>
+
+ Reviewed by John Sullivan.
+
+ WebKit Mac API should provide a delegate interface for global history.
+ <rdar://problem/7042773> and https://webkit.org/b/29904
+
+ * WebKit.xcodeproj/project.pbxproj:
+
2009-09-28 Yaar Schnitman <yaar at chromium.org>
Reviewed by Dimitri Glazkov.
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index 402c1f6..b762fc9 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -91,6 +91,9 @@
51494CD70C7EBDE0004178C5 /* WebIconDatabaseClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51494CD50C7EBDE0004178C5 /* WebIconDatabaseClient.mm */; };
51494D240C7EC1B7004178C5 /* WebNSNotificationCenterExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 51494D220C7EC1B6004178C5 /* WebNSNotificationCenterExtras.h */; };
51494D250C7EC1B7004178C5 /* WebNSNotificationCenterExtras.m in Sources */ = {isa = PBXBuildFile; fileRef = 51494D230C7EC1B7004178C5 /* WebNSNotificationCenterExtras.m */; };
+ 5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */; };
+ 5185F62610712B80007AA393 /* WebNavigationData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F62510712B80007AA393 /* WebNavigationData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F62710712B97007AA393 /* WebNavigationData.mm */; };
51AEDEF10CECF45700854328 /* WebDatabaseManagerInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */; };
51B2A1000ADB15D0002A9BEE /* WebIconDatabaseDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B2A0FF0ADB15D0002A9BEE /* WebIconDatabaseDelegate.h */; };
51C714FB0B20F79F00E5E33C /* WebBackForwardListInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C714FA0B20F79F00E5E33C /* WebBackForwardListInternal.h */; };
@@ -454,10 +457,13 @@
5152FADF033FC50400CA2ACD /* WebDefaultPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultPolicyDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
5152FAE0033FC50400CA2ACD /* WebDefaultPolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultPolicyDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
5152FAE5033FC52200CA2ACD /* WebFrameLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameLoadDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryDelegate.h; sourceTree = "<group>"; };
515E27CC0458C86500CA2D3A /* WebUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebUIDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
515E27CF0458CA4B00CA2D3A /* WebDefaultUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDefaultUIDelegate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
515E27D00458CA4B00CA2D3A /* WebDefaultUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDefaultUIDelegate.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
516F296F03A6C45A00CA2D3A /* WebHistoryItemInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItemInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 5185F62510712B80007AA393 /* WebNavigationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNavigationData.h; sourceTree = "<group>"; };
+ 5185F62710712B97007AA393 /* WebNavigationData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNavigationData.mm; sourceTree = "<group>"; };
51863EFC065419EB00E9E8DD /* WebJavaPlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebJavaPlugIn.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51A8B52E04282B5900CA2D3A /* WebFrameView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
51A8B52F04282B5900CA2D3A /* WebFrameView.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFrameView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
@@ -1081,6 +1087,9 @@
51A8B52F04282B5900CA2D3A /* WebFrameView.mm */,
51A8B53204282BD200CA2D3A /* WebFrameViewInternal.h */,
93C6F14507920B93002449CD /* WebFrameViewPrivate.h */,
+ 5158F6EE106D862A00AF457C /* WebHistoryDelegate.h */,
+ 5185F62710712B97007AA393 /* WebNavigationData.mm */,
+ 5185F62510712B80007AA393 /* WebNavigationData.h */,
51443F9A0429392B00CA2D3A /* WebPolicyDelegate.h */,
51443F9B0429392B00CA2D3A /* WebPolicyDelegate.mm */,
51443F9C0429392B00CA2D3A /* WebPolicyDelegatePrivate.h */,
@@ -1467,6 +1476,8 @@
59C77F4B105471E700506104 /* WebGeolocationMockPrivate.h in Headers */,
37B6FB4E1063530C000FDB3B /* WebPDFDocumentExtras.h in Headers */,
37D1DCA81065928C0068F7EF /* WebJSPDFDoc.h in Headers */,
+ 5158F6EF106D862A00AF457C /* WebHistoryDelegate.h in Headers */,
+ 5185F62610712B80007AA393 /* WebNavigationData.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1801,6 +1812,7 @@
59C77F3510545F7E00506104 /* WebGeolocationMock.mm in Sources */,
37B6FB4F1063530C000FDB3B /* WebPDFDocumentExtras.mm in Sources */,
37D1DCA91065928C0068F7EF /* WebJSPDFDoc.mm in Sources */,
+ 5185F62810712B97007AA393 /* WebNavigationData.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 61a8f6a..20f5266 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,43 @@
+2009-09-29 Brady Eidson <beidson at apple.com>
+
+ Reviewed by John Sullivan.
+
+ WebKit Mac API should provide a delegate interface for global history.
+ <rdar://problem/7042773> and https://webkit.org/b/29904
+
+ * WebView/WebHistoryDelegate.h: Added. New interface for WebKit clients to implement to manage
+ their own global history store.
+
+ Object to store all of the bits of data relevant to a page visit:
+ * WebView/WebNavigationData.h: Added.
+ * WebView/WebNavigationData.mm: Added.
+ (-[WebNavigationDataPrivate dealloc]):
+ (-[WebNavigationData initWithURLString:title:originalRequest:response:hasSubstituteData:clientRedirectSource:]):
+ (-[WebNavigationData url]):
+ (-[WebNavigationData title]):
+ (-[WebNavigationData originalRequest]):
+ (-[WebNavigationData response]):
+ (-[WebNavigationData hasSubstituteData]):
+ (-[WebNavigationData clientRedirectSource]):
+ (-[WebNavigationData dealloc]):
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (WebFrameLoaderClient::updateGlobalHistory): If the delegate exists, don't use the built-in WebHistory.
+ If the implementation for this method exists, call it.
+ (WebFrameLoaderClient::updateGlobalHistoryRedirectLinks): Ditto
+
+ * WebView/WebDelegateImplementationCaching.h:
+ * WebView/WebDelegateImplementationCaching.mm:
+ (WebViewGetHistoryDelegateImplementations):
+ (CallHistoryDelegate):
+
+ * WebView/WebView.mm:
+ (-[WebView _cacheHistoryDelegateImplementations]):
+ (-[WebView setHistoryDelegate:]):
+ (-[WebView historyDelegate]):
+ * WebView/WebViewData.h:
+ * WebView/WebViewPrivate.h:
+
2009-09-29 Kenneth Russell <kbr at google.com>
Reviewed by Dimitri Glazkov.
diff --git a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index c5e0ec8..764130a 100644
--- a/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -56,6 +56,7 @@
#import "WebKitErrorsPrivate.h"
#import "WebKitLogging.h"
#import "WebKitNSStringExtras.h"
+#import "WebNavigationData.h"
#import "WebNSURLExtras.h"
#import "WebNetscapePluginView.h"
#import "WebNetscapePluginPackage.h"
@@ -810,7 +811,26 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader)
void WebFrameLoaderClient::updateGlobalHistory()
{
+ WebView* view = getWebView(m_webFrame.get());
DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader();
+
+ if ([view historyDelegate]) {
+ WebHistoryDelegateImplementationCache* implementations = WebViewGetHistoryDelegateImplementations(view);
+ if (implementations->navigatedFunc) {
+ WebNavigationData *data = [[WebNavigationData alloc] initWithURLString:loader->urlForHistory()
+ title:loader->title()
+ originalRequest:loader->originalRequestCopy().nsURLRequest()
+ response:loader->response().nsURLResponse()
+ hasSubstituteData:loader->substituteData().isValid()
+ clientRedirectSource:loader->clientRedirectSourceForHistory()];
+
+ CallHistoryDelegate(implementations->navigatedFunc, view, @selector(webView:didNavigateWithNavigationData:inFrame:), data, m_webFrame.get());
+ [data release];
+ }
+
+ return;
+ }
+
[[WebHistory optionalSharedHistory] _visitedURL:loader->urlForHistory()
withTitle:loader->title()
method:loader->originalRequestCopy().httpMethod()
@@ -820,16 +840,29 @@ void WebFrameLoaderClient::updateGlobalHistory()
void WebFrameLoaderClient::updateGlobalHistoryRedirectLinks()
{
+ WebView* view = getWebView(m_webFrame.get());
+ WebHistoryDelegateImplementationCache* implementations = [view historyDelegate] ? WebViewGetHistoryDelegateImplementations(view) : 0;
+
DocumentLoader* loader = core(m_webFrame.get())->loader()->documentLoader();
ASSERT(loader->unreachableURL().isEmpty());
if (!loader->clientRedirectSourceForHistory().isNull()) {
- if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
+ if (implementations) {
+ if (implementations->clientRedirectFunc) {
+ CallHistoryDelegate(implementations->clientRedirectFunc, view, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:),
+ loader->clientRedirectSourceForHistory(), loader->clientRedirectDestinationForHistory(), m_webFrame.get());
+ }
+ } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->clientRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->clientRedirectDestinationForHistory());
}
if (!loader->serverRedirectSourceForHistory().isNull()) {
- if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
+ if (implementations) {
+ if (implementations->serverRedirectFunc) {
+ CallHistoryDelegate(implementations->serverRedirectFunc, view, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:),
+ loader->serverRedirectSourceForHistory(), loader->serverRedirectDestinationForHistory(), m_webFrame.get());
+ }
+ } else if (WebHistoryItem *item = [[WebHistory optionalSharedHistory] _itemForURLString:loader->serverRedirectSourceForHistory()])
core(item)->addRedirectURL(loader->serverRedirectDestinationForHistory());
}
}
diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/WebKit/mac/WebView/WebDelegateImplementationCaching.h
index b8099ea..6e7af15 100644
--- a/WebKit/mac/WebView/WebDelegateImplementationCaching.h
+++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.h
@@ -81,9 +81,16 @@ struct WebScriptDebugDelegateImplementationCache {
IMP exceptionWasRaisedFunc;
};
+struct WebHistoryDelegateImplementationCache {
+ IMP navigatedFunc;
+ IMP clientRedirectFunc;
+ IMP serverRedirectFunc;
+};
+
WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *);
WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *);
WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *);
+WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView);
id CallFormDelegate(WebView *, SEL, id, id);
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5);
@@ -121,3 +128,6 @@ id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);
+
+id CallHistoryDelegate(IMP, WebView *, SEL, id, id);
+id CallHistoryDelegate(IMP, WebView *, SEL, id, id, id);
diff --git a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
index 441df92..7757fc7 100644
--- a/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
+++ b/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
@@ -60,6 +60,14 @@ WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplemen
return &webView->_private->scriptDebugDelegateImplementations;
}
+WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView)
+{
+ static WebHistoryDelegateImplementationCache empty;
+ if (!webView)
+ return ∅
+ return &webView->_private->historyDelegateImplementations;
+}
+
// We use these functions to call the delegates and block exceptions. These functions are
// declared inside a WebView category to get direct access to the delegate data memebers,
// preventing more ObjC message dispatch and compensating for the expense of the @try/@catch.
@@ -540,6 +548,16 @@ id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id o
return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
}
+id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
+{
+ return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2);
+}
+
+id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
+{
+ return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2, object3);
+}
+
// The form delegate needs to have it's own implementation, because the first argument is never the WebView
id CallFormDelegate(WebView *self, SEL selector, id object1, id object2)
diff --git a/WebKit/mac/WebView/WebHistoryDelegate.h b/WebKit/mac/WebView/WebHistoryDelegate.h
new file mode 100644
index 0000000..f8e6c26
--- /dev/null
+++ b/WebKit/mac/WebView/WebHistoryDelegate.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+ at class WebView;
+ at class WebFrame;
+ at class WebNavigationData;
+
+ at interface NSObject (WebHistoryDelegate)
+
+- (void)webView:(WebView *)webView didNavigateWithNavigationData:(WebNavigationData *)navigationData inFrame:(WebFrame *)webFrame;
+
+- (void)webView:(WebView *)webView didPerformClientRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame;
+
+- (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame;
+
+ at end
diff --git a/WebKit/mac/WebView/WebNavigationData.h b/WebKit/mac/WebView/WebNavigationData.h
new file mode 100644
index 0000000..a48cc20
--- /dev/null
+++ b/WebKit/mac/WebView/WebNavigationData.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#import <Foundation/Foundation.h>
+
+ at class WebView;
+ at class WebFrame;
+ at class WebNavigationDataPrivate;
+
+ at interface WebNavigationData : NSObject
+{
+ at private
+ WebNavigationDataPrivate *_private;
+}
+
+- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource;
+- (NSString *)url;
+- (NSString *)title;
+- (NSURLRequest *)originalRequest;
+- (NSURLResponse *)response;
+- (BOOL)hasSubstituteData;
+- (NSString *)clientRedirectSource;
+
+ at end
diff --git a/WebKit/mac/WebView/WebNavigationData.mm b/WebKit/mac/WebView/WebNavigationData.mm
new file mode 100644
index 0000000..9126371
--- /dev/null
+++ b/WebKit/mac/WebView/WebNavigationData.mm
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#import "WebNavigationData.h"
+
+ at interface WebNavigationDataPrivate : NSObject
+{
+ at public
+ NSString *url;
+ NSString *title;
+ NSURLRequest *originalRequest;
+ NSURLResponse *response;
+ BOOL hasSubstituteData;
+ NSString *clientRedirectSource;
+}
+
+ at end
+
+ at implementation WebNavigationDataPrivate
+
+- (void)dealloc
+{
+ [url release];
+ [title release];
+ [originalRequest release];
+ [response release];
+ [clientRedirectSource release];
+
+ [super dealloc];
+}
+
+ at end
+
+ at implementation WebNavigationData
+
+- (id)initWithURLString:(NSString *)url title:(NSString *)title originalRequest:(NSURLRequest *)request response:(NSURLResponse *)response hasSubstituteData:(BOOL)hasSubstituteData clientRedirectSource:(NSString *)redirectSource;
+{
+ _private = [[WebNavigationDataPrivate alloc] init];
+
+ _private->url = [url retain];
+ _private->title = [title retain];
+ _private->originalRequest = [request retain];
+ _private->response = [response retain];
+ _private->hasSubstituteData = hasSubstituteData;
+ _private->clientRedirectSource = [redirectSource retain];
+
+ return self;
+}
+
+- (NSString *)url
+{
+ return _private->url;
+}
+
+- (NSString *)title
+{
+ return _private->title;
+}
+
+- (NSURLRequest *)originalRequest
+{
+ return _private->originalRequest;
+}
+
+- (NSURLResponse *)response
+{
+ return _private->response;
+}
+
+- (BOOL)hasSubstituteData
+{
+ return _private->hasSubstituteData;
+}
+
+- (NSString *)clientRedirectSource
+{
+ return _private->clientRedirectSource;
+}
+
+- (void)dealloc
+{
+ [_private release];
+ [super dealloc];
+}
+
+ at end
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 04b8950..1cf7f68 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1403,6 +1403,21 @@ static inline IMP getMethod(id o, SEL s)
cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
}
+- (void)_cacheHistoryDelegateImplementations
+{
+ WebHistoryDelegateImplementationCache *cache = &_private->historyDelegateImplementations;
+ id delegate = _private->historyDelegate;
+
+ if (!delegate) {
+ bzero(cache, sizeof(WebHistoryDelegateImplementationCache));
+ return;
+ }
+
+ cache->navigatedFunc = getMethod(delegate, @selector(webView:didNavigateWithNavigationData:inFrame:));
+ cache->clientRedirectFunc = getMethod(delegate, @selector(webView:didPerformClientRedirectFromURL:toURL:inFrame:));
+ cache->serverRedirectFunc = getMethod(delegate, @selector(webView:didPerformServerRedirectFromURL:toURL:inFrame:));
+}
+
- (id)_policyDelegateForwarder
{
if (!_private->policyDelegateForwarder)
@@ -3961,6 +3976,17 @@ done:
{
return _private->scriptDebugDelegate;
}
+
+- (void)setHistoryDelegate:(id)delegate
+{
+ _private->historyDelegate = delegate;
+ [self _cacheHistoryDelegateImplementations];
+}
+
+- (id)historyDelegate
+{
+ return _private->historyDelegate;
+}
- (BOOL)shouldClose
{
diff --git a/WebKit/mac/WebView/WebViewData.h b/WebKit/mac/WebView/WebViewData.h
index 91d83a7..4560a54 100644
--- a/WebKit/mac/WebView/WebViewData.h
+++ b/WebKit/mac/WebView/WebViewData.h
@@ -64,6 +64,7 @@ extern int pluginDatabaseClientCount;
id editingDelegate;
id editingDelegateForwarder;
id scriptDebugDelegate;
+ id historyDelegate;
WebInspector *inspector;
WebNodeHighlight *currentNodeHighlight;
@@ -86,6 +87,7 @@ extern int pluginDatabaseClientCount;
WebResourceDelegateImplementationCache resourceLoadDelegateImplementations;
WebFrameLoadDelegateImplementationCache frameLoadDelegateImplementations;
WebScriptDebugDelegateImplementationCache scriptDebugDelegateImplementations;
+ WebHistoryDelegateImplementationCache historyDelegateImplementations;
void *observationInfo;
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index 15b7d42..2932665 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -139,6 +139,20 @@ typedef enum {
*/
- (id)scriptDebugDelegate;
+/*!
+ @method setHistoryDelegate:
+ @abstract Set the WebView's WebHistoryDelegate delegate.
+ @param delegate The WebHistoryDelegate to set as the delegate.
+*/
+- (void)setHistoryDelegate:(id)delegate;
+
+/*!
+ @method historyDelegate
+ @abstract Return the WebView's WebHistoryDelegate delegate.
+ @result The WebView's WebHistoryDelegate delegate.
+*/
+- (id)historyDelegate;
+
- (BOOL)shouldClose;
/*!
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3cd141d..e969453 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,29 @@
+2009-09-29 Brady Eidson <beidson at apple.com>
+
+ Reviewed by John Sullivan.
+
+ WebKit Mac API should provide a delegate interface for global history.
+ <rdar://problem/7042773> and https://webkit.org/b/29904
+
+ Adding the dumping of global history delegate callbacks.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+
+ Automatically dump history delegate callbacks for tests with "globalhistory/" in their URL:
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (createWebViewAndOffscreenWindow):
+ (allocateGlobalControllers):
+ (shouldLogFrameLoadDelegates):
+ (shouldLogHistoryDelegates):
+ (runTest):
+
+ Dump history delegate callbacks:
+ * DumpRenderTree/mac/HistoryDelegate.h: Added.
+ * DumpRenderTree/mac/HistoryDelegate.mm: Added.
+ (-[HistoryDelegate webView:didNavigateWithNavigationData:inFrame:]):
+ (-[HistoryDelegate webView:didPerformClientRedirectFromURL:toURL:inFrame:]):
+ (-[HistoryDelegate webView:didPerformServerRedirectFromURL:toURL:inFrame:]):
+
2009-09-29 Daniel Bates <dbates at webkit.org>
Reviewed by Adam Roben.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index fd2c0d9..06f0599 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -35,6 +35,8 @@
1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; };
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; };
23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; };
+ 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5185F69F10714A57007AA393 /* HistoryDelegate.mm */; };
+ 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185F69E10714A57007AA393 /* HistoryDelegate.h */; };
5DB9AC970F722C3600684641 /* AHEM____.TTF in Copy Font Files */ = {isa = PBXBuildFile; fileRef = AA7F10C20CB3C1030003BDC9 /* AHEM____.TTF */; };
5DB9AC980F722C3600684641 /* WebKitWeightWatcher100.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */; };
5DB9AC990F722C3600684641 /* WebKitWeightWatcher200.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */; };
@@ -189,6 +191,8 @@
375F09770DAC3CB600C8B4E5 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; };
375F09780DAC3CB600C8B4E5 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; };
375F09790DAC3CB600C8B4E5 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; };
+ 5185F69E10714A57007AA393 /* HistoryDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HistoryDelegate.h; path = mac/HistoryDelegate.h; sourceTree = "<group>"; };
+ 5185F69F10714A57007AA393 /* HistoryDelegate.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = HistoryDelegate.mm; path = mac/HistoryDelegate.mm; sourceTree = "<group>"; };
8465E2C60FFA8DF2003B8342 /* PixelDumpSupport.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = PixelDumpSupport.cpp; sourceTree = "<group>"; };
9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
933BF5A90F93FA5C000F0441 /* PlainTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlainTextController.h; path = mac/PlainTextController.h; sourceTree = "<group>"; };
@@ -388,6 +392,8 @@
BCA18B580C9B08C200114369 /* EditingDelegate.mm */,
BCA18B590C9B08C200114369 /* FrameLoadDelegate.h */,
BCA18B5A0C9B08C200114369 /* FrameLoadDelegate.mm */,
+ 5185F69E10714A57007AA393 /* HistoryDelegate.h */,
+ 5185F69F10714A57007AA393 /* HistoryDelegate.mm */,
BCA18B5B0C9B08C200114369 /* PolicyDelegate.h */,
BCA18B5C0C9B08C200114369 /* PolicyDelegate.mm */,
BCA18B5D0C9B08C200114369 /* ResourceLoadDelegate.h */,
@@ -531,6 +537,7 @@
BCA18B690C9B08C200114369 /* UIDelegate.h in Headers */,
BC9D90250C97472E0099A4A3 /* WorkQueue.h in Headers */,
BC9D90260C97472E0099A4A3 /* WorkQueueItem.h in Headers */,
+ 5185F6B310714E12007AA393 /* HistoryDelegate.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -696,6 +703,7 @@
BCA18B6A0C9B08C200114369 /* UIDelegate.mm in Sources */,
BC9D90240C97472E0099A4A3 /* WorkQueue.cpp in Sources */,
BCA18B260C9B015C00114369 /* WorkQueueItemMac.mm in Sources */,
+ 5185F6B210714E07007AA393 /* HistoryDelegate.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 7f94a33..8d79c6e 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -38,6 +38,7 @@
#import "EditingDelegate.h"
#import "EventSendingController.h"
#import "FrameLoadDelegate.h"
+#import "HistoryDelegate.h"
#import "JavaScriptThreading.h"
#import "LayoutTestController.h"
#import "NavigationController.h"
@@ -116,6 +117,7 @@ static FrameLoadDelegate *frameLoadDelegate;
static UIDelegate *uiDelegate;
static EditingDelegate *editingDelegate;
static ResourceLoadDelegate *resourceLoadDelegate;
+static HistoryDelegate *historyDelegate;
PolicyDelegate *policyDelegate;
static int dumpPixels;
@@ -490,6 +492,7 @@ static void allocateGlobalControllers()
editingDelegate = [[EditingDelegate alloc] init];
resourceLoadDelegate = [[ResourceLoadDelegate alloc] init];
policyDelegate = [[PolicyDelegate alloc] init];
+ historyDelegate = [[HistoryDelegate alloc] init];
}
// ObjC++ doens't seem to let me pass NSObject*& sadly.
@@ -1075,11 +1078,16 @@ void dump()
done = YES;
}
-static bool shouldLogFrameLoadDelegates(const char *pathOrURL)
+static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
{
return strstr(pathOrURL, "loading/");
}
+static bool shouldLogHistoryDelegates(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "globalhistory/");
+}
+
static void resetWebViewToConsistentStateBeforeTesting()
{
WebView *webView = [mainFrame webView];
@@ -1152,6 +1160,11 @@ static void runTest(const string& testPathOrURL)
if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
gLayoutTestController->setDumpFrameLoadCallbacks(true);
+ if (shouldLogHistoryDelegates(pathOrURL.c_str()))
+ [[mainFrame webView] setHistoryDelegate:historyDelegate];
+ else
+ [[mainFrame webView] setHistoryDelegate:nil];
+
if ([WebHistory optionalSharedHistory])
[WebHistory setOptionalSharedHistory:nil];
lastMousePosition = NSZeroPoint;
diff --git a/WebKitTools/DumpRenderTree/mac/HistoryDelegate.h b/WebKitTools/DumpRenderTree/mac/HistoryDelegate.h
new file mode 100644
index 0000000..e9a5513
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/mac/HistoryDelegate.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+ at interface HistoryDelegate : NSObject
+{
+}
+
+ at end
diff --git a/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm b/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm
new file mode 100644
index 0000000..84faf1b
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/mac/HistoryDelegate.mm
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 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
+ * 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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.
+ */
+#import "config.h"
+#import "HistoryDelegate.h"
+
+#import "DumpRenderTree.h"
+#import "LayoutTestController.h"
+
+#import <WebKit/WebNavigationData.h>
+
+ at interface NSURL (DRTExtras)
+- (NSString *)_drt_descriptionSuitableForTestResult;
+ at end
+
+ at implementation HistoryDelegate
+
+- (void)webView:(WebView *)webView didNavigateWithNavigationData:(WebNavigationData *)navigationData inFrame:(WebFrame *)webFrame
+{
+ NSURL *url = [navigationData url] ? [NSURL URLWithString:[navigationData url]] : nil;
+ bool hasClientRedirect = [[navigationData clientRedirectSource] length];
+ NSHTTPURLResponse *httpResponse = [[navigationData response] isKindOfClass:[NSHTTPURLResponse class]] ? (NSHTTPURLResponse *)[navigationData response] : nil;
+ bool wasFailure = [navigationData hasSubstituteData] || (httpResponse && [httpResponse statusCode] >= 400);
+
+ printf("WebView navigated to url \"%s\" with title \"%s\" with HTTP equivalent method \"%s\". The navigation was %s and was %s%s.\n",
+ url ? [[url _drt_descriptionSuitableForTestResult] UTF8String] : "<none>",
+ [navigationData title] ? [[navigationData title] UTF8String] : "",
+ [navigationData originalRequest] ? [[[navigationData originalRequest] HTTPMethod] UTF8String] : "",
+ wasFailure ? "a failure" : "successful",
+ hasClientRedirect ? "a client redirect from " : "not a client redirect",
+ hasClientRedirect ? [[navigationData clientRedirectSource] UTF8String] : "");
+}
+
+- (void)webView:(WebView *)webView didPerformClientRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame
+{
+ NSURL *source = [NSURL URLWithString:sourceURL];
+ NSURL *dest = [NSURL URLWithString:destinationURL];
+ printf("WebView performed a client redirect from \"%s\" to \"%s\".\n", [[source _drt_descriptionSuitableForTestResult] UTF8String], [[dest _drt_descriptionSuitableForTestResult] UTF8String]);
+}
+
+- (void)webView:(WebView *)webView didPerformServerRedirectFromURL:(NSString *)sourceURL toURL:(NSString *)destinationURL inFrame:(WebFrame *)webFrame
+{
+ NSURL *source = [NSURL URLWithString:sourceURL];
+ NSURL *dest = [NSURL URLWithString:destinationURL];
+ printf("WebView performed a server redirect from \"%s\" to \"%s\".\n", [[source _drt_descriptionSuitableForTestResult] UTF8String], [[dest _drt_descriptionSuitableForTestResult] UTF8String]);
+}
+
+ at end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list