[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:38:06 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6b20527beb998c4c49b34b2dc8131fb5bf93d7a2
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 11 16:37:12 2002 +0000

    WebCore:
    
    	WebCore part of support for the "Referer" header.
    
            * khtml/khtml_part.cpp:
            (KHTMLPart::urlSelected): Use much more of this function.
            (KHTMLPart::submitForm): Use much more of this function.
    
            * kwq/KWQKHTMLPartBrowserExtension.mm:
            (KHTMLPartBrowserExtension::createNewWindow): Parse the
    	referrer out of the URLArgs and pass it along.
    
            * kwq/KWQKHTMLPartImpl.h: Change parameters to urlSelected
    	and submitForm to allow KHTML to do more of the work. Add
    	referrer helper function.
            * kwq/KWQKHTMLPartImpl.mm:
            (KWQKHTMLPartImpl::bridgeForFrameName): Pass referrer of nil
    	when opening a blank window.
            (KWQKHTMLPartImpl::referrer): Extract referrer from metadata.
            (KWQKHTMLPartImpl::openURLRequest): Pass referrer from args
    	through the bridge.
            (KWQKHTMLPartImpl::urlSelected): Remove code that duplicates
    	what's in KHTMLPart. Also pass referrer from args through the
    	bridge as above.
            (KWQKHTMLPartImpl::submitForm): Ditto.
    
            * kwq/kdeui/kmessagebox.h: Add information member function.
            * kwq/KWQKMessageBox.mm: (KMessageBox::information): Implement.
    
            * kwq/kdecore/kurl.h: Add encode_string member function.
            * kwq/KWQKURL.mm:
            (KURL::KURL): Fix buffer overflow bug, and add an assert so we
    	will notice these overflows even when using the static buffer.
            (KURL::parse): Added a similar assert, even though I didn't fix
    	any overflow bug here.
            (KURL::encode_string): Implemented this, but didn't test it.
    
            * kwq/KWQLoaderImpl.mm: (KWQServeRequest): Pass referrer through
    	the bridge.
    
            * kwq/WebCoreBridge.h: Add referrer parameters to loadURL, postWithURL,
    	openNewWindowWithURL, and startLoadingResource.
    
            * kwq/kparts/browserextension.h: Implement setDoPost, setContentType,
    	const version of metaData().
    
            * kwq/qt/qstring.h: Implement fromLatin1(const char *, int).
    
            * WebCore-tests.exp: Not sure why, but I needed to remove isMalformed,
    	and the tests seem to still work with it removed.
    
    WebKit:
    
    	WebKit part of support for the "Referer" header.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge openNewWindowWithURL:referrer:frameName:]): Add referrer parameter,
    	and pass it on to the window context method.
            (-[WebBridge addAttributeForReferrer:toDictionary:]): Added.
            (-[WebBridge attributesForReferrer:]): Added.
            (-[WebBridge startLoadingResource:withURL:referrer:]): Put the referrer into an
    	attributes dictionary and pass it to the WebSubresourceClient method.
            (-[WebBridge loadURL:referrer:]): Put the referrer into an attributes dictionary
    	and pass it along.
            (-[WebBridge postWithURL:referrer:data:]): Put the referrer into an attributes
    	dictionary and pass it along.
    
            * WebCoreSupport.subproj/WebSubresourceClient.h: Add an attributes parameter to
    	the method that starts loading.
            * WebCoreSupport.subproj/WebSubresourceClient.m:
            (+[WebSubresourceClient startLoadingResource:withURL:attributes:forDataSource:]):
    	Put the attributes into the WebResourceRequest.
    
            * WebView.subproj/WebController.h: Add a referrer parameter to the WebWindowContext
    	openNewWindowWithURL method.
            * WebView.subproj/WebDefaultContextMenuHandler.m:
            (-[WebDefaultContextMenuHandler openNewWindowWithURL:referrer:]): Pass the referrer
    	on to the window context.
            (-[WebDefaultContextMenuHandler openLinkInNewWindow:]): Pass nil for the referrer
    	for now. Not sure if this is best.
            (-[WebDefaultContextMenuHandler openImageInNewWindow:]): Ditto.
            (-[WebDefaultContextMenuHandler openFrameInNewWindow:]): Ditto.
    
            * WebView.subproj/WebFrame.m: (-[WebFrame frameNamed:]): Pass nil for the referrer
    	here where we are creating a new empty window.
    
            * WebView.subproj/WebHTMLViewPrivate.m:
            (-[WebHTMLView _continueAfterClickPolicyForEvent:]): Pass nil for the referrer here
    	in the WebClickPolicyOpenNewWindow. The policy API doesn't provide a way for the
    	policy handler to specify the referrer; we might want to change that later.
    
            * Plugins.subproj/WebPluginView.m:
            (-[WebNetscapePluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
    	Pass nil for the referrer here. But it seems wrong that this function discards
    	the handle attributes that are passed in for the case where it opens a new window.
    
    WebBrowser:
    
    	WebBrowser part of support for the "Referer" header.
    
            * BrowserWebController.m:
            (-[BrowserWebController openNewWindowWithURL:referrer:]): Add referrer parameter, and
    	pass it through to the document controller.
            (-[BrowserWebController pluginNotFoundSheetEnded:returnCode:contextInfo:]):
    	Pass nil for referrer.
    
            * BrowserDocumentController.h: Add referrer parameter to the long version of goToURL.
            * BrowserDocumentController.m:
            (-[BrowserDocumentController openDocumentWithContentsOfURL:referrer:display:]):
    	Change to not all makeDocumentWithContentsOfURL and instead create the document
    	here, because we need to pass the referrer through.
            (-[BrowserDocumentController openDocumentWithContentsOfURL:display:]): Just call
    	the version above that has a referrer, passing a referrer of nil.
            (-[BrowserDocumentController _goToEachURL:referrer:forceNewWindow:orderFront:]):
    	Pas referrer to goToURL and to openDocumentWithContentsOfURL.
            (-[BrowserDocumentController goToEachURL:]): Pass nil for referrer.
            (-[BrowserDocumentController goToURL:referrer:forceNewWindow:orderFront:]):
    	Add referrer parameter, and pass through to _goToEachURL.
    
            * BrowserDocument.h: Add _openWithReferrer field, initWithContentsOfURL method
    	that takes a referrer, and goToURL method that takes a referrer.
            * BrowserDocument.m:
            (-[BrowserDocument initWithContentsOfURL:referrer:]): Set _openWithReferrer.
            (-[BrowserDocument dealloc]): Release _openWithReferrer.
            (-[BrowserDocument _goToURL:referrer:withFallbackURLs:]): Add referrer parameter.
    	Set up attributes dictionary with referrer in it.
            (-[BrowserDocument goToURL:]): Call through to goToURL:referrer:.
            (-[BrowserDocument goToURL:referrer:]): Added. Passes referrer on.
            (-[BrowserDocument goToInitialURL:]): Pass _openWithReferrer.
            (-[BrowserDocument tryMultipleURLs:]): Pass nil for referrer.
    
            * ActivityViewer.m: (-[ActivityViewer _goToClickedItem:]): Pass nil for referrer.
            * AppController.m:
            (-[AppController application:openFile:]): Ditto.
            (-[AppController handleGURLEvent:withReplyEvent:]): Ditto.
            * BrowserWebBookmarkExtras.m: (-[WebBookmark _goToForceNewWindow:]): Ditto.
            * Test/PageLoadTestRunner.m: (-[PageLoadTestRunner goToPage]): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2032 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index c524fc5..f424e6b 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,54 @@
+2002-09-10  Darin Adler  <darin at apple.com>
+
+	WebCore part of support for the "Referer" header.
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::urlSelected): Use much more of this function.
+        (KHTMLPart::submitForm): Use much more of this function.
+
+        * kwq/KWQKHTMLPartBrowserExtension.mm:
+        (KHTMLPartBrowserExtension::createNewWindow): Parse the
+	referrer out of the URLArgs and pass it along.
+
+        * kwq/KWQKHTMLPartImpl.h: Change parameters to urlSelected
+	and submitForm to allow KHTML to do more of the work. Add
+	referrer helper function.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::bridgeForFrameName): Pass referrer of nil
+	when opening a blank window.
+        (KWQKHTMLPartImpl::referrer): Extract referrer from metadata.
+        (KWQKHTMLPartImpl::openURLRequest): Pass referrer from args
+	through the bridge.
+        (KWQKHTMLPartImpl::urlSelected): Remove code that duplicates
+	what's in KHTMLPart. Also pass referrer from args through the
+	bridge as above.
+        (KWQKHTMLPartImpl::submitForm): Ditto.
+
+        * kwq/kdeui/kmessagebox.h: Add information member function.
+        * kwq/KWQKMessageBox.mm: (KMessageBox::information): Implement.
+
+        * kwq/kdecore/kurl.h: Add encode_string member function.
+        * kwq/KWQKURL.mm:
+        (KURL::KURL): Fix buffer overflow bug, and add an assert so we
+	will notice these overflows even when using the static buffer.
+        (KURL::parse): Added a similar assert, even though I didn't fix
+	any overflow bug here.
+        (KURL::encode_string): Implemented this, but didn't test it.
+
+        * kwq/KWQLoaderImpl.mm: (KWQServeRequest): Pass referrer through
+	the bridge.
+
+        * kwq/WebCoreBridge.h: Add referrer parameters to loadURL, postWithURL,
+	openNewWindowWithURL, and startLoadingResource.
+
+        * kwq/kparts/browserextension.h: Implement setDoPost, setContentType,
+	const version of metaData().
+
+        * kwq/qt/qstring.h: Implement fromLatin1(const char *, int).
+
+        * WebCore-tests.exp: Not sure why, but I needed to remove isMalformed,
+	and the tests seem to still work with it removed.
+
 2002-09-11  David Hyatt  <hyatt at apple.com>
 
 	This patch fixes a slew of bugs.  It is an implementation
