[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:45:02 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bd2301e781827892479c9e2aee9f46fa7b81d01b
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 27 03:06:08 2002 +0000

    	- fixed 3060459 -- REGRESSION: crash leaving page that sets cookie in JavaScript
    	unload handler
    
            * khtml/khtml_part.cpp: (KHTMLPart::begin): Call updatePolicyBaseURL to set
    	the "policy base URL" on the documents so the cookie can be based on the URL
    	of the main document.
    
            * khtml/dom/html_document.h: Add setPolicyBaseURL.
            * khtml/dom/html_document.cpp: (HTMLDocument::setPolicyBaseURL): Call the impl.
    
            * khtml/html/html_documentimpl.h: Add policyBaseURL, setPolicyBaseURL.
            * khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::setCookie): Pass the
    	base URL that's stored here instead of getting at the part through the view,
    	since the view will be 0 during the unload event.
    
            * kwq/KWQKHTMLPartImpl.h: Add updatePolicyBaseURL and setPolicyBaseURL.
            * kwq/KWQKHTMLPartImpl.mm:
            (KWQKHTMLPartImpl::updatePolicyBaseURL): Set the base URL based on the URL
    	if this is the topmost part, based on the parent's policy base URL if this
    	is not the topmost part.
            (KWQKHTMLPartImpl::setPolicyBaseURL): Change the policy base URL for this
    	part and all the subparts.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2180 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index f2ef301..4be4fd0 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,5 +1,30 @@
 2002-09-26  Darin Adler  <darin at apple.com>
 
+	- fixed 3060459 -- REGRESSION: crash leaving page that sets cookie in JavaScript
+	unload handler
+
+        * khtml/khtml_part.cpp: (KHTMLPart::begin): Call updatePolicyBaseURL to set
+	the "policy base URL" on the documents so the cookie can be based on the URL
+	of the main document.
+
+        * khtml/dom/html_document.h: Add setPolicyBaseURL.
+        * khtml/dom/html_document.cpp: (HTMLDocument::setPolicyBaseURL): Call the impl.
+
+        * khtml/html/html_documentimpl.h: Add policyBaseURL, setPolicyBaseURL.
+        * khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::setCookie): Pass the
+	base URL that's stored here instead of getting at the part through the view,
+	since the view will be 0 during the unload event.
+
+        * kwq/KWQKHTMLPartImpl.h: Add updatePolicyBaseURL and setPolicyBaseURL.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::updatePolicyBaseURL): Set the base URL based on the URL
+	if this is the topmost part, based on the parent's policy base URL if this
+	is not the topmost part.
+        (KWQKHTMLPartImpl::setPolicyBaseURL): Change the policy base URL for this
+	part and all the subparts.
+
+2002-09-26  Darin Adler  <darin at apple.com>
+
         * kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
         * kwq/WebCoreBridge.mm:
         (-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index f2ef301..4be4fd0 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,30 @@
 2002-09-26  Darin Adler  <darin at apple.com>
 
+	- fixed 3060459 -- REGRESSION: crash leaving page that sets cookie in JavaScript
+	unload handler
+
+        * khtml/khtml_part.cpp: (KHTMLPart::begin): Call updatePolicyBaseURL to set
+	the "policy base URL" on the documents so the cookie can be based on the URL
+	of the main document.
+
+        * khtml/dom/html_document.h: Add setPolicyBaseURL.
+        * khtml/dom/html_document.cpp: (HTMLDocument::setPolicyBaseURL): Call the impl.
+
+        * khtml/html/html_documentimpl.h: Add policyBaseURL, setPolicyBaseURL.
+        * khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::setCookie): Pass the
+	base URL that's stored here instead of getting at the part through the view,
+	since the view will be 0 during the unload event.
+
+        * kwq/KWQKHTMLPartImpl.h: Add updatePolicyBaseURL and setPolicyBaseURL.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::updatePolicyBaseURL): Set the base URL based on the URL
+	if this is the topmost part, based on the parent's policy base URL if this
+	is not the topmost part.
+        (KWQKHTMLPartImpl::setPolicyBaseURL): Change the policy base URL for this
+	part and all the subparts.
+
+2002-09-26  Darin Adler  <darin at apple.com>
+
         * kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
         * kwq/WebCoreBridge.mm:
         (-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f2ef301..4be4fd0 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,30 @@
 2002-09-26  Darin Adler  <darin at apple.com>
 
+	- fixed 3060459 -- REGRESSION: crash leaving page that sets cookie in JavaScript
+	unload handler
+
+        * khtml/khtml_part.cpp: (KHTMLPart::begin): Call updatePolicyBaseURL to set
+	the "policy base URL" on the documents so the cookie can be based on the URL
+	of the main document.
+
+        * khtml/dom/html_document.h: Add setPolicyBaseURL.
+        * khtml/dom/html_document.cpp: (HTMLDocument::setPolicyBaseURL): Call the impl.
+
+        * khtml/html/html_documentimpl.h: Add policyBaseURL, setPolicyBaseURL.
+        * khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::setCookie): Pass the
+	base URL that's stored here instead of getting at the part through the view,
+	since the view will be 0 during the unload event.
+
+        * kwq/KWQKHTMLPartImpl.h: Add updatePolicyBaseURL and setPolicyBaseURL.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KWQKHTMLPartImpl::updatePolicyBaseURL): Set the base URL based on the URL
+	if this is the topmost part, based on the parent's policy base URL if this
+	is not the topmost part.
+        (KWQKHTMLPartImpl::setPolicyBaseURL): Change the policy base URL for this
+	part and all the subparts.
+
+2002-09-26  Darin Adler  <darin at apple.com>
+
         * kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
         * kwq/WebCoreBridge.mm:
         (-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
diff --git a/WebCore/khtml/dom/html_document.cpp b/WebCore/khtml/dom/html_document.cpp
index ebe38ec..dce9d08 100644
--- a/WebCore/khtml/dom/html_document.cpp
+++ b/WebCore/khtml/dom/html_document.cpp
@@ -183,6 +183,16 @@ void HTMLDocument::setCookie( const DOMString & value )
 
 }
 
