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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:21:40 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c80ac0f587f8f7bc2a17cc0cb6fc563ecb9c2399
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 27 09:42:05 2002 +0000

    WebCore:
    	WebCore part of fixes for JavaScript cookie bugs:
    
    	2943749 - JavaScript navigator.cookieEnabled property is always "true"
    	2856039 - JavaScript document.cookies property is not implemented
    
    	Thereby also fixing:
    
    	2944378 - Trying to log into my Yahoo web mail account sent
    	Alexander into a loop
    
            * kwq/KWQKCookieJar.h: Added.
            * kwq/KWQKCookieJar.mm: Added.
            (KWQKCookieJar::cookie): C++ veneer over WebCoreCookieAdapter call.
            (KWQKCookieJar::setCookie): Likewise.
            (KWQKCookieJar::cookieEnabled): Likewise.
            * kwq/Makefile.am: Add new files to build.
            * kwq/WebCoreCookieAdapter.h: Added.
            * kwq/WebCoreCookieAdapter.m: Added.
    	(+[WebCoreCookieAdapter sharedAdapter]): Method to return shared
    	instance, al la the WebCoreFactory classes.
            (-[WebCoreCookieAdapter init]): Establish self as shared instance.
            (-[WebCoreCookieAdapter cookiesEnabled]): No-op implementation.
            (-[WebCoreCookieAdapter cookiesForURL:]): Likewise.
            (-[WebCoreCookieAdapter setCookies:forURL:]): Likewise.
            * WebCore.exp: Export WebCoreCookieAdapter class.
            * khtml/ecma/kjs_navigator.cpp:
            (Navigator::getValueProperty): Call appropriate KWQCookieJar method.
            * khtml/html/html_documentimpl.cpp:
            (HTMLDocumentImpl::cookie): Call appropriate KWQCookieJar method.
            (HTMLDocumentImpl::setCookie): Likewise
    
    WebKit:
    	WebKit part of fixes for JavaScript cookie bugs:
    
    	2943749 - JavaScript navigator.cookieEnabled property is always "true"
    	2856039 - JavaScript document.cookies property is not implemented
    
    	Thereby also fixing:
    
    	2944378 - Trying to log into my Yahoo web mail account sent
    	Alexander into a loop
    
            * WebCoreSupport.subproj/IFCookieAdapter.h: Added.
            * WebCoreSupport.subproj/IFCookieAdapter.m: Added.
            (+[IFCookieAdapter createSharedAdapter]): Set up an instance of
    	IFCookieAdapter as the WebCoreCookieAdapter shared instance.
            (-[IFCookieAdapter cookiesEnabled]): Implement in terms of
    	WebFoundation stuff.
            (-[IFCookieAdapter cookiesForURL:]): Likewise.
            (-[IFCookieAdapter setCookies:forURL:]): Likewise.
            * WebKit.pbproj/project.pbxproj: Add new files to build.
            * WebView.subproj/IFWebView.mm:
    	(-[IFWebView initWithFrame:]): Hook up the cookie adapter just
    	like the various factory classes.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1449 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index cdc92a7..4d8b4bc 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,36 @@