@@ -60,7 +111,7 @@
         (RenderStyle::diff):
         * khtml/rendering/render_style.h:
 
-2002-09-10  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-10  Richard Williamson  <rjw at apple.com>
 
         Fixed broken DOM handling of click count.  DOM click 
         events can be tested with Labyrinth/Test/html/mousetest.html.
@@ -204,9 +255,9 @@
 	to do nothing.
         (QApplication::restoreOverrideCursor): Ditto.
 
-2002-09-09  Richard Williamson (Home)  <rjw at apple.com>
+2002-09-09  Richard Williamson  <rjw at apple.com>
 
-        Implemented  disable images automatically (2896319).
+        Implemented disable images automatically (2896319).
 
         * kwq/KWQKHTMLSettings.mm:
         (KHTMLSettings::autoLoadImages):
@@ -474,7 +525,7 @@
 
 === Alexander-22 ===
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
 
         Add the first child text node of the element to the
         element dictionary.  This will be used as a link 'label'.
@@ -483,14 +534,14 @@
         * kwq/WebCoreBridge.mm:
         (-[WebCoreBridge elementAtPoint:]):
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
     
         Removed debugging.
         
         * khtml/khtml_part.cpp:
         (KHTMLPart::closeURL):
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
 
         Always call KHTMLPart::closeURL when a new document is loaded.
         
@@ -676,7 +727,7 @@
         (RenderLayer::RenderZTreeNode::constructLayerList):
         * khtml/rendering/render_layer.h:
 
-2002-08-28  Richard Williamson (Local)  <rjw at apple.com>
+2002-08-28  Richard Williamson  <rjw at apple.com>
 
         More tweaks to ccs.
         Added underline to visited links.
@@ -684,7 +735,7 @@
         
         * khtml/css/html4.css:
 
-2002-08-28  Richard Williamson (Local)  <rjw at apple.com>
+2002-08-28  Richard Williamson  <rjw at apple.com>
 
         Fixed outline of for active link style.
         
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index c524fc5..f424e6b 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,54 @@
+2002-09-10  Darin Adler  <darin at apple.com>
+
+	WebCore part of support for the "Referer" header.
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::urlSelected): Use much more of this function.
+        (KHTMLPart::submitForm): Use much more of this function.
+
+        * kwq/KWQKHTMLPartBrowserExtension.mm:
+        (KHTMLPartBrowserExtension::createNewWindow): Parse the
+	referrer out of the URLArgs and pass it along.
+
+        * kwq/KWQKHTMLPartImpl.h: Change parameters to urlSelected
+	and submitForm to allow KHTML to do more of the work. Add
+	referrer helper function.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::bridgeForFrameName): Pass referrer of nil
+	when opening a blank window.
+        (KWQKHTMLPartImpl::referrer): Extract referrer from metadata.
+        (KWQKHTMLPartImpl::openURLRequest): Pass referrer from args
+	through the bridge.
+        (KWQKHTMLPartImpl::urlSelected): Remove code that duplicates
+	what's in KHTMLPart. Also pass referrer from args through the
+	bridge as above.
+        (KWQKHTMLPartImpl::submitForm): Ditto.
+
+        * kwq/kdeui/kmessagebox.h: Add information member function.
+        * kwq/KWQKMessageBox.mm: (KMessageBox::information): Implement.
+
+        * kwq/kdecore/kurl.h: Add encode_string member function.
+        * kwq/KWQKURL.mm:
+        (KURL::KURL): Fix buffer overflow bug, and add an assert so we
+	will notice these overflows even when using the static buffer.
+        (KURL::parse): Added a similar assert, even though I didn't fix
+	any overflow bug here.
+        (KURL::encode_string): Implemented this, but didn't test it.
+
+        * kwq/KWQLoaderImpl.mm: (KWQServeRequest): Pass referrer through
+	the bridge.
+
+        * kwq/WebCoreBridge.h: Add referrer parameters to loadURL, postWithURL,
+	openNewWindowWithURL, and startLoadingResource.
+
+        * kwq/kparts/browserextension.h: Implement setDoPost, setContentType,
+	const version of metaData().
+
+        * kwq/qt/qstring.h: Implement fromLatin1(const char *, int).
+
+        * WebCore-tests.exp: Not sure why, but I needed to remove isMalformed,
+	and the tests seem to still work with it removed.
+
 2002-09-11  David Hyatt  <hyatt at apple.com>
 
 	This patch fixes a slew of bugs.  It is an implementation
@@ -60,7 +111,7 @@
         (RenderStyle::diff):
         * khtml/rendering/render_style.h:
 
-2002-09-10  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-10  Richard Williamson  <rjw at apple.com>
 
         Fixed broken DOM handling of click count.  DOM click 
         events can be tested with Labyrinth/Test/html/mousetest.html.
@@ -204,9 +255,9 @@
 	to do nothing.
         (QApplication::restoreOverrideCursor): Ditto.
 
-2002-09-09  Richard Williamson (Home)  <rjw at apple.com>
+2002-09-09  Richard Williamson  <rjw at apple.com>
 
-        Implemented  disable images automatically (2896319).
+        Implemented disable images automatically (2896319).
 
         * kwq/KWQKHTMLSettings.mm:
         (KHTMLSettings::autoLoadImages):
@@ -474,7 +525,7 @@
 
 === Alexander-22 ===
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
 
         Add the first child text node of the element to the
         element dictionary.  This will be used as a link 'label'.
@@ -483,14 +534,14 @@
         * kwq/WebCoreBridge.mm:
         (-[WebCoreBridge elementAtPoint:]):
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
     
         Removed debugging.
         
         * khtml/khtml_part.cpp:
         (KHTMLPart::closeURL):
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
 
         Always call KHTMLPart::closeURL when a new document is loaded.
         
@@ -676,7 +727,7 @@
         (RenderLayer::RenderZTreeNode::constructLayerList):
         * khtml/rendering/render_layer.h:
 
-2002-08-28  Richard Williamson (Local)  <rjw at apple.com>
+2002-08-28  Richard Williamson  <rjw at apple.com>
 
         More tweaks to ccs.
         Added underline to visited links.
@@ -684,7 +735,7 @@
         
         * khtml/css/html4.css:
 
-2002-08-28  Richard Williamson (Local)  <rjw at apple.com>
+2002-08-28  Richard Williamson  <rjw at apple.com>
 
         Fixed outline of for active link style.
         
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index c524fc5..f424e6b 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,54 @@
+2002-09-10  Darin Adler  <darin at apple.com>
+
+	WebCore part of support for the "Referer" header.
+
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::urlSelected): Use much more of this function.
+        (KHTMLPart::submitForm): Use much more of this function.
+
+        * kwq/KWQKHTMLPartBrowserExtension.mm:
+        (KHTMLPartBrowserExtension::createNewWindow): Parse the
+	referrer out of the URLArgs and pass it along.
+
+        * kwq/KWQKHTMLPartImpl.h: Change parameters to urlSelected
+	and submitForm to allow KHTML to do more of the work. Add
+	referrer helper function.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::bridgeForFrameName): Pass referrer of nil
+	when opening a blank window.
+        (KWQKHTMLPartImpl::referrer): Extract referrer from metadata.
+        (KWQKHTMLPartImpl::openURLRequest): Pass referrer from args
+	through the bridge.
+        (KWQKHTMLPartImpl::urlSelected): Remove code that duplicates
+	what's in KHTMLPart. Also pass referrer from args through the
+	bridge as above.
+        (KWQKHTMLPartImpl::submitForm): Ditto.
+
+        * kwq/kdeui/kmessagebox.h: Add information member function.
+        * kwq/KWQKMessageBox.mm: (KMessageBox::information): Implement.
+
+        * kwq/kdecore/kurl.h: Add encode_string member function.
+        * kwq/KWQKURL.mm:
+        (KURL::KURL): Fix buffer overflow bug, and add an assert so we
+	will notice these overflows even when using the static buffer.
+        (KURL::parse): Added a similar assert, even though I didn't fix
+	any overflow bug here.
+        (KURL::encode_string): Implemented this, but didn't test it.
+
+        * kwq/KWQLoaderImpl.mm: (KWQServeRequest): Pass referrer through
+	the bridge.
+
+        * kwq/WebCoreBridge.h: Add referrer parameters to loadURL, postWithURL,
+	openNewWindowWithURL, and startLoadingResource.
+
+        * kwq/kparts/browserextension.h: Implement setDoPost, setContentType,
+	const version of metaData().
+
+        * kwq/qt/qstring.h: Implement fromLatin1(const char *, int).
+
+        * WebCore-tests.exp: Not sure why, but I needed to remove isMalformed,
+	and the tests seem to still work with it removed.
+
 2002-09-11  David Hyatt  <hyatt at apple.com>
 
 	This patch fixes a slew of bugs.  It is an implementation