+#if APPLE_CHANGES
+
+void HTMLDocument::setPolicyBaseURL( const DOMString &s )
+{
+   if (impl)
+        ((HTMLDocumentImpl *)impl)->setPolicyBaseURL(s);
+}
+
+#endif
+
 void HTMLDocument::open(  )
 {
     if(impl)
diff --git a/WebCore/khtml/dom/html_document.h b/WebCore/khtml/dom/html_document.h
index 71d7031..c9a303f 100644
--- a/WebCore/khtml/dom/html_document.h
+++ b/WebCore/khtml/dom/html_document.h
@@ -196,6 +196,13 @@ public:
      */
     void setCookie( const DOMString & );
 
+#if APPLE_CHANGES
+    /**
+     * The base URL of the top level document. This is used to determine cookie policy.
+     */
+    void setPolicyBaseURL( const DOMString & );
+#endif
+
     /**
      * Note. This method and the ones following allow a user to add to
      * or replace the structure model of a document using strings of
diff --git a/WebCore/khtml/html/html_documentimpl.cpp b/WebCore/khtml/html/html_documentimpl.cpp
index 66439b5..06b0c4f 100644
--- a/WebCore/khtml/html/html_documentimpl.cpp
+++ b/WebCore/khtml/html/html_documentimpl.cpp
@@ -173,14 +173,8 @@ DOMString HTMLDocumentImpl::cookie() const
 
 void HTMLDocumentImpl::setCookie( const DOMString & value )
 {
-#ifdef APPLE_CHANGES
-    KHTMLPart *topLevelPart = view()->part();
-
-    while (topLevelPart->parentPart() != NULL) {
-	topLevelPart = topLevelPart->parentPart();
-    }
-
-    return KWQKCookieJar::setCookie(URL(), topLevelPart->htmlDocument().URL().string(), value.string());
+#if APPLE_CHANGES
+    return KWQKCookieJar::setCookie(URL(), m_policyBaseURL.string(), value.string());
 #else
     long windowId = 0;
     KHTMLView *v = view ();
diff --git a/WebCore/khtml/html/html_documentimpl.h b/WebCore/khtml/html/html_documentimpl.h
index 9c5764a..725a28f 100644
--- a/WebCore/khtml/html/html_documentimpl.h
+++ b/WebCore/khtml/html/html_documentimpl.h
@@ -58,6 +58,10 @@ public:
     DOMString lastModified() const;
     DOMString cookie() const;
     void setCookie( const DOMString &);
+#if APPLE_CHANGES
+    DOMString policyBaseURL() const { return m_policyBaseURL; }
+    void setPolicyBaseURL(const DOMString &s) { m_policyBaseURL = s; }
+#endif
 
     HTMLElementImpl *body();
     void setBody(HTMLElementImpl *_body);
@@ -87,6 +91,9 @@ protected slots:
     void slotHistoryChanged();
 private:
     mutable DOMString m_domain;
+#if APPLE_CHANGES
+    DOMString m_policyBaseURL;
+#endif
 };
 
 }; //namespace
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index a9cfc5d..6d3c2fa 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -1359,6 +1359,10 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
   d->m_doc->setBaseURL( baseurl.url() );
   d->m_doc->docLoader()->setShowAnimations( KHTMLFactory::defaultHTMLSettings()->showAnimations() );
 
+#if APPLE_CHANGES
+  impl->updatePolicyBaseURL();
+#endif
+
 #ifndef APPLE_CHANGES
   d->m_paUseStylesheet->setItems(QStringList());
   d->m_paUseStylesheet->setEnabled( false );
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index c1ac13b..325f3d4 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -104,7 +104,9 @@ public:
     void layout();
     
     QString userAgent() const;
-    
+
+    void updatePolicyBaseURL();
+
     NSView *nextKeyView(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     NSView *nextKeyViewInFrameHierarchy(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static NSView *nextKeyViewForWidget(QWidget *startingPoint, KWQSelectionDirection);
@@ -129,6 +131,8 @@ public:
     static const QPtrList<KWQKHTMLPartImpl> &instances() { return mutableInstances(); }
 
 private:
+    void setPolicyBaseURL(const DOM::DOMString &);
+
     WebCoreBridge *bridgeForFrameName(const QString &frameName);
 
     NSView *nextKeyViewInFrame(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index e330916..994a6db 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -545,3 +545,22 @@ QPtrList<KWQKHTMLPartImpl> &KWQKHTMLPartImpl::mutableInstances()
     static QPtrList<KWQKHTMLPartImpl> instancesList;
     return instancesList;
 }
+
+void KWQKHTMLPartImpl::updatePolicyBaseURL()
+{
+    if (part->parentPart()) {
+        setPolicyBaseURL(part->parentPart()->docImpl()->policyBaseURL());
+    } else {
+        setPolicyBaseURL(part->m_url.url());
+    }
+}
+
+void KWQKHTMLPartImpl::setPolicyBaseURL(const DOM::DOMString &s)
+{
+    part->docImpl()->setPolicyBaseURL(s);
+    ConstFrameIt end = d->m_frames.end();
+    for (ConstFrameIt it = d->m_frames.begin(); it != end; ++it) {
+        ReadOnlyPart *subpart = (*it).m_part;
+        static_cast<KHTMLPart *>(subpart)->impl->setPolicyBaseURL(s);
+    }
+}
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.h b/WebCore/kwq/KWQKHTMLPartImpl.h
index c1ac13b..325f3d4 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.h
+++ b/WebCore/kwq/KWQKHTMLPartImpl.h
@@ -104,7 +104,9 @@ public:
     void layout();
     
     QString userAgent() const;
-    
+
+    void updatePolicyBaseURL();
+
     NSView *nextKeyView(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     NSView *nextKeyViewInFrameHierarchy(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static NSView *nextKeyViewForWidget(QWidget *startingPoint, KWQSelectionDirection);
@@ -129,6 +131,8 @@ public:
     static const QPtrList<KWQKHTMLPartImpl> &instances() { return mutableInstances(); }
 
 private:
+    void setPolicyBaseURL(const DOM::DOMString &);
+
     WebCoreBridge *bridgeForFrameName(const QString &frameName);
 
     NSView *nextKeyViewInFrame(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index e330916..994a6db 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -545,3 +545,22 @@ QPtrList<KWQKHTMLPartImpl> &KWQKHTMLPartImpl::mutableInstances()
     static QPtrList<KWQKHTMLPartImpl> instancesList;
     return instancesList;
 }
+
+void KWQKHTMLPartImpl::updatePolicyBaseURL()
+{
+    if (part->parentPart()) {
+        setPolicyBaseURL(part->parentPart()->docImpl()->policyBaseURL());
+    } else {
+        setPolicyBaseURL(part->m_url.url());
+    }
+}
+
+void KWQKHTMLPartImpl::setPolicyBaseURL(const DOM::DOMString &s)
+{
+    part->docImpl()->setPolicyBaseURL(s);
+    ConstFrameIt end = d->m_frames.end();
+    for (ConstFrameIt it = d->m_frames.begin(); it != end; ++it) {
+        ReadOnlyPart *subpart = (*it).m_part;
+        static_cast<KHTMLPart *>(subpart)->impl->setPolicyBaseURL(s);
+    }
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list