+2002-06-27  Maciej Stachowiak  <mjs at apple.com>
+
+	WebCore part of fixes for JavaScript cookie bugs:
+	
+	2943749 - JavaScript navigator.cookieEnabled property is always "true"
+	2856039 - JavaScript document.cookies property is not implemented
+	
+	Thereby also fixing:
+	
+	2944378 - Trying to log into my Yahoo web mail account sent
+	Alexander into a loop
+	
+        * kwq/KWQKCookieJar.h: Added.
+        * kwq/KWQKCookieJar.mm: Added.
+        (KWQKCookieJar::cookie): C++ veneer over WebCoreCookieAdapter call.
+        (KWQKCookieJar::setCookie): Likewise.
+        (KWQKCookieJar::cookieEnabled): Likewise.
+        * kwq/Makefile.am: Add new files to build.
+        * kwq/WebCoreCookieAdapter.h: Added.
+        * kwq/WebCoreCookieAdapter.m: Added.
+	(+[WebCoreCookieAdapter sharedAdapter]): Method to return shared
+	instance, al la the WebCoreFactory classes.
+        (-[WebCoreCookieAdapter init]): Establish self as shared instance.
+        (-[WebCoreCookieAdapter cookiesEnabled]): No-op implementation.
+        (-[WebCoreCookieAdapter cookiesForURL:]): Likewise.
+        (-[WebCoreCookieAdapter setCookies:forURL:]): Likewise.
+        * WebCore.exp: Export WebCoreCookieAdapter class.
+        * khtml/ecma/kjs_navigator.cpp:
+        (Navigator::getValueProperty): Call appropriate KWQCookieJar method.
+        * khtml/html/html_documentimpl.cpp:
+        (HTMLDocumentImpl::cookie): Call appropriate KWQCookieJar method.
+        (HTMLDocumentImpl::setCookie): Likewise
+
 2002-06-27  Chris Blumenberg  <cblu at apple.com>
 
 	Fix to support sending PARAM tags to the Java plug-in.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index cdc92a7..4d8b4bc 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,36 @@
+2002-06-27  Maciej Stachowiak  <mjs at apple.com>
+
+	WebCore part of fixes for JavaScript cookie bugs:
+	
+	2943749 - JavaScript navigator.cookieEnabled property is always "true"
+	2856039 - JavaScript document.cookies property is not implemented
+	
+	Thereby also fixing:
+	
+	2944378 - Trying to log into my Yahoo web mail account sent
+	Alexander into a loop
+	
+        * kwq/KWQKCookieJar.h: Added.
+        * kwq/KWQKCookieJar.mm: Added.
+        (KWQKCookieJar::cookie): C++ veneer over WebCoreCookieAdapter call.
+        (KWQKCookieJar::setCookie): Likewise.
+        (KWQKCookieJar::cookieEnabled): Likewise.
+        * kwq/Makefile.am: Add new files to build.
+        * kwq/WebCoreCookieAdapter.h: Added.
+        * kwq/WebCoreCookieAdapter.m: Added.
+	(+[WebCoreCookieAdapter sharedAdapter]): Method to return shared
+	instance, al la the WebCoreFactory classes.
+        (-[WebCoreCookieAdapter init]): Establish self as shared instance.
+        (-[WebCoreCookieAdapter cookiesEnabled]): No-op implementation.
+        (-[WebCoreCookieAdapter cookiesForURL:]): Likewise.
+        (-[WebCoreCookieAdapter setCookies:forURL:]): Likewise.
+        * WebCore.exp: Export WebCoreCookieAdapter class.
+        * khtml/ecma/kjs_navigator.cpp:
+        (Navigator::getValueProperty): Call appropriate KWQCookieJar method.
+        * khtml/html/html_documentimpl.cpp:
+        (HTMLDocumentImpl::cookie): Call appropriate KWQCookieJar method.
+        (HTMLDocumentImpl::setCookie): Likewise
+
 2002-06-27  Chris Blumenberg  <cblu at apple.com>
 
 	Fix to support sending PARAM tags to the Java plug-in.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index cdc92a7..4d8b4bc 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,36 @@