@@ -60,7 +111,7 @@
         (RenderStyle::diff):
         * khtml/rendering/render_style.h:
 
-2002-09-10  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-10  Richard Williamson  <rjw at apple.com>
 
         Fixed broken DOM handling of click count.  DOM click 
         events can be tested with Labyrinth/Test/html/mousetest.html.
@@ -204,9 +255,9 @@
 	to do nothing.
         (QApplication::restoreOverrideCursor): Ditto.
 
-2002-09-09  Richard Williamson (Home)  <rjw at apple.com>
+2002-09-09  Richard Williamson  <rjw at apple.com>
 
-        Implemented  disable images automatically (2896319).
+        Implemented disable images automatically (2896319).
 
         * kwq/KWQKHTMLSettings.mm:
         (KHTMLSettings::autoLoadImages):
@@ -474,7 +525,7 @@
 
 === Alexander-22 ===
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
 
         Add the first child text node of the element to the
         element dictionary.  This will be used as a link 'label'.
@@ -483,14 +534,14 @@
         * kwq/WebCoreBridge.mm:
         (-[WebCoreBridge elementAtPoint:]):
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
     
         Removed debugging.
         
         * khtml/khtml_part.cpp:
         (KHTMLPart::closeURL):
 
-2002-09-05  Richard Williamson (Local)  <rjw at apple.com>
+2002-09-05  Richard Williamson  <rjw at apple.com>
 
         Always call KHTMLPart::closeURL when a new document is loaded.
         
@@ -676,7 +727,7 @@
         (RenderLayer::RenderZTreeNode::constructLayerList):
         * khtml/rendering/render_layer.h:
 
-2002-08-28  Richard Williamson (Local)  <rjw at apple.com>
+2002-08-28  Richard Williamson  <rjw at apple.com>
 
         More tweaks to ccs.
         Added underline to visited links.
@@ -684,7 +735,7 @@
         
         * khtml/css/html4.css:
 
-2002-08-28  Richard Williamson (Local)  <rjw at apple.com>
+2002-08-28  Richard Williamson  <rjw at apple.com>
 
         Fixed outline of for active link style.
         
diff --git a/WebCore/WebCore-tests.exp b/WebCore/WebCore-tests.exp
index 56492ad..c4ecf24 100644
--- a/WebCore/WebCore-tests.exp
+++ b/WebCore/WebCore-tests.exp
@@ -201,7 +201,6 @@ __ZNK22KWQPtrDictIteratorImpl10currentKeyEv
 __ZNK22KWQPtrDictIteratorImpl5countEv
 __ZNK22KWQPtrDictIteratorImpl7currentEv
 __ZNK24KWQValueListIteratorImpl4nodeEv
-__ZNK4KURL11isMalformedEv
 __ZNK4KURL3refEv
 __ZNK4KURL3urlEv
 __ZNK4KURL4hostEv
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index a112dbc..7dfbca7 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -2291,9 +2291,6 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
 void KHTMLPart::urlSelected( const QString &url, int button, int state, const QString &_target,
                              KParts::URLArgs args )
 {
-#ifdef APPLE_CHANGES
-  impl->urlSelected(url, button, state, _target, args);
-#else
   bool hasTarget = false;
 
   QString target = _target;
@@ -2309,9 +2306,11 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
   }
 
   KURL cURL = completeURL(url);
+#ifndef APPLE_CHANGES
   // special case for <a href="">
   if ( url.isEmpty() )
     cURL.setFileName( url );
+#endif
 
   if ( !cURL.isValid() )
     // ### ERROR HANDLING
@@ -2319,6 +2318,7 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
 
   //kdDebug( 6000 ) << "urlSelected: complete URL:" << cURL.url() << " target = " << target << endl;
 
+#ifndef APPLE_CHANGES
   if ( button == LeftButton && ( state & ShiftButton ) )
   {
     KIO::MetaData metaData;
@@ -2331,6 +2331,7 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
 			 i18n( "<qt>The link <B>%1</B><BR>leads from this untrusted page to your local filesystem.<BR>Do you want to follow the link?" ),
 			 i18n( "Follow" )))
     return;
+#endif
 
   args.frameName = target;
 
@@ -2345,6 +2346,10 @@ void KHTMLPart::urlSelected( const QString &url, int button, int state, const QS
   args.metaData().insert("ssl_was_in_use", d->m_ssl_in_use ? "TRUE":"FALSE");
   args.metaData().insert("ssl_activate_warnings", "TRUE");
 
+#ifdef APPLE_CHANGES
+  args.metaData()["referrer"] = d->m_referrer;
+  impl->urlSelected(cURL, button, state, args);
+#else
   if ( hasTarget )
   {
     // unknown frame names should open in a new window.
@@ -2942,9 +2947,6 @@ void KHTMLPart::submitFormAgain()
 
 void KHTMLPart::submitForm( const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary )
 {
-#ifdef APPLE_CHANGES
-  impl->submitForm(action, url, formData, _target, contentType, boundary);
-#else
   kdDebug(6000) << this << ": KHTMLPart::submitForm target=" << _target << " url=" << url << endl;
   KURL u = completeURL( url );
 
@@ -2954,6 +2956,7 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
     return;
   }
 
+#ifndef APPLE_CHANGES
   // Form security checks
   //
 
@@ -3011,6 +3014,7 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
 
   // End form security checks
   //
+#endif // APPLE_CHANGES
 
   QString urlstring = u.url();
 
@@ -3020,10 +3024,12 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
     return;
   }
 
+#ifndef APPLE_CHANGES
   if (!checkLinkSecurity(u,
 			 i18n( "<qt>The form will be submitted to <BR><B>%1</B><BR>on your local filesystem.<BR>Do you want to submit the form?" ),
 			 i18n( "Submit" )))
     return;
+#endif
 
   KParts::URLArgs args;
 
@@ -3096,6 +3102,9 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
       args.setContentType( "Content-Type: " + contentType + "; boundary=" + boundary );
   }
 
+#ifdef APPLE_CHANGES
+  impl->submitForm(u, args);
+#else
   if ( d->m_doc->parsing() || d->m_runningScripts > 0 ) {
     if( d->m_submitForm ) {
       kdDebug(6000) << "KHTMLPart::submitForm ABORTING!" << endl;
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 258c117..a51dfb5 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -84,11 +84,11 @@ public:
     KHTMLPart *findFrame(const QString &frameName);
     QPtrList<KParts::ReadOnlyPart> frames() const;
 
-    void urlSelected(const QString &url, int button, int state, const QString &_target, const KParts::URLArgs &);
+    void urlSelected(const KURL &url, int button, int state, const KParts::URLArgs &args);
     bool requestFrame(khtml::RenderPart *frame, const QString &url, const QString &frameName, const QStringList &params, bool isIFrame);
     bool requestObject(khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args);
 
-    void submitForm(const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary);
+    void submitForm(const KURL &url, const KParts::URLArgs &);
 
     void scheduleClose();
 
@@ -122,13 +122,15 @@ public:
 
     void redirectionTimerStartedOrStopped();
     
+    static NSString *referrer(const KParts::URLArgs &);
+
 private:
     WebCoreBridge *bridgeForFrameName(const QString &frameName);
 
     NSView *nextKeyViewInFrame(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static DOM::NodeImpl *nodeForWidget(QWidget *);
     static KWQKHTMLPartImpl *partForNode(DOM::NodeImpl *);
-
+    
     KHTMLPart *part;
     KHTMLPartPrivate *d;
     
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 2304f1b..fd732ae 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -128,13 +128,18 @@ WebCoreBridge *KWQKHTMLPartImpl::bridgeForFrameName(const QString &frameName)
 	    frame = [_bridge frameNamed:frameName.getNSString()];
 	}
         if (frame == nil) {
-	    frame = [bridge() openNewWindowWithURL:nil frameName:frameName.getNSString()];
+	    frame = [bridge() openNewWindowWithURL:nil referrer:nil frameName:frameName.getNSString()];
         }
     }
     
     return frame;
 }
 
+NSString *KWQKHTMLPartImpl::referrer(const URLArgs &args)
+{
+    return args.metaData()["referrer"].getNSString();
+}
+
 void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
 {
     NSURL *cocoaURL = url.getNSURL();
@@ -143,7 +148,7 @@ void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
         return;
     }
 
-    [bridgeForFrameName(args.frameName) loadURL:cocoaURL];
+    [bridgeForFrameName(args.frameName) loadURL:cocoaURL referrer:referrer(args)];
 }
 
 void KWQKHTMLPartImpl::slotData(NSString *encoding, bool forceEncoding, const char *bytes, int length, bool complete)
@@ -165,20 +170,9 @@ void KWQKHTMLPartImpl::slotData(NSString *encoding, bool forceEncoding, const ch
     part->write(bytes, length);
 }
 
