Bug 25929

Summary: Changing CACHE MANIFEST file causes ASSERT to fail
Product: WebKit Reporter: Kevin D. Wolf <kevinw>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: ap
Priority: P2 Keywords: InRadar, NeedsReduction
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows Vista   

Description Kevin D. Wolf 2009-05-21 06:53:23 PDT
If you create a very simple CACHE MANIFEST include it within the HTML tag and open that page, it appears everything works fine with the caching events.

Make a change to the manifest, and reload the page, it will cause
ASSERT(!m_resources.contains(url));

Within addResource method of ApplicationCache.cpp will fail.

This does not appear to be a problem in the version of WebKit within Safari on the iPhone, but does appear to be a problem in V4.0 beta of Safari for the desktop.
Comment 1 Mark Rowe (bdash) 2009-05-21 10:42:08 PDT
Can you please attach a simple test case demonstrating the problem?
Comment 2 Mark Rowe (bdash) 2009-05-21 10:42:24 PDT
<rdar://problem/6911398>
Comment 3 Alexey Proskuryakov 2009-05-21 11:37:21 PDT
(In reply to comment #0)
> This does not appear to be a problem in the version of WebKit within Safari on
> the iPhone, but does appear to be a problem in V4.0 beta of Safari for the
> desktop.

Since you are getting an assertion failure, this must be your local debug build of WebKit, not Safari 4 beta. What revision are you seeing this with?

I tried to follow your steps to reproduce, but didn't get any assertion failure with ToT, so more detail would be needed to investigate this issue.
Comment 4 Kevin D. Wolf 2009-05-21 11:47:44 PDT
I grabbed the latest WebKit source yesterday, it appears to be in the Safari Beta 4, I've installed on a machine w/o WebKit Source.

Busy afternoon, but I'll package up my source and do a better write up later this PM
Comment 5 Kevin D. Wolf 2009-05-22 10:56:03 PDT
This seems to be an intermittent problem.  I have two installs of Safari 4 Beta working with no issues.  One install of Safari 4 Beta failing.  My latest WebKit build within Safari 4 is also failing.  Working on my iPod Touch.  If I can get any more details, I will pass them along.

Here is how I can get it to fail.
1) Clear the cache CTRL+ALT+E
2) Download page with the manifest tag
3) Events fire as pages are downloaded
4) Update something in the manifest tag
5) Execute window.applciationCache.update() or re-download the page
5) In Safari 4, I get an INVALID_STATE_ERR: DOM Exception 11
6) When running WebKit w/ VC++ debugger attached the assertion fails
   ApplicationCache.cpp
   addResource method
   ASSERT(!m_resources.contains(url));


Comment 6 Kevin D. Wolf 2009-05-22 11:44:17 PDT
I have two Safari 4.0 Betas installed from the Apple site with WebKit file V5.528.18 installed on each.  One works, one does not.  Is there anyway I can inspect the contents of the off-line cache?
Comment 7 Alexey Proskuryakov 2009-05-22 12:23:27 PDT
You can check the database file using sqlite own command line tool sqlite3 (I don't know how to best install it on Windows), or any other tool that can read sqlite databases.
Comment 8 Kevin D. Wolf 2009-05-22 13:06:40 PDT
I found my apps HTML 5.0 SQLite DB's, but coudn't the onces for offline cache, can you point me in the right direction?
Comment 9 Alexey Proskuryakov 2009-05-22 13:32:13 PDT
Mine is in Documents and Settings\<User>\Local Settings\Application Data\Apple Computer\Safari\ApplicationCache.db.

Note that with debug builds, it may be emptied on each application quit (it is in Mac, not sure about Windows).
Comment 10 Kevin D. Wolf 2009-06-02 14:55:34 PDT
Seems like I was calling applicationCache.update() in my startup routine.  If I don't do this, everything seems to work fine.  I'll close in a week or so if I don't see anymore problems.
Comment 11 Alexey Proskuryakov 2009-06-02 15:30:48 PDT
If an assertion fails, it's a bug that should be fixed in WebKit.
Comment 12 Kevin D. Wolf 2009-06-02 15:36:18 PDT
I think the assertion does a good job of explaining the problem, but I see this when I call applicationCache.update and it attempts to stuff an existing item into m_resources.  Let me know if you have any additional questions.
Comment 13 Alexey Proskuryakov 2009-06-02 15:41:11 PDT
Could you please create and upload a reduced (or any) test case? I'm assuming that comment 5 still has up to date steps to reproduce.