WebKit:
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Dec 2004 00:24:26 +0000 (00:24 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Dec 2004 00:24:26 +0000 (00:24 +0000)
Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images

Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
the b/f cache won't incorrectly trash the previous state when restoring.

        Reviewed by John.

        * WebView.subproj/WebFrame.m:
        (-[WebFrame _setState:]):

WebCore:
Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images

Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
the b/f cache won't incorrectly trash the previous state when restoring.

        Reviewed by John.

        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
        (-[WebCoreBridge canCachePage]):
        (-[WebCoreBridge clear]):

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

WebCore/ChangeLog-2005-08-23
WebCore/kwq/WebCoreBridge.h
WebCore/kwq/WebCoreBridge.mm
WebKit/ChangeLog
WebKit/WebView.subproj/WebFrame.m

index 7fe50804767e6ced2606b1de1999809f8a7600b6..118ca421aa9fe4a39389e6f45dc5853bf8a211e5 100644 (file)
@@ -1,3 +1,18 @@
+2004-12-02  Richard Williamson   <rjw@apple.com>
+
+       Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images
+
+       Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
+       the b/f cache won't incorrectly trash the previous state when restoring.
+
+        Reviewed by John.
+
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
+        (-[WebCoreBridge canCachePage]):
+        (-[WebCoreBridge clear]):
+
 2004-12-02  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by Richard
index f3196df9f578caf39b1966823ca918f59ae638b3..df672bdae21c0cd92d507c860bf33dd2120a1fdc 100644 (file)
@@ -380,6 +380,8 @@ typedef enum {
 
 - (NSMutableDictionary *)dashboardRegions;
 
+- (void)clear;
+
 @end
 
 // The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
index 70523c1b7f5158037f9879740e9e0138a2c948f7..7dc74deb5a5471c606fa4118668ec5f6c8994f25 100644 (file)
@@ -289,7 +289,7 @@ static bool initializedKJS = FALSE;
     if (pageCache) {
         KWQPageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
         _part->openURLFromPageCache(state);
-        [state invalidate];
+       [state invalidate];
         return;
     }
         
@@ -442,6 +442,11 @@ static bool initializedKJS = FALSE;
     return _part->canCachePage();
 }
 
+- (void)clear
+{
+    _part->clear();
+}
+
 - (void)end
 {
     _part->end();
index 56d27ac0cf6de8c0b5664a04e6e4408a2670397d..1c8dfe35a7baad071d5906ef22478bb0a51f9f39 100644 (file)
@@ -1,3 +1,15 @@
+2004-12-02  Richard Williamson   <rjw@apple.com>
+
+       Fixed <rdar://problem/3841332> REGRESSION (125.9-167u): repro crash in -[KWQPageState invalidate] involving .Mac images
+
+       Ensure that the document is cleared when leaving a non-HTML page.  This ensures that
+       the b/f cache won't incorrectly trash the previous state when restoring.
+
+        Reviewed by John.
+
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame _setState:]):
+
 2004-12-02  Ken Kocienda  <kocienda@apple.com>
 
         Reviewed by Richard
index 52a1e476ffe44182073e292b36400e861afe7a3f..19f9794e4bffac4d361a82b0e5f0cc7978ded03b 100644 (file)
@@ -940,23 +940,28 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
             && loadType != WebFrameLoadTypeReloadAllowingStaleData
             && loadType != WebFrameLoadTypeSame
             && ![[self dataSource] isLoading]
-            && ![[self dataSource] _isStopping]
-            && [[[self dataSource] representation] isKindOfClass: [WebHTMLRepresentation class]])
+            && ![[self dataSource] _isStopping])
         {
-            if (![item pageCache]){
-
-                // Add the items to this page's cache.
-                if ([self _createPageCacheForItem:item]) {
-                    LOG(PageCache, "Saving page to back/forward cache, %@\n", [[self dataSource] _URL]);
-
-                    // See if any page caches need to be purged after the addition of this
-                    // new page cache.
-                    [self _purgePageCache];
-                }
-                else {
-                    LOG(PageCache, "NOT saving page to back/forward cache, unable to create items, %@\n", [[self dataSource] _URL]);
-                }
-            }
+           if ([[[self dataSource] representation] isKindOfClass: [WebHTMLRepresentation class]]) {
+               if (![item pageCache]){
+
+                   // Add the items to this page's cache.
+                   if ([self _createPageCacheForItem:item]) {
+                       LOG(PageCache, "Saving page to back/forward cache, %@\n", [[self dataSource] _URL]);
+
+                       // See if any page caches need to be purged after the addition of this
+                       // new page cache.
+                       [self _purgePageCache];
+                   }
+                   else {
+                       LOG(PageCache, "NOT saving page to back/forward cache, unable to create items, %@\n", [[self dataSource] _URL]);
+                   }
+               }
+           }
+           else {
+               // Put the document into a null state, so it can be restored correctly.
+               [_private->bridge clear];
+           }
         }
         else {
             LOG(PageCache, "NOT saving page to back/forward cache, %@\n", [[self dataSource] _URL]);