-void KWQKHTMLPartImpl::urlSelected(const QString &url, int button, int state, const QString &_target, const URLArgs &args)
+void KWQKHTMLPartImpl::urlSelected(const KURL &url, int button, int state, const URLArgs &args)
 {
-    QString target = _target;
-    if (target.isEmpty() && d->m_doc) {
-        target = d->m_doc->baseTarget();
-    }
-
-    if (url.find("javascript:", 0, false) == 0) {
-        part->executeScript( url.right( url.length() - 11) );
-        return;
-    }
-
-    KURL clickedURL(part->completeURL(url));
-    NSURL *cocoaURL = clickedURL.getNSURL();
+    NSURL *cocoaURL = url.getNSURL();
     if (cocoaURL == nil) {
         // FIXME: Do we need to report an error to someone?
         return;
@@ -186,29 +180,29 @@ void KWQKHTMLPartImpl::urlSelected(const QString &url, int button, int state, co
     
     // Open new window on command-click
     if (state & MetaButton) {
-        [_bridge openNewWindowWithURL:cocoaURL frameName:nil];
+        [_bridge openNewWindowWithURL:cocoaURL referrer:referrer(args) frameName:nil];
         return;
     }
     
-    WebCoreBridge *targetBridge = bridgeForFrameName(target);
+    WebCoreBridge *targetBridge = bridgeForFrameName(args.frameName);
 
     // FIXME: KHTML does this in openURL -- we should do this at that level so we don't
     // have the complexity of dealing with the target here.
     KHTMLPart *targetPart = [targetBridge part];
     if (targetPart) {
-        KURL refLess(clickedURL);
+        KURL refLess(url);
         targetPart->m_url.setRef("");
         refLess.setRef("");
         if (refLess.url() == targetPart->m_url.url()) {
-            targetPart->m_url = clickedURL;
-            targetPart->gotoAnchor(clickedURL.ref());
+            targetPart->m_url = url;
+            targetPart->gotoAnchor(url.ref());
             // This URL needs to be added to the back/forward list.
-            [targetBridge addBackForwardItemWithURL:cocoaURL anchor:clickedURL.ref().getNSString()];
+            [targetBridge addBackForwardItemWithURL:cocoaURL anchor:url.ref().getNSString()];
             return;
         }
     }
     
-    [targetBridge loadURL:cocoaURL];
+    [targetBridge loadURL:cocoaURL referrer:referrer(args)];
 }
 
 bool KWQKHTMLPartImpl::requestFrame( RenderPart *frame, const QString &url, const QString &frameName,
@@ -291,74 +285,14 @@ bool KWQKHTMLPartImpl::requestObject(RenderPart *frame, const QString &url, cons
     return true;
 }
 
-void KWQKHTMLPartImpl::submitForm(const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary)
+void KWQKHTMLPartImpl::submitForm(const KURL &u, const URLArgs &args)
 {
-    QString target = _target;
-    if (target.isEmpty() && d->m_doc) {
-        target = d->m_doc->baseTarget();
-    }
-
-    KURL u = part->completeURL( url );
-    if (u.isMalformed()) {
-        // ### ERROR HANDLING!
-        return;
-    }
-
-    QString urlstring = u.url();
-    if (urlstring.find("javascript:", 0, false) == 0) {
-        urlstring = KURL::decode_string(urlstring);
-        part->executeScript(urlstring.right(urlstring.length() - 11));
-        return;
-    }
-
-#ifdef NEED_THIS
-  if (!checkLinkSecurity(u,
-			 i18n( "<qt>The form will be submitted to <BR><B>%1</B><BR>on your local filesystem.<BR>Do you want to submit the form?" ),
-			 i18n( "Submit" )))
-    return;
-#endif
-
-#ifdef NEED_THIS
-  if (!d->m_referrer.isEmpty())
-     args.metaData()["referrer"] = d->m_referrer;
-  args.metaData().insert("main_frame_request",
-                         parentPart() == 0 ? "TRUE":"FALSE");
-  args.metaData().insert("ssl_was_in_use", d->m_ssl_in_use ? "TRUE":"FALSE");
-  args.metaData().insert("ssl_activate_warnings", "TRUE");
-#endif
-
-    if (strcmp(action, "get") == 0) {
-	u.setQuery(QString(formData.data(), formData.size()));
-	[bridgeForFrameName(target) loadURL:u.getNSURL()];
+    if (!args.doPost()) {
+	[bridgeForFrameName(args.frameName) loadURL:u.getNSURL() referrer:referrer(args)];
     } else {
-#ifdef NEED_THIS
-    // construct some user headers if necessary
-    if (contentType.isNull() || contentType == "application/x-www-form-urlencoded")
-      args.setContentType( "Content-Type: application/x-www-form-urlencoded" );
-    else // contentType must be "multipart/form-data"
-      args.setContentType( "Content-Type: " + contentType + "; boundary=" + boundary );
-#endif
-	NSData *postData = [NSData dataWithBytes:formData.data() length:formData.size()];
-	[bridgeForFrameName(target) postWithURL:u.getNSURL() data:postData];
+	NSData *postData = [NSData dataWithBytes:args.postData.data() length:args.postData.size()];
+	[bridgeForFrameName(args.frameName) postWithURL:u.getNSURL() referrer:referrer(args) data:postData];
     }
-
-#ifdef NEED_THIS
-  if ( d->m_bParsing || d->m_runningScripts > 0 ) {
-    if( d->m_submitForm ) {
-        return;
-    }
-    d->m_submitForm = new KHTMLPartPrivate::SubmitForm;
-    d->m_submitForm->submitAction = action;
-    d->m_submitForm->submitUrl = url;
-    d->m_submitForm->submitFormData = formData;
-    d->m_submitForm->target = _target;
-    d->m_submitForm->submitContentType = contentType;
-    d->m_submitForm->submitBoundary = boundary;
-    connect(this, SIGNAL(completed()), this, SLOT(submitFormAgain()));
-  }
-  else
-    emit d->m_extension->openURLRequest( u, args );
-#endif
 }
 
 bool KWQKHTMLPartImpl::frameExists(const QString &frameName)
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
index d4147e4..425861d 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
@@ -73,7 +73,9 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
     }
 
     NSURL *cocoaURL = url.isEmpty() ? nil : url.getNSURL();
-    bridge = [m_part->impl->bridge() openNewWindowWithURL:cocoaURL frameName:frameName];
+    bridge = [m_part->impl->bridge() openNewWindowWithURL:cocoaURL
+         referrer:KWQKHTMLPartImpl::referrer(urlArgs)
+         frameName:frameName];
     
     if (!winArgs.toolBarsVisible) {
 	[bridge setToolbarsVisible:NO];
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.h b/WebCore/kwq/KWQKHTMLPartImpl.h
index 258c117..a51dfb5 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.h
+++ b/WebCore/kwq/KWQKHTMLPartImpl.h
@@ -84,11 +84,11 @@ public:
     KHTMLPart *findFrame(const QString &frameName);
     QPtrList<KParts::ReadOnlyPart> frames() const;
 
-    void urlSelected(const QString &url, int button, int state, const QString &_target, const KParts::URLArgs &);
+    void urlSelected(const KURL &url, int button, int state, const KParts::URLArgs &args);
     bool requestFrame(khtml::RenderPart *frame, const QString &url, const QString &frameName, const QStringList &params, bool isIFrame);
     bool requestObject(khtml::RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args);
 
-    void submitForm(const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary);
+    void submitForm(const KURL &url, const KParts::URLArgs &);
 
     void scheduleClose();
 
@@ -122,13 +122,15 @@ public:
 
     void redirectionTimerStartedOrStopped();
     
+    static NSString *referrer(const KParts::URLArgs &);
+
 private:
     WebCoreBridge *bridgeForFrameName(const QString &frameName);
 
     NSView *nextKeyViewInFrame(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static DOM::NodeImpl *nodeForWidget(QWidget *);
     static KWQKHTMLPartImpl *partForNode(DOM::NodeImpl *);
-
+    
     KHTMLPart *part;
     KHTMLPartPrivate *d;
     
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 2304f1b..fd732ae 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -128,13 +128,18 @@ WebCoreBridge *KWQKHTMLPartImpl::bridgeForFrameName(const QString &frameName)
 	    frame = [_bridge frameNamed:frameName.getNSString()];
 	}
         if (frame == nil) {
-	    frame = [bridge() openNewWindowWithURL:nil frameName:frameName.getNSString()];
+	    frame = [bridge() openNewWindowWithURL:nil referrer:nil frameName:frameName.getNSString()];
         }
     }
     
     return frame;
 }
 
+NSString *KWQKHTMLPartImpl::referrer(const URLArgs &args)
+{
+    return args.metaData()["referrer"].getNSString();
+}
+
 void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
 {
     NSURL *cocoaURL = url.getNSURL();
@@ -143,7 +148,7 @@ void KWQKHTMLPartImpl::openURLRequest(const KURL &url, const URLArgs &args)
         return;
     }
 
-    [bridgeForFrameName(args.frameName) loadURL:cocoaURL];
+    [bridgeForFrameName(args.frameName) loadURL:cocoaURL referrer:referrer(args)];
 }
 
 void KWQKHTMLPartImpl::slotData(NSString *encoding, bool forceEncoding, const char *bytes, int length, bool complete)
@@ -165,20 +170,9 @@ void KWQKHTMLPartImpl::slotData(NSString *encoding, bool forceEncoding, const ch
     part->write(bytes, length);
 }
 
-void KWQKHTMLPartImpl::urlSelected(const QString &url, int button, int state, const QString &_target, const URLArgs &args)
+void KWQKHTMLPartImpl::urlSelected(const KURL &url, int button, int state, const URLArgs &args)
 {
-    QString target = _target;
-    if (target.isEmpty() && d->m_doc) {
-        target = d->m_doc->baseTarget();
-    }
-
-    if (url.find("javascript:", 0, false) == 0) {
-        part->executeScript( url.right( url.length() - 11) );
-        return;
-    }
-
-    KURL clickedURL(part->completeURL(url));
-    NSURL *cocoaURL = clickedURL.getNSURL();
+    NSURL *cocoaURL = url.getNSURL();
     if (cocoaURL == nil) {
         // FIXME: Do we need to report an error to someone?
         return;
@@ -186,29 +180,29 @@ void KWQKHTMLPartImpl::urlSelected(const QString &url, int button, int state, co
     
     // Open new window on command-click
     if (state & MetaButton) {
-        [_bridge openNewWindowWithURL:cocoaURL frameName:nil];
+        [_bridge openNewWindowWithURL:cocoaURL referrer:referrer(args) frameName:nil];
         return;
     }
     
-    WebCoreBridge *targetBridge = bridgeForFrameName(target);
+    WebCoreBridge *targetBridge = bridgeForFrameName(args.frameName);
 
     // FIXME: KHTML does this in openURL -- we should do this at that level so we don't
     // have the complexity of dealing with the target here.
     KHTMLPart *targetPart = [targetBridge part];
     if (targetPart) {
-        KURL refLess(clickedURL);
+        KURL refLess(url);
         targetPart->m_url.setRef("");
         refLess.setRef("");
         if (refLess.url() == targetPart->m_url.url()) {
-            targetPart->m_url = clickedURL;
-            targetPart->gotoAnchor(clickedURL.ref());
+            targetPart->m_url = url;
+            targetPart->gotoAnchor(url.ref());
             // This URL needs to be added to the back/forward list.
-            [targetBridge addBackForwardItemWithURL:cocoaURL anchor:clickedURL.ref().getNSString()];
+            [targetBridge addBackForwardItemWithURL:cocoaURL anchor:url.ref().getNSString()];
             return;
         }
     }
     
-    [targetBridge loadURL:cocoaURL];
+    [targetBridge loadURL:cocoaURL referrer:referrer(args)];
 }
 
 bool KWQKHTMLPartImpl::requestFrame( RenderPart *frame, const QString &url, const QString &frameName,
@@ -291,74 +285,14 @@ bool KWQKHTMLPartImpl::requestObject(RenderPart *frame, const QString &url, cons
     return true;
 }
 
-void KWQKHTMLPartImpl::submitForm(const char *action, const QString &url, const QByteArray &formData, const QString &_target, const QString& contentType, const QString& boundary)
+void KWQKHTMLPartImpl::submitForm(const KURL &u, const URLArgs &args)
 {
-    QString target = _target;
-    if (target.isEmpty() && d->m_doc) {
-        target = d->m_doc->baseTarget();
-    }
-
-    KURL u = part->completeURL( url );
-    if (u.isMalformed()) {
-        // ### ERROR HANDLING!
-        return;
-    }
-
-    QString urlstring = u.url();
-    if (urlstring.find("javascript:", 0, false) == 0) {
-        urlstring = KURL::decode_string(urlstring);
-        part->executeScript(urlstring.right(urlstring.length() - 11));
-        return;
-    }
-
-#ifdef NEED_THIS
-  if (!checkLinkSecurity(u,
-			 i18n( "<qt>The form will be submitted to <BR><B>%1</B><BR>on your local filesystem.<BR>Do you want to submit the form?" ),
-			 i18n( "Submit" )))
-    return;
-#endif
-
-#ifdef NEED_THIS
-  if (!d->m_referrer.isEmpty())
-     args.metaData()["referrer"] = d->m_referrer;
-  args.metaData().insert("main_frame_request",
-                         parentPart() == 0 ? "TRUE":"FALSE");
-  args.metaData().insert("ssl_was_in_use", d->m_ssl_in_use ? "TRUE":"FALSE");
-  args.metaData().insert("ssl_activate_warnings", "TRUE");
-#endif
-
-    if (strcmp(action, "get") == 0) {
-	u.setQuery(QString(formData.data(), formData.size()));
-	[bridgeForFrameName(target) loadURL:u.getNSURL()];
+    if (!args.doPost()) {
+	[bridgeForFrameName(args.frameName) loadURL:u.getNSURL() referrer:referrer(args)];
     } else {
-#ifdef NEED_THIS
-    // construct some user headers if necessary
-    if (contentType.isNull() || contentType == "application/x-www-form-urlencoded")
-      args.setContentType( "Content-Type: application/x-www-form-urlencoded" );
-    else // contentType must be "multipart/form-data"
-      args.setContentType( "Content-Type: " + contentType + "; boundary=" + boundary );
-#endif
-	NSData *postData = [NSData dataWithBytes:formData.data() length:formData.size()];
-	[bridgeForFrameName(target) postWithURL:u.getNSURL() data:postData];
+	NSData *postData = [NSData dataWithBytes:args.postData.data() length:args.postData.size()];
+	[bridgeForFrameName(args.frameName) postWithURL:u.getNSURL() referrer:referrer(args) data:postData];
     }
-
-#ifdef NEED_THIS
-  if ( d->m_bParsing || d->m_runningScripts > 0 ) {
-    if( d->m_submitForm ) {
-        return;
-    }
-    d->m_submitForm = new KHTMLPartPrivate::SubmitForm;
-    d->m_submitForm->submitAction = action;
-    d->m_submitForm->submitUrl = url;
-    d->m_submitForm->submitFormData = formData;
-    d->m_submitForm->target = _target;
-    d->m_submitForm->submitContentType = contentType;
-    d->m_submitForm->submitBoundary = boundary;
-    connect(this, SIGNAL(completed()), this, SLOT(submitFormAgain()));
-  }
-  else
-    emit d->m_extension->openURLRequest( u, args );
-#endif
 }
 
 bool KWQKHTMLPartImpl::frameExists(const QString &frameName)
diff --git a/WebCore/kwq/KWQKMessageBox.mm b/WebCore/kwq/KWQKMessageBox.mm
index cdd83d7..c097109 100644
--- a/WebCore/kwq/KWQKMessageBox.mm
+++ b/WebCore/kwq/KWQKMessageBox.mm
@@ -83,3 +83,8 @@ void KMessageBox::sorry(QWidget *, const QString &message,
     else
         NSRunAlertPanel(caption.getNSString(), message.getNSString(), nil, nil, nil);
 }
+
+void KMessageBox::information(QWidget *, const QString &message, const QString &, const char *)
+{
+    NSRunAlertPanel(nil, message.getNSString(), nil, nil, nil);
+}
diff --git a/WebCore/kwq/KWQKPartsBrowserExtension.h b/WebCore/kwq/KWQKPartsBrowserExtension.h
index 7e74d84..23bdaa9 100644
--- a/WebCore/kwq/KWQKPartsBrowserExtension.h
+++ b/WebCore/kwq/KWQKPartsBrowserExtension.h
@@ -48,16 +48,23 @@ struct URLArgs {
     int xOffset;
     int yOffset;
 
-    URLArgs() : xOffset(0), yOffset(0) { }
+    URLArgs() : xOffset(0), yOffset(0), m_doPost(false) { }
     
-    QString contentType() const { return QString::null; }
-    bool doPost() const { return false; }
+    QString contentType() const { return m_contentType; }
+    void setContentType(const QString &t) { m_contentType = t; }
+
+    bool doPost() const { return m_doPost; }
+    void setDoPost(bool post) { m_doPost = post; }
     
-    QMap<QString, QString> &metaData() { return m_metadata; }
     void setLockHistory(bool) { }
 
+    QMap<QString, QString> &metaData() { return m_metadata; }
+    const QMap<QString, QString> &metaData() const { return m_metadata; }
+
 private:
     QMap<QString, QString> m_metadata;
+    bool m_doPost;
+    QString m_contentType;
 
 };
 
diff --git a/WebCore/kwq/KWQKURL.h b/WebCore/kwq/KWQKURL.h
index a2831f6..041b2d0 100644
--- a/WebCore/kwq/KWQKURL.h
+++ b/WebCore/kwq/KWQKURL.h
@@ -43,12 +43,12 @@ public:
     KURL(const KURL &, const QString &);
     KURL(const QString &, int encoding_hint=0);
     
-    inline bool isEmpty() const { return urlString.isEmpty(); } 
-    inline bool isMalformed() const { return !m_isValid; }
-    inline bool isValid() const { return m_isValid; }
+    bool isEmpty() const { return urlString.isEmpty(); } 
+    bool isMalformed() const { return !m_isValid; }
+    bool isValid() const { return m_isValid; }
     bool hasPath() const;
 
-    inline QString url() const { return urlString; }
+    QString url() const { return urlString; }
     QString protocol() const;
     QString host() const;
     unsigned short int port() const;
@@ -72,7 +72,8 @@ public:
     
     NSURL *getNSURL() const;
 
-    static QString decode_string(const QString &urlString);
+    static QString decode_string(const QString &);
+    static QString encode_string(const QString &);
     
     friend bool operator==(const KURL &, const KURL &);
 
diff --git a/WebCore/kwq/KWQKURL.mm b/WebCore/kwq/KWQKURL.mm
index e056fec..e97b422 100644
--- a/WebCore/kwq/KWQKURL.mm
+++ b/WebCore/kwq/KWQKURL.mm
@@ -25,6 +25,8 @@
 
 #import <kurl.h>
 
+#import <KWQAssertions.h>
+
 typedef enum {
     // alpha 
     SchemeFirstChar = 1 << 0,
@@ -53,6 +55,8 @@ typedef enum {
     BadChar = 1 << 7
 } URLCharacterClasses;
 
+static const char hexDigits[17] = "0123456789ABCDEF";
+
 static const unsigned char characterClassTable[256] = {
     /* 0 nul */ PathSegmentEndChar,    /* 1 soh */ BadChar,
     /* 2 stx */ BadChar,    /* 3 etx */ BadChar,    
@@ -292,16 +296,13 @@ KURL::KURL(const KURL &base, const QString &relative)
 
 		char static_buffer[2048];
 		char *buffer;
-		bool usingStaticBuffer;
 		
-		size_t bufferLength = base.portEndPos + relative.length() + 1;
+		size_t bufferLength = base.pathEndPos + relative.length() + 1;
 
-		if (bufferLength > 2048) {
-		    buffer = (char *)malloc(bufferLength * sizeof(char));
-		    usingStaticBuffer = false;
+		if (bufferLength > sizeof(static_buffer)) {
+		    buffer = (char *)malloc(bufferLength);
 		} else {
 		    buffer = static_buffer;
-		    usingStaticBuffer = true;
 		}
 		
 		char *bufferPos = buffer;
@@ -398,8 +399,10 @@ KURL::KURL(const KURL &base, const QString &relative)
 		strcpy(bufferPos, relStringPos);
 
 		parse(buffer, NULL);
+                
+                ASSERT(strlen(buffer) + 1 <= bufferLength);
 		
-		if (!usingStaticBuffer) {
+		if (buffer != static_buffer) {
 		    free(buffer);
 		}
 		
@@ -632,8 +635,6 @@ QString KURL::decode_string(const QString& urlString)
     return qUnescaped;
 }
 
-const char * const hexDigits="0123456789ABCDEF";
-
 static void appendEscapingBadChars(char*& buffer, const char *strStart, size_t length)
 {
     char *p = buffer;
@@ -658,7 +659,6 @@ static void appendEscapingBadChars(char*& buffer, const char *strStart, size_t l
     buffer = p;
 }
 
-
 void KURL::parse(const char *url, const QString *originalString)
 {
     m_isValid = true;
@@ -827,15 +827,12 @@ void KURL::parse(const char *url, const QString *originalString)
     // assemble it all, remembering the real ranges
 
     char static_buffer[4096];
-    bool usingStaticBuffer;
     char *buffer;
-    int bufferLength = fragmentEnd * 3 + 1;
-    if (bufferLength <= 4096) {
+    uint bufferLength = fragmentEnd * 3 + 1;
+    if (bufferLength <= sizeof(static_buffer)) {
 	buffer = static_buffer;
-	usingStaticBuffer = true;
     } else {
-	buffer = (char *)malloc(bufferLength * sizeof(char));
-	usingStaticBuffer = false;
+	buffer = (char *)malloc(bufferLength);
     }
 
     char *p = buffer;
@@ -928,7 +925,9 @@ void KURL::parse(const char *url, const QString *originalString)
 	urlString = QString(buffer, fragmentEndPos);
     }
 
-    if (!usingStaticBuffer) {
+    ASSERT(p - buffer <= (int)bufferLength);
+		
+    if (buffer != static_buffer) {
 	free(buffer);
     }
 }
@@ -965,3 +964,30 @@ bool urlcmp(const QString &a, const QString &b, bool, bool)
 {
     return a == b;
 }
+
+QString KURL::encode_string(const QString& notEncodedString)
+{
+    QCString asUTF8 = notEncodedString.utf8();
+    
+    char static_buffer[4096];
+    char *buffer;
+    uint bufferLength = asUTF8.length() * 3 + 1;
+    if (bufferLength <= sizeof(static_buffer)) {
+	buffer = static_buffer;
+    } else {
+	buffer = (char *)malloc(bufferLength);
+    }
+    
+    char *p = buffer;
+    appendEscapingBadChars(p, asUTF8, asUTF8.length());
+    
+    QString result(buffer, p - buffer);
+    
+    ASSERT(p - buffer <= (int)bufferLength);
+		
+    if (buffer != static_buffer) {
+	free(buffer);
+    }
+
+    return result;
+}
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index 0bd3639..3689207 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -105,7 +105,8 @@ bool KWQServeRequest(Loader *loader, Request *request, TransferJob *job)
     }
     
     WebCoreResourceLoader *resourceLoader = [[WebCoreResourceLoader alloc] initWithLoader:loader job:job];
-    id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:URL];
+    id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader
+        withURL:URL referrer:job->queryMetaData("referrer").getNSString()];
     [resourceLoader release];
 
     if (handle == nil) {
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index 0bd3639..3689207 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -105,7 +105,8 @@ bool KWQServeRequest(Loader *loader, Request *request, TransferJob *job)
     }
     
     WebCoreResourceLoader *resourceLoader = [[WebCoreResourceLoader alloc] initWithLoader:loader job:job];
-    id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:URL];
+    id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader
+        withURL:URL referrer:job->queryMetaData("referrer").getNSString()];
     [resourceLoader release];
 
     if (handle == nil) {
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index 288aadc..9a4a060 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -338,6 +338,7 @@ public:
     ~QString();
 
     static QString fromLatin1(const char *);
+    static QString fromLatin1(const char *, int len);
     static QString fromStringWithEncoding(const char *, int, CFStringEncoding);
     static QString fromCFString(CFStringRef);
     static QString fromNSString(NSString *);
@@ -520,6 +521,11 @@ inline QString QString::fromLatin1(const char *chs)
     return chs;
 }
 
+inline QString QString::fromLatin1(const char *chs, int length)
+{
+    return QString(chs, length);
+}
+
 inline const char *QString::ascii() const
 {
     return latin1();
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 9a7f170..25e4f9d 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -142,9 +142,9 @@ typedef khtml::RenderPart KHTMLRenderPart;
 - (WebCoreBridge *)mainFrame;
 - (WebCoreBridge *)frameNamed:(NSString *)name; // searches entire hierarchy starting with mainFrame
 
-- (void)loadURL:(NSURL *)URL;
-- (void)postWithURL:(NSURL *)URL data:(NSData *)data;
-- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
+- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer;
+- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer data:(NSData *)data;
+- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer frameName:(NSString *)name;
 
 - (NSString *)userAgentForURL:(NSURL *)URL;
 
@@ -167,7 +167,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
 - (NSWindow *)window;
 - (void)setWindowFrame:(NSRect)frame;
 
-- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL;
+- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL referrer:(NSString *)referrer;
 - (void)reportBadURL:(NSString *)badURL;
 - (void)objectLoadedFromCache:(NSURL *)URL size:(unsigned)bytes;
 - (BOOL)isReloading;
diff --git a/WebCore/kwq/kdecore/kurl.h b/WebCore/kwq/kdecore/kurl.h
index a2831f6..041b2d0 100644
--- a/WebCore/kwq/kdecore/kurl.h
+++ b/WebCore/kwq/kdecore/kurl.h
@@ -43,12 +43,12 @@ public:
     KURL(const KURL &, const QString &);
     KURL(const QString &, int encoding_hint=0);
     
-    inline bool isEmpty() const { return urlString.isEmpty(); } 
-    inline bool isMalformed() const { return !m_isValid; }
-    inline bool isValid() const { return m_isValid; }
+    bool isEmpty() const { return urlString.isEmpty(); } 
+    bool isMalformed() const { return !m_isValid; }
+    bool isValid() const { return m_isValid; }
     bool hasPath() const;
 
-    inline QString url() const { return urlString; }
+    QString url() const { return urlString; }
     QString protocol() const;
     QString host() const;
     unsigned short int port() const;
@@ -72,7 +72,8 @@ public:
     
     NSURL *getNSURL() const;
 
-    static QString decode_string(const QString &urlString);
+    static QString decode_string(const QString &);
+    static QString encode_string(const QString &);
     
     friend bool operator==(const KURL &, const KURL &);
 
diff --git a/WebCore/kwq/kdeui/kmessagebox.h b/WebCore/kwq/kdeui/kmessagebox.h
index 986c59d..8f77bc5 100644
--- a/WebCore/kwq/kdeui/kmessagebox.h
+++ b/WebCore/kwq/kdeui/kmessagebox.h
@@ -33,6 +33,9 @@ class KMessageBox {
 public:
     enum { Ok = 1, Cancel = 2, Yes = 3, No = 4, Continue = 5 };
 
+    static void information(QWidget *, const QString &information, 
+        const QString &, const char *);
+   
     static void error(QWidget *, const QString &, 
         const QString &caption=QString::null, bool notify=true);
    
diff --git a/WebCore/kwq/kparts/browserextension.h b/WebCore/kwq/kparts/browserextension.h
index 7e74d84..23bdaa9 100644
--- a/WebCore/kwq/kparts/browserextension.h
+++ b/WebCore/kwq/kparts/browserextension.h
@@ -48,16 +48,23 @@ struct URLArgs {
     int xOffset;
     int yOffset;
 
-    URLArgs() : xOffset(0), yOffset(0) { }
+    URLArgs() : xOffset(0), yOffset(0), m_doPost(false) { }
     
-    QString contentType() const { return QString::null; }
-    bool doPost() const { return false; }
+    QString contentType() const { return m_contentType; }
+    void setContentType(const QString &t) { m_contentType = t; }
+
+    bool doPost() const { return m_doPost; }
+    void setDoPost(bool post) { m_doPost = post; }
     
-    QMap<QString, QString> &metaData() { return m_metadata; }
     void setLockHistory(bool) { }
 
+    QMap<QString, QString> &metaData() { return m_metadata; }
+    const QMap<QString, QString> &metaData() const { return m_metadata; }
+
 private:
     QMap<QString, QString> m_metadata;
+    bool m_doPost;
+    QString m_contentType;
 
 };
 
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index 288aadc..9a4a060 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -338,6 +338,7 @@ public:
     ~QString();
 
     static QString fromLatin1(const char *);
+    static QString fromLatin1(const char *, int len);
     static QString fromStringWithEncoding(const char *, int, CFStringEncoding);
     static QString fromCFString(CFStringRef);
     static QString fromNSString(NSString *);
@@ -520,6 +521,11 @@ inline QString QString::fromLatin1(const char *chs)
     return chs;
 }
 
+inline QString QString::fromLatin1(const char *chs, int length)
+{
+    return QString(chs, length);
+}
+
 inline const char *QString::ascii() const
 {
     return latin1();
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index e614874..aacfbc1 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,48 @@
+2002-09-10  Darin Adler  <darin at apple.com>
+
+	WebKit part of support for the "Referer" header.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge openNewWindowWithURL:referrer:frameName:]): Add referrer parameter,
+	and pass it on to the window context method.
+        (-[WebBridge addAttributeForReferrer:toDictionary:]): Added.
+        (-[WebBridge attributesForReferrer:]): Added.
+        (-[WebBridge startLoadingResource:withURL:referrer:]): Put the referrer into an
+	attributes dictionary and pass it to the WebSubresourceClient method.
+        (-[WebBridge loadURL:referrer:]): Put the referrer into an attributes dictionary
+	and pass it along.
+        (-[WebBridge postWithURL:referrer:data:]): Put the referrer into an attributes
+	dictionary and pass it along.
+
+        * WebCoreSupport.subproj/WebSubresourceClient.h: Add an attributes parameter to
+	the method that starts loading.
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (+[WebSubresourceClient startLoadingResource:withURL:attributes:forDataSource:]):
+	Put the attributes into the WebResourceRequest.
+
+        * WebView.subproj/WebController.h: Add a referrer parameter to the WebWindowContext
+	openNewWindowWithURL method.
+        * WebView.subproj/WebDefaultContextMenuHandler.m:
+        (-[WebDefaultContextMenuHandler openNewWindowWithURL:referrer:]): Pass the referrer
+	on to the window context.
+        (-[WebDefaultContextMenuHandler openLinkInNewWindow:]): Pass nil for the referrer
+	for now. Not sure if this is best.
+        (-[WebDefaultContextMenuHandler openImageInNewWindow:]): Ditto.
+        (-[WebDefaultContextMenuHandler openFrameInNewWindow:]): Ditto.
+
+        * WebView.subproj/WebFrame.m: (-[WebFrame frameNamed:]): Pass nil for the referrer
+	here where we are creating a new empty window.
+
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (-[WebHTMLView _continueAfterClickPolicyForEvent:]): Pass nil for the referrer here
+	in the WebClickPolicyOpenNewWindow. The policy API doesn't provide a way for the
+	policy handler to specify the referrer; we might want to change that later.
+
+        * Plugins.subproj/WebPluginView.m:
+        (-[WebNetscapePluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
+	Pass nil for the referrer here. But it seems wrong that this function discards
+	the handle attributes that are passed in for the case where it opens a new window.
+
 2002-09-11  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3048158 - Crash at google in _destroyInitializingClassList
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index e614874..aacfbc1 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,48 @@
+2002-09-10  Darin Adler  <darin at apple.com>
+
+	WebKit part of support for the "Referer" header.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge openNewWindowWithURL:referrer:frameName:]): Add referrer parameter,
+	and pass it on to the window context method.
+        (-[WebBridge addAttributeForReferrer:toDictionary:]): Added.
+        (-[WebBridge attributesForReferrer:]): Added.
+        (-[WebBridge startLoadingResource:withURL:referrer:]): Put the referrer into an
+	attributes dictionary and pass it to the WebSubresourceClient method.
+        (-[WebBridge loadURL:referrer:]): Put the referrer into an attributes dictionary
+	and pass it along.
+        (-[WebBridge postWithURL:referrer:data:]): Put the referrer into an attributes
+	dictionary and pass it along.
+
+        * WebCoreSupport.subproj/WebSubresourceClient.h: Add an attributes parameter to
+	the method that starts loading.
+        * WebCoreSupport.subproj/WebSubresourceClient.m:
+        (+[WebSubresourceClient startLoadingResource:withURL:attributes:forDataSource:]):
+	Put the attributes into the WebResourceRequest.
+
+        * WebView.subproj/WebController.h: Add a referrer parameter to the WebWindowContext
+	openNewWindowWithURL method.
+        * WebView.subproj/WebDefaultContextMenuHandler.m:
+        (-[WebDefaultContextMenuHandler openNewWindowWithURL:referrer:]): Pass the referrer
+	on to the window context.
+        (-[WebDefaultContextMenuHandler openLinkInNewWindow:]): Pass nil for the referrer
+	for now. Not sure if this is best.
+        (-[WebDefaultContextMenuHandler openImageInNewWindow:]): Ditto.
+        (-[WebDefaultContextMenuHandler openFrameInNewWindow:]): Ditto.
+
+        * WebView.subproj/WebFrame.m: (-[WebFrame frameNamed:]): Pass nil for the referrer
+	here where we are creating a new empty window.
+
+        * WebView.subproj/WebHTMLViewPrivate.m:
+        (-[WebHTMLView _continueAfterClickPolicyForEvent:]): Pass nil for the referrer here
+	in the WebClickPolicyOpenNewWindow. The policy API doesn't provide a way for the
+	policy handler to specify the referrer; we might want to change that later.
+
+        * Plugins.subproj/WebPluginView.m:
+        (-[WebNetscapePluginView loadURL:inTarget:withNotifyData:andHandleAttributes:]):
+	Pass nil for the referrer here. But it seems wrong that this function discards
+	the handle attributes that are passed in for the case where it opens a new window.
+
 2002-09-11  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3048158 - Crash at google in _destroyInitializingClassList
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index 4dbee48..e5a0329 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -837,7 +837,7 @@
 
 @implementation WebNetscapePluginView (WebNPPCallbacks)
 
-- (NPError) loadURL:(NSString *)URLString inTarget:(NSString *)target withNotifyData:(void *)notifyData andHandleAttributes:(NSDictionary *)attributes
+- (NPError)loadURL:(NSString *)URLString inTarget:(NSString *)target withNotifyData:(void *)notifyData andHandleAttributes:(NSDictionary *)attributes
 {
     WebNetscapePluginStream *stream;
     WebDataSource *dataSource;
@@ -864,7 +864,8 @@
     }else{
         frame = [webFrame frameNamed:target];
         if(!frame){
-            [[webController windowContext] openNewWindowWithURL:URL];
+            // FIXME: Why is it OK to just discard all the attributes in this case?
+            [[webController windowContext] openNewWindowWithURL:URL referrer:nil];
             // FIXME: Need to send NPP_URLNotify at the right time.
             // FIXME: Need to name new frame
             if(notifyData)
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 41aaa59..759feeb 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -87,15 +87,13 @@
     return [newFrame _bridge];
 }
 
-- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)URL frameName:(NSString *)name
+- (WebCoreBridge *)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer frameName:(NSString *)name
 {
     ASSERT(frame != nil);
 
-    WebController *newController = [[[frame controller] windowContext] openNewWindowWithURL:URL];
+    WebController *newController = [[[frame controller] windowContext] openNewWindowWithURL:URL referrer:referrer];
     [newController _setTopLevelFrameName:name];
-
     WebFrame *newFrame = [newController mainFrame];
-
     return [newFrame _bridge];
 }
 
@@ -181,9 +179,29 @@
     }
 }
 
-- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)resourceLoader withURL:(NSURL *)URL
+- (void)addAttributeForReferrer:(NSString *)referrer toDictionary:(NSMutableDictionary *)attributes
+{
+    if ([referrer length] == 0) {
+        return;
+    }
+    NSDictionary *headers = [NSDictionary dictionaryWithObject:[[referrer copy] autorelease] forKey:@"Referer"]; // note the misspelling
+    [attributes setObject:headers forKey:WebHTTPResourceHandleRequestHeaders];
+}
+
+- (NSDictionary *)attributesForReferrer:(NSString *)referrer
+{
+    if ([referrer length] == 0) {
+        return nil;
+    }
+    NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
+    [self addAttributeForReferrer:referrer toDictionary:attributes];
+    return attributes;
+}
+
+- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)resourceLoader withURL:(NSURL *)URL referrer:(NSString *)referrer
 {
-    return [WebSubresourceClient startLoadingResource:resourceLoader withURL:URL dataSource:[self dataSource]];
+    return [WebSubresourceClient startLoadingResource:resourceLoader withURL:URL
+        attributes:[self attributesForReferrer:referrer] forDataSource:[self dataSource]];
 }
 
 - (void)objectLoadedFromCache:(NSURL *)URL size:(unsigned)bytes
@@ -276,21 +294,22 @@
     [newDataSource release];
 }
 
