Bug 22568 - Impossible to clear cached javascript without closing and restarting webkit
Summary: Impossible to clear cached javascript without closing and restarting webkit
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-01 03:12 PST by Jaap Lous
Modified: 2009-10-28 08:50 PDT (History)
6 users (show)

See Also:


Attachments
Code to reproduce the bug (2.85 KB, application/zip)
2009-10-28 01:53 PDT, Martin Wittemann
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaap Lous 2008-12-01 03:12:35 PST
I just downloaded and installed the most recent nightly build of webkit. Now it is impossible to clear javascript from the browser cache without restarting. Even resetting webkit won't clear the cache.

This means I can no longer use Webkit for webdevelopment as it's too much of a hassle to close and retstart the browser after every change I make in my javascripts
Comment 1 Mark Rowe (bdash) 2008-12-01 08:25:37 PST
Can you please provide a specific example of something that is no longer working?  We need specific steps to reproduce the problem in order to investigate it.
Comment 2 Gordon Black 2009-01-22 10:45:12 PST
(In reply to comment #1)
> Can you please provide a specific example of something that is no longer
> working?  We need specific steps to reproduce the problem in order to
> investigate it.
> 

Hi Mark,

I use the mac version of the WebKit browser to test all of the code I write for departmental websites and have done for around 1 year now. I've been seeing the same issue for approximately 1 month.

I set up a quick test case to demonstrate the problem. I create a folder with the following layout:

/index.html
/javascript/class/Main.js
/javascript/library/prototype.js

index.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script type="application/javascript" language="JavaScript1.6" src="javascript/library/prototype.js"></script>
	<script type="application/javascript" language="JavaScript1.6" src="javascript/class/Main.js"></script>
	<title>js cache test</title>
</head>
<body onload="new Main();">
</body>
</html>

Main.js:

var Main = Class.create({
	initialize: function () {
		alert("this is main calling");
	}
});

The prototype library is the latest one available from prototypejs.org.

When you load the index.html file in the WebKit browser, the onload statement causes  a Main object to be instantiated. It's initialize function is called and an alert displayed. The problem is visible if you edit the Main.js file to change sting to be displayed by the alert, clear the browser cache and reload the page. When the page loads, the original sting is still displayed in the alert. If you check in the WebKit inspector -> resources section, the original version of Main.js is shown. This was not the behavior of pervious builds of WebKit. In the past, if you cleared the browse cache and reloaded the page the changes to your javascript were picked up.

I have tried both disabling caches in the Develop menu and setting the following meta tag without a positive outcome:

<meta http-equiv="Cache-Control" content="No-Cache">

I am using Mac OS X 10.5.6 on both intel and PPC machines. I could reproduce the problem in the mac WebKit build: WebKit r40102. I have not tried on the windows version.

I hope that this has been of some help.

Gordon
Comment 3 Gordon Black 2009-02-04 06:05:26 PST
Hi all, just a quick update. In WebKit r40535 the situation has been reversed. In this build even if you do not clear the caches manually, webkit picks up any changes to JS code when a page is reloaded.
Comment 4 Alexey Proskuryakov 2009-10-27 21:58:25 PDT
Resolving per the above comment.

I suspect that this happened during development of WebCore memory cache, which did disturb caching behavior quite a bit.
Comment 5 Martin Wittemann 2009-10-28 01:53:47 PDT
Created attachment 42006 [details]
Code to reproduce the bug

The bug is still present in Webkit revision 50124.

Steps to reproduce:
1. Open the Bug.html file
  - Check the log: should print "bug1", "bug2"
2. Change bug2.js
  - set the console message to "bug22"
3. Reload the Bug.html file
  - check the log again: should print "bug1", "bug22"
  - BUT prints: "bug1", "bug2"!

It only happens if the script tags are inserted dynamically.
Comment 6 Martin Wittemann 2009-10-28 01:55:39 PDT
Please reopen (see last comment)
Comment 7 Alexey Proskuryakov 2009-10-28 08:30:08 PDT
OK.

However, please note that this new repro case is for a completely different bug than was discussed before. The original bug had nothing to do with inserting script tags dynamically - in fact, the test case from comment 2 uses plain <script> tags. It would be best to file a new bug for this new problem to avoid confusion.
Comment 8 Martin Wittemann 2009-10-28 08:41:35 PDT
Sure, I opened up a new bug for the issue:
https://bugs.webkit.org/show_bug.cgi?id=30862
Comment 9 Alexey Proskuryakov 2009-10-28 08:50:21 PDT
Thank you!