+2002-06-27  Maciej Stachowiak  <mjs at apple.com>
+
+	WebCore part of fixes for JavaScript cookie bugs:
+	
+	2943749 - JavaScript navigator.cookieEnabled property is always "true"
+	2856039 - JavaScript document.cookies property is not implemented
+	
+	Thereby also fixing:
+	
+	2944378 - Trying to log into my Yahoo web mail account sent
+	Alexander into a loop
+	
+        * kwq/KWQKCookieJar.h: Added.
+        * kwq/KWQKCookieJar.mm: Added.
+        (KWQKCookieJar::cookie): C++ veneer over WebCoreCookieAdapter call.
+        (KWQKCookieJar::setCookie): Likewise.
+        (KWQKCookieJar::cookieEnabled): Likewise.
+        * kwq/Makefile.am: Add new files to build.
+        * kwq/WebCoreCookieAdapter.h: Added.
+        * kwq/WebCoreCookieAdapter.m: Added.
+	(+[WebCoreCookieAdapter sharedAdapter]): Method to return shared
+	instance, al la the WebCoreFactory classes.
+        (-[WebCoreCookieAdapter init]): Establish self as shared instance.
+        (-[WebCoreCookieAdapter cookiesEnabled]): No-op implementation.
+        (-[WebCoreCookieAdapter cookiesForURL:]): Likewise.
+        (-[WebCoreCookieAdapter setCookies:forURL:]): Likewise.
+        * WebCore.exp: Export WebCoreCookieAdapter class.
+        * khtml/ecma/kjs_navigator.cpp:
+        (Navigator::getValueProperty): Call appropriate KWQCookieJar method.
+        * khtml/html/html_documentimpl.cpp:
+        (HTMLDocumentImpl::cookie): Call appropriate KWQCookieJar method.
+        (HTMLDocumentImpl::setCookie): Likewise
+
 2002-06-27  Chris Blumenberg  <cblu at apple.com>
 
 	Fix to support sending PARAM tags to the Java plug-in.
diff --git a/WebCore/WebCore.exp b/WebCore/WebCore.exp
index 251decc..bcaa8b9 100644
--- a/WebCore/WebCore.exp
+++ b/WebCore/WebCore.exp
@@ -1,4 +1,5 @@
 .objc_class_name_WebCoreBridge
+.objc_class_name_WebCoreCookieAdapter
 .objc_class_name_WebCoreImageRendererFactory
 .objc_class_name_WebCoreTextRendererFactory
 .objc_class_name_WebCoreViewFactory
diff --git a/WebCore/khtml/ecma/kjs_navigator.cpp b/WebCore/khtml/ecma/kjs_navigator.cpp
index c1085a6..4d3edf8 100644
--- a/WebCore/khtml/ecma/kjs_navigator.cpp
+++ b/WebCore/khtml/ecma/kjs_navigator.cpp
@@ -32,6 +32,9 @@
 #include "kjs_navigator.lut.h"
 #include "kjs_binding.h"
 #include "khtml_part.h"
+#ifdef APPLE_CHANGES
+#include <KWQKCookieJar.h>
+#endif
 
 using namespace KJS;
 
@@ -230,7 +233,11 @@ Value Navigator::getValueProperty(ExecState *exec, int token) const
   case _MimeTypes:
     return Value(new MimeTypes(exec));
   case CookieEnabled:
+#ifdef APPLE_CHANGES
+      return Boolean(KWQKCookieJar::cookieEnabled());
+#else
     return Boolean(true); /// ##### FIXME
+#endif
   default:
     kdWarning() << "Unhandled token in DOMEvent::getValueProperty : " << token << endl;
     return Value();
diff --git a/WebCore/khtml/html/html_documentimpl.cpp b/WebCore/khtml/html/html_documentimpl.cpp
index 6965c49..552531e 100644
--- a/WebCore/khtml/html/html_documentimpl.cpp
+++ b/WebCore/khtml/html/html_documentimpl.cpp
@@ -48,11 +48,15 @@
 #include <kcharsets.h>
 #include <kglobalsettings.h>
 
+
 #include "css/cssproperties.h"
 #include "css/cssstyleselector.h"
 #include "css/css_stylesheetimpl.h"
 #include <stdlib.h>
 #include <qptrstack.h>
+#ifdef APPLE_CHANGES
+#include <KWQKCookieJar.h>
+#endif
 
 template class QPtrStack<DOM::NodeImpl>;
 