-- (void)loadURL:(NSURL *)URL
+- (void)loadURL:(NSURL *)URL referrer:(NSString *)referrer
 {
-    [self loadURL:URL attributes:nil flags:0 withParent:[[frame dataSource] parent]];
+    [self loadURL:URL attributes:[self attributesForReferrer:referrer] flags:0 withParent:[[frame dataSource] parent]];
 }
 
-- (void)postWithURL:(NSURL *)URL data:(NSData *)data
+- (void)postWithURL:(NSURL *)URL referrer:(NSString *)referrer data:(NSData *)data
 {
     // When posting, use the WebResourceHandleFlagLoadFromOrigin load flag. 
     // This prevents a potential bug which may cause a page
     // with a form that uses itself as an action to be returned 
     // from the cache without submitting.
-    NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:
+    NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
         data, WebHTTPResourceHandleRequestData,
         @"POST", WebHTTPResourceHandleRequestMethod,
         nil];
+    [self addAttributeForReferrer:referrer toDictionary:attributes];
     [self loadURL:URL attributes:attributes flags:WebResourceHandleFlagLoadFromOrigin withParent:[[frame dataSource] parent]];
     [attributes release];
 }
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
index 9963947..bcbdde8 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.h
@@ -21,7 +21,7 @@
 }
 
 + (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)resourceLoader
-    withURL:(NSURL *)URL dataSource:(WebDataSource *)dataSource;
+    withURL:(NSURL *)URL attributes:(NSDictionary *)attributes forDataSource:(WebDataSource *)dataSource;
 
 - (WebResourceHandle *)handle;
 
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
index ec69168..d1ca3fd 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceClient.m
@@ -66,10 +66,10 @@
 }
 
 + (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
-    withURL:(NSURL *)URL dataSource:(WebDataSource *)source
+    withURL:(NSURL *)URL attributes:(NSDictionary *)attributes forDataSource:(WebDataSource *)source
 {
     WebSubresourceClient *client = [[self alloc] initWithLoader:rLoader dataSource:source];
-    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL attributes:nil flags:[source flags]];
+    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL attributes:attributes flags:[source flags]];
     WebResourceHandle *h = [[[WebResourceHandle alloc] initWithRequest:request client:client] autorelease];
     [request release];
     
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
index 9963947..bcbdde8 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.h
@@ -21,7 +21,7 @@
 }
 
 + (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)resourceLoader
-    withURL:(NSURL *)URL dataSource:(WebDataSource *)dataSource;
+    withURL:(NSURL *)URL attributes:(NSDictionary *)attributes forDataSource:(WebDataSource *)dataSource;
 
 - (WebResourceHandle *)handle;
 