@@ -130,7 +134,7 @@ DOMString HTMLDocumentImpl::lastModified() const
 DOMString HTMLDocumentImpl::cookie() const
 {
 #ifdef APPLE_CHANGES
-    return DOMString();
+    return KWQKCookieJar::cookie(KURL(URL()));
 #else
     QCString replyType;
     QByteArray params, reply;
@@ -162,7 +166,9 @@ DOMString HTMLDocumentImpl::cookie() const
 
 void HTMLDocumentImpl::setCookie( const DOMString & value )
 {
-#ifndef APPLE_CHANGES
+#ifdef APPLE_CHANGES
+    return KWQKCookieJar::setCookie(KURL(URL()), value.string());
+#else
     long windowId = view() ? view()->winId() : 0;
     QByteArray params;
     QDataStream stream(params, IO_WriteOnly);
diff --git a/WebCore/kwq/kdecore/klibloader.h b/WebCore/kwq/KWQKCookieJar.h
similarity index 87%
copy from WebCore/kwq/kdecore/klibloader.h
copy to WebCore/kwq/KWQKCookieJar.h
index 5751177..d001e08 100644
--- a/WebCore/kwq/kdecore/klibloader.h
+++ b/WebCore/kwq/KWQKCookieJar.h
@@ -20,13 +20,18 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <kio/global.h>
 
-class KLibrary
+#include <qstring.h>
+#include <kurl.h>
+
+class KWQKCookieJar
 {
 public:
-    void unload() { }
+    static QString cookie(const KURL &);
+    static void setCookie(const KURL &, const QString &);
+    static bool cookieEnabled();
 };
+
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.m b/WebCore/kwq/KWQKCookieJar.mm
similarity index 69%
copy from WebCore/kwq/WebCoreTextRendererFactory.m
copy to WebCore/kwq/KWQKCookieJar.mm
index f7ba9e4..3eda2a5 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.m
+++ b/WebCore/kwq/KWQKCookieJar.mm
@@ -20,34 +20,29 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WebCoreTextRendererFactory.h"
-#import <kwqdebug.h>
+#include <KWQKCookieJar.h>
+#include <WebCoreCookieAdapter.h>
 
- at implementation WebCoreTextRendererFactory
 
-static WebCoreTextRendererFactory *sharedFactory;
-
-+ (WebCoreTextRendererFactory *)sharedFactory
+QString KWQKCookieJar::cookie(const KURL &url)
 {
-    return sharedFactory;
+    NSString *result = [[WebCoreCookieAdapter sharedAdapter] cookiesForURL:url.getNSURL()];
+    if (result != nil) {
+        return QString::fromNSString(result);
+    } else {
+        return QString();
+    }
 }
 
-- init
+void KWQKCookieJar::setCookie(const KURL &url, const QString &cookie)
 {
-    [super init];
-    
-    KWQ_ASSERT(!sharedFactory);
-    sharedFactory = [self retain];
-    
-    return self;
+    [[WebCoreCookieAdapter sharedAdapter] setCookies:cookie.getNSString() forURL:url.getNSURL()];
 }
 
-- (id <WebCoreTextRenderer>)rendererWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size
+bool KWQKCookieJar::cookieEnabled()
 {
-    return nil;
+    return [[WebCoreCookieAdapter sharedAdapter] cookiesEnabled];
 }
-
- at end
diff --git a/WebCore/kwq/Makefile.am b/WebCore/kwq/Makefile.am
index c882a1e..f69ea1b 100644
--- a/WebCore/kwq/Makefile.am
+++ b/WebCore/kwq/Makefile.am
@@ -40,6 +40,7 @@ libkwq_o_SOURCES = \
 	KWQKCharsets.mm \
 	KWQKComboBox.mm \
 	KWQKConfigBase.mm \
+        KWQKCookieJar.mm \
 	KWQKCursor.mm \
 	KWQKDebug.mm \
 	KWQKFileDialog.mm \
@@ -109,6 +110,7 @@ libkwq_o_SOURCES = \
 	KWQxml.mm \
 	kwqdebug.mm \
 	WebCoreBridge.mm \
+        WebCoreCookieAdapter.m \
 	WebCoreImageRendererFactory.m \
 	WebCoreTextRendererFactory.m \
 	WebCoreViewFactory.m \
diff --git a/WebCore/kwq/WebCoreResourceLoader.h b/WebCore/kwq/WebCoreCookieAdapter.h
similarity index 73%
copy from WebCore/kwq/WebCoreResourceLoader.h
copy to WebCore/kwq/WebCoreCookieAdapter.h
index d7e3e23..2c2546c 100644
--- a/WebCore/kwq/WebCoreResourceLoader.h
+++ b/WebCore/kwq/WebCoreCookieAdapter.h
@@ -16,21 +16,24 @@
  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+                                        * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #import <Foundation/Foundation.h>
 
- at protocol WebCoreResourceLoader <NSObject>
+ at interface WebCoreCookieAdapter : NSObject
+{
+}
 
-- (void)addData:(NSData *)data;
++ (WebCoreCookieAdapter *)sharedAdapter;
+- init;
 
-// Either cancel or finish will be called before the loader is released, but never both.
-- (void)cancel;
-- (void)finish;
+- (BOOL)cookiesEnabled;
+- (NSString *)cookiesForURL:(NSURL *)url;
+- (void)setCookies:(NSString *)cookies forURL:(NSURL *)url;
 
 @end
diff --git a/WebCore/kwq/WebCoreTextRendererFactory.mm b/WebCore/kwq/WebCoreCookieAdapter.m
similarity index 78%
copy from WebCore/kwq/WebCoreTextRendererFactory.mm
copy to WebCore/kwq/WebCoreCookieAdapter.m
index f7ba9e4..efd388c 100644
--- a/WebCore/kwq/WebCoreTextRendererFactory.mm
+++ b/WebCore/kwq/WebCoreCookieAdapter.m
@@ -20,34 +20,43 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#import "WebCoreTextRendererFactory.h"
+#import "WebCoreCookieAdapter.h"
 #import <kwqdebug.h>
 
- at implementation WebCoreTextRendererFactory
+ at implementation WebCoreCookieAdapter
 
-static WebCoreTextRendererFactory *sharedFactory;
+static WebCoreCookieAdapter *sharedAdapter;
 
-+ (WebCoreTextRendererFactory *)sharedFactory
++ (WebCoreCookieAdapter *)sharedAdapter
 {
-    return sharedFactory;
+    return sharedAdapter;
 }
 
 - init
 {
     [super init];
-    
-    KWQ_ASSERT(!sharedFactory);
-    sharedFactory = [self retain];
-    
+
+    KWQ_ASSERT(!sharedAdapter);
+    sharedAdapter = [self retain];
+
     return self;
 }
 
-- (id <WebCoreTextRenderer>)rendererWithFamily:(NSString *)family traits:(NSFontTraitMask)traits size:(float)size
+- (BOOL)cookiesEnabled
+{
+    return FALSE;
+}
+
+- (NSString *)cookiesForURL:(NSURL *)url
 {
     return nil;
 }
 
+- (void)setCookies:(NSString *)cookies forURL:(NSURL *)url
+{
+}
+
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 4f6fe17..1a41844 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,28 @@
+2002-06-27  Maciej Stachowiak  <mjs at apple.com>
+
+	WebKit part of fixes for JavaScript cookie bugs:
+	
+	2943749 - JavaScript navigator.cookieEnabled property is always "true"
+	2856039 - JavaScript document.cookies property is not implemented
+	
+	Thereby also fixing:
+	
+	2944378 - Trying to log into my Yahoo web mail account sent
+	Alexander into a loop
+	
+        * WebCoreSupport.subproj/IFCookieAdapter.h: Added.
+        * WebCoreSupport.subproj/IFCookieAdapter.m: Added.
+        (+[IFCookieAdapter createSharedAdapter]): Set up an instance of
+	IFCookieAdapter as the WebCoreCookieAdapter shared instance.
+        (-[IFCookieAdapter cookiesEnabled]): Implement in terms of
+	WebFoundation stuff.
+        (-[IFCookieAdapter cookiesForURL:]): Likewise.
+        (-[IFCookieAdapter setCookies:forURL:]): Likewise.
+        * WebKit.pbproj/project.pbxproj: Add new files to build.
+        * WebView.subproj/IFWebView.mm:        
+	(-[IFWebView initWithFrame:]): Hook up the cookie adapter just
+	like the various factory classes.
+	
 2002-06-27  Chris Blumenberg  <cblu at apple.com>
 
 	Support for Java.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 4f6fe17..1a41844 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,28 @@
+2002-06-27  Maciej Stachowiak  <mjs at apple.com>
+
+	WebKit part of fixes for JavaScript cookie bugs:
+	
+	2943749 - JavaScript navigator.cookieEnabled property is always "true"
+	2856039 - JavaScript document.cookies property is not implemented
+	
+	Thereby also fixing:
+	
+	2944378 - Trying to log into my Yahoo web mail account sent
+	Alexander into a loop
+	
+        * WebCoreSupport.subproj/IFCookieAdapter.h: Added.
+        * WebCoreSupport.subproj/IFCookieAdapter.m: Added.
+        (+[IFCookieAdapter createSharedAdapter]): Set up an instance of
+	IFCookieAdapter as the WebCoreCookieAdapter shared instance.
+        (-[IFCookieAdapter cookiesEnabled]): Implement in terms of
+	WebFoundation stuff.
+        (-[IFCookieAdapter cookiesForURL:]): Likewise.
+        (-[IFCookieAdapter setCookies:forURL:]): Likewise.
+        * WebKit.pbproj/project.pbxproj: Add new files to build.
+        * WebView.subproj/IFWebView.mm:        
+	(-[IFWebView initWithFrame:]): Hook up the cookie adapter just
+	like the various factory classes.
+	
 2002-06-27  Chris Blumenberg  <cblu at apple.com>
 
 	Support for Java.
diff --git a/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h b/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h
new file mode 100644
index 0000000..fc3f050
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/IFCookieAdapter.h
@@ -0,0 +1,23 @@
+//
+//  IFCookieAdapter.h
+//  WebKit
+//
+//  Created by Maciej Stachowiak on Thu Jun 27 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <WebCoreCookieAdapter.h>
+
+ at interface IFCookieAdapter : WebCoreCookieAdapter
+{
+}
+
++ (void)createSharedAdapter;
+
+- (BOOL)cookiesEnabled;
+- (NSString *)cookiesForURL:(NSURL *)url;
+- (void)setCookies:(NSString *)cookies forURL:(NSURL *)url;
+
+
+ at end
diff --git a/WebKit/WebCoreSupport.subproj/IFCookieAdapter.m b/WebKit/WebCoreSupport.subproj/IFCookieAdapter.m
new file mode 100644
index 0000000..155b898
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/IFCookieAdapter.m
@@ -0,0 +1,54 @@
+//
+//  IFCookieAdapter.m
+//  WebKit
+//
+//  Created by Maciej Stachowiak on Thu Jun 27 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "IFCookieAdapter.h"
+#import <WebFoundation/IFCookieManager.h>
+#import <WebKit/WebKitDebug.h>
+
+
+ at implementation IFCookieAdapter
+
++ (void)createSharedAdapter
+{
+    if (![self sharedAdapter]) {
+        [[[self alloc] init] release];
+    }
+    WEBKIT_ASSERT([[self sharedAdapter] isMemberOfClass:self]);
+}
+
+- (BOOL)cookiesEnabled
+{
+    BOOL result;
+    id acceptCookiesPref = (id)CFPreferencesCopyAppValue((CFStringRef)IFAcceptCookiesPreference, (CFStringRef)IFWebFoundationPreferenceDomain);
+
+    if ([acceptCookiesPref isEqualTo:IFAcceptCookiesPreferenceNever]) {
+        result = NO;
+    } else if ([acceptCookiesPref isEqualTo:IFAcceptCookiesPreferenceAsk]) {
+        result = YES;
+    } else if ([acceptCookiesPref isEqualTo:IFAcceptCookiesPreferenceAlways]) {
+        result = YES;
+    } else {
+        // Treat missing or bad value as always accept
+        result = YES;
+    }
+    [acceptCookiesPref release];
+
+    return result;
+}
+
+- (NSString *)cookiesForURL:(NSURL *)url
+{
+    return [[[IFCookieManager sharedCookieManager] cookieRequestHeadersForURL:url] objectForKey:@"Cookie"];
+}
+
+- (void)setCookies:(NSString *)cookies forURL:(NSURL *)url
+{
+    [[IFCookieManager sharedCookieManager] setCookiesFromResponseHeaders:[NSDictionary dictionaryWithObject:cookies forKey:@"Set-Cookie"] forURL:url];    
+}
+
+ at end
diff --git a/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h b/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h
new file mode 100644
index 0000000..fc3f050
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/WebCookieAdapter.h
@@ -0,0 +1,23 @@
+//
+//  IFCookieAdapter.h
+//  WebKit
+//
+//  Created by Maciej Stachowiak on Thu Jun 27 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <WebCoreCookieAdapter.h>
+
+ at interface IFCookieAdapter : WebCoreCookieAdapter
+{
+}
+
++ (void)createSharedAdapter;
+
+- (BOOL)cookiesEnabled;
+- (NSString *)cookiesForURL:(NSURL *)url;
+- (void)setCookies:(NSString *)cookies forURL:(NSURL *)url;
+
+
+ at end
diff --git a/WebKit/WebCoreSupport.subproj/WebCookieAdapter.m b/WebKit/WebCoreSupport.subproj/WebCookieAdapter.m
new file mode 100644
index 0000000..155b898
--- /dev/null
+++ b/WebKit/WebCoreSupport.subproj/WebCookieAdapter.m
@@ -0,0 +1,54 @@
+//
+//  IFCookieAdapter.m
+//  WebKit
+//
+//  Created by Maciej Stachowiak on Thu Jun 27 2002.
+//  Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
+//
+
+#import "IFCookieAdapter.h"
+#import <WebFoundation/IFCookieManager.h>
+#import <WebKit/WebKitDebug.h>
+
+
+ at implementation IFCookieAdapter
+
++ (void)createSharedAdapter
+{
+    if (![self sharedAdapter]) {
+        [[[self alloc] init] release];
+    }
+    WEBKIT_ASSERT([[self sharedAdapter] isMemberOfClass:self]);
+}
+
+- (BOOL)cookiesEnabled
+{
+    BOOL result;
+    id acceptCookiesPref = (id)CFPreferencesCopyAppValue((CFStringRef)IFAcceptCookiesPreference, (CFStringRef)IFWebFoundationPreferenceDomain);
+
+    if ([acceptCookiesPref isEqualTo:IFAcceptCookiesPreferenceNever]) {
+        result = NO;
+    } else if ([acceptCookiesPref isEqualTo:IFAcceptCookiesPreferenceAsk]) {
+        result = YES;
+    } else if ([acceptCookiesPref isEqualTo:IFAcceptCookiesPreferenceAlways]) {
+        result = YES;
+    } else {
+        // Treat missing or bad value as always accept
+        result = YES;
+    }
+    [acceptCookiesPref release];
+
+    return result;
+}
+
+- (NSString *)cookiesForURL:(NSURL *)url
+{
+    return [[[IFCookieManager sharedCookieManager] cookieRequestHeadersForURL:url] objectForKey:@"Cookie"];
+}
+
+- (void)setCookies:(NSString *)cookies forURL:(NSURL *)url
+{
+    [[IFCookieManager sharedCookieManager] setCookiesFromResponseHeaders:[NSDictionary dictionaryWithObject:cookies forKey:@"Set-Cookie"] forURL:url];    
+}
+
+ at end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 6e8c66d..c7307f5 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -256,6 +256,7 @@
 				F5A55DC802BAA2E8018635CC,
 				F5E0E10A02BC45F8018635CA,
 				F5A7B11B02BC8413018635CA,
+				F5488CF602CB04EE01FF6274,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -336,6 +337,7 @@
 				F5E0A77102B8FEE401C1A525,
 				F5E0E10B02BC45F8018635CA,
 				F5A7B11C02BC8413018635CA,
+				F5488CF702CB04EE01FF6274,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1453,6 +1455,30 @@
 			settings = {
 			};
 		};
+		F5488CF402CB04EE01FF6274 = {
+			isa = PBXFileReference;
+			name = IFCookieAdapter.h;
+			path = WebCoreSupport.subproj/IFCookieAdapter.h;
+			refType = 4;
+		};
+		F5488CF502CB04EE01FF6274 = {
+			isa = PBXFileReference;
+			name = IFCookieAdapter.m;
+			path = WebCoreSupport.subproj/IFCookieAdapter.m;
+			refType = 4;
+		};
+		F5488CF602CB04EE01FF6274 = {
+			fileRef = F5488CF402CB04EE01FF6274;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		F5488CF702CB04EE01FF6274 = {
+			fileRef = F5488CF502CB04EE01FF6274;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		F567433E026B5B7B01A80181 = {
 			isa = PBXFileReference;
 			name = IFLocationChangeHandler.h;
@@ -1750,6 +1776,8 @@
 				F5E0E10902BC45F8018635CA,
 				F5A7B11902BC8413018635CA,
 				F5A7B11A02BC8413018635CA,
+				F5488CF402CB04EE01FF6274,
+				F5488CF502CB04EE01FF6274,
 			);
 			isa = PBXGroup;
 			name = "WebCore Support";
diff --git a/WebKit/WebView.subproj/IFWebView.mm b/WebKit/WebView.subproj/IFWebView.mm
index c3873ff..319c241 100644
--- a/WebKit/WebView.subproj/IFWebView.mm
+++ b/WebKit/WebView.subproj/IFWebView.mm
@@ -13,6 +13,7 @@
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFTextRendererFactory.h>
 #import <WebKit/IFImageRendererFactory.h>
+#import <WebKit/IFCookieAdapter.h>
 
 #import <WebFoundation/IFNSStringExtensions.h>
 #import <WebFoundation/IFNSURLExtensions.h>
@@ -26,7 +27,8 @@
     [IFWebCoreViewFactory createSharedFactory];
     [IFTextRendererFactory createSharedFactory];
     [IFImageRendererFactory createSharedFactory];
-   
+    [IFCookieAdapter createSharedAdapter];
+    
     _private = [[IFWebViewPrivate alloc] init];
 
     IFDynamicScrollBarsView *scrollView  = [[IFDynamicScrollBarsView alloc] initWithFrame: NSMakeRect(0,0,frame.size.width,frame.size.height)];
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index c3873ff..319c241 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -13,6 +13,7 @@
 #import <WebKit/IFWebFrame.h>
 #import <WebKit/IFTextRendererFactory.h>
 #import <WebKit/IFImageRendererFactory.h>
+#import <WebKit/IFCookieAdapter.h>
 
 #import <WebFoundation/IFNSStringExtensions.h>
 #import <WebFoundation/IFNSURLExtensions.h>
@@ -26,7 +27,8 @@
     [IFWebCoreViewFactory createSharedFactory];
     [IFTextRendererFactory createSharedFactory];
     [IFImageRendererFactory createSharedFactory];
-   
+    [IFCookieAdapter createSharedAdapter];
+    
     _private = [[IFWebViewPrivate alloc] init];
 
     IFDynamicScrollBarsView *scrollView  = [[IFDynamicScrollBarsView alloc] initWithFrame: NSMakeRect(0,0,frame.size.width,frame.size.height)];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list