diff --git a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
index ec69168..d1ca3fd 100644
--- a/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
+++ b/WebKit/WebCoreSupport.subproj/WebSubresourceLoader.m
@@ -66,10 +66,10 @@
 }
 
 + (WebSubresourceClient *)startLoadingResource:(id <WebCoreResourceLoader>)rLoader
-    withURL:(NSURL *)URL dataSource:(WebDataSource *)source
+    withURL:(NSURL *)URL attributes:(NSDictionary *)attributes forDataSource:(WebDataSource *)source
 {
     WebSubresourceClient *client = [[self alloc] initWithLoader:rLoader dataSource:source];
-    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL attributes:nil flags:[source flags]];
+    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL attributes:attributes flags:[source flags]];
     WebResourceHandle *h = [[[WebResourceHandle alloc] initWithRequest:request client:client] autorelease];
     [request release];
     
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index aa12255..c64a70e 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -77,9 +77,9 @@
 */
 @protocol WebWindowContext <NSObject>
 
-- (WebController *)openNewWindowWithURL:(NSURL *)URL;
+- (WebController *)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer;
 
-- (void)setStatusText: (NSString *)text;
+- (void)setStatusText:(NSString *)text;
 - (NSString *)statusText;
 
 - (BOOL)areToolbarsVisible;
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 04413d8..d7cd421 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -90,11 +90,11 @@
     return menuItems;
 }
 
-- (void)openNewWindowWithURL:(NSURL *)URL
+- (void)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer
 {
     WebFrame *webFrame = [element objectForKey:WebContextMenuElementFrameKey];
     WebController *controller = [webFrame controller];
-    [[controller windowContext] openNewWindowWithURL:URL];
+    [[controller windowContext] openNewWindowWithURL:URL referrer:referrer];
 }
 
 - (void)downloadURL:(NSURL *)URL
@@ -107,7 +107,7 @@
 
 - (void)openLinkInNewWindow:(id)sender
 {
-    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementLinkURLKey]];
+    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementLinkURLKey] referrer:nil];
 }
 
 - (void)downloadLinkToDisk:(id)sender
@@ -127,7 +127,7 @@
 
 - (void)openImageInNewWindow:(id)sender
 {
-    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementImageURLKey]];
+    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementImageURLKey] referrer:nil];
 }
 
 - (void)downloadImageToDisk:(id)sender
@@ -149,7 +149,7 @@
     WebFrame *webFrame = [element objectForKey:WebContextMenuElementFrameKey];
     WebDataSource *dataSource = [webFrame dataSource];
     NSURL *URL = [dataSource URL];
-    [self openNewWindowWithURL:URL];
+    [self openNewWindowWithURL:URL referrer:nil];
 }
 
 
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m b/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m
index 04413d8..d7cd421 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuHandler.m
@@ -90,11 +90,11 @@
     return menuItems;
 }
 
-- (void)openNewWindowWithURL:(NSURL *)URL
+- (void)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer
 {
     WebFrame *webFrame = [element objectForKey:WebContextMenuElementFrameKey];
     WebController *controller = [webFrame controller];
-    [[controller windowContext] openNewWindowWithURL:URL];
+    [[controller windowContext] openNewWindowWithURL:URL referrer:referrer];
 }
 
 - (void)downloadURL:(NSURL *)URL
@@ -107,7 +107,7 @@
 
 - (void)openLinkInNewWindow:(id)sender
 {
-    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementLinkURLKey]];
+    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementLinkURLKey] referrer:nil];
 }
 
 - (void)downloadLinkToDisk:(id)sender
@@ -127,7 +127,7 @@
 
 - (void)openImageInNewWindow:(id)sender
 {
-    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementImageURLKey]];
+    [self openNewWindowWithURL:[element objectForKey:WebContextMenuElementImageURLKey] referrer:nil];
 }
 
 - (void)downloadImageToDisk:(id)sender
@@ -149,7 +149,7 @@
     WebFrame *webFrame = [element objectForKey:WebContextMenuElementFrameKey];
     WebDataSource *dataSource = [webFrame dataSource];
     NSURL *URL = [dataSource URL];
-    [self openNewWindowWithURL:URL];
+    [self openNewWindowWithURL:URL referrer:nil];
 }
 
 
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 607440f..ce99d5e 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -264,7 +264,7 @@
     }
     
     else if ([name isEqualToString:@"_blank"]){
-        WebController *newController = [[[self controller] windowContext] openNewWindowWithURL: nil];
+        WebController *newController = [[[self controller] windowContext] openNewWindowWithURL:nil referrer:nil];
 	[[[[newController windowContext] window] windowController] showWindow:nil];
 
         return [newController mainFrame];
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.m b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
index 2355553..7d75ff9 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.m
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.m
@@ -114,7 +114,7 @@ BOOL _modifierTrackingEnabled = FALSE;
     return elementInfo;
 }
 
-- (BOOL)_continueAfterClickPolicyForEvent: (NSEvent *)event
+- (BOOL)_continueAfterClickPolicyForEvent:(NSEvent *)event
 {
     NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
     WebController *controller = [self _controller];
@@ -131,7 +131,7 @@ BOOL _modifierTrackingEnabled = FALSE;
         case WebClickPolicyShow:
             return YES;
         case WebClickPolicyOpenNewWindow:
-            [[controller windowContext] openNewWindowWithURL:URL];
+            [[controller windowContext] openNewWindowWithURL:URL referrer:nil];
             break;
         case WebClickPolicySave:
         case WebClickPolicySaveAndOpenExternally:
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index aa12255..c64a70e 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -77,9 +77,9 @@
 */
 @protocol WebWindowContext <NSObject>
 
-- (WebController *)openNewWindowWithURL:(NSURL *)URL;
+- (WebController *)openNewWindowWithURL:(NSURL *)URL referrer:(NSString *)referrer;
 
-- (void)setStatusText: (NSString *)text;
+- (void)setStatusText:(NSString *)text;
 - (NSString *)statusText;
 
 - (BOOL)areToolbarsVisible;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list