Open Bug 348224 Opened 18 years ago Updated 2 years ago

dynamically created SCRIPT tags loading empty content does not fire the onload event on any refresh (F5, CTRL+R) when over HTTPS

Categories

(Core :: General, defect)

1.8 Branch
x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: dpopa, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

<h3>Caching problem?</h3>
<p>Dynamic created SCRIPT elements will not fire the onload event on refresh on secure connection if the script is empty (no content whatsoever).</p>
<p>The code to reproduce the problem:</p>
<xmp>
function init() {
	alert("onload fired on body!");
	var scriptElement = document.createElement('script');
	scriptElement.readyState = 'loaded';
	scriptElement.onload = function() {
		alert("onload fired on script!");
	}

	scriptElement.type = 'text/javascript';
	scriptElement.src = 'empty.js';
	var headElement = document.getElementsByTagName('head')[0];
	headElement.appendChild(scriptElement); 
}
</xmp>


Below are the contents of the memory cache after the first laod and after a refresh F5:
<pre>
##############################
# CACHE after first request (about cache, memory cache):
##############################
Memory cache device

Number of entries: 	8
Maximum storage size: 	21504 KiB
Storage in use: 	39 KiB
Inactive storage: 	26 KiB

           Key: https://www.pan1.co.uk/favicon.ico
     Data size: 25214 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:53:16
       Expires: 2006-08-10 17:53:15

           Key: https://www.pan1.co.uk/app/ktml4/cache.html
     Data size: 1468 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:53:14
       Expires: 2006-08-10 17:53:14

           Key: https://www.pan1.co.uk/app/ktml4/empty.js
     Data size: 0 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:53:15
       Expires: 2006-08-10 17:53:15

           Key: https://www.pan1.co.uk/favicon.ico
     Data size: 1024 bytes
   Fetch count: 3
 Last modified: 2006-08-10 17:53:16
       Expires: 2006-08-10 17:53:15

           Key: chrome://global/skin/throbber/Throbber-small.gif
     Data size: 6656 bytes
   Fetch count: 2
 Last modified: 2006-08-10 17:52:55
       Expires: No expiration time

           Key: chrome://global/skin/arrow/arrow-dn.gif
     Data size: 60 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:52:57
       Expires: No expiration time

           Key: chrome://browser/skin/Secure.png
     Data size: 1024 bytes
   Fetch count: 2
 Last modified: 2006-08-10 17:53:14
       Expires: No expiration time

           Key: chrome://global/skin/icons/Warning.png
     Data size: 4096 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:53:14
       Expires: No expiration time


##############################
# CACHE AFTER refresh:
##############################

Memory cache device

Number of entries: 	8
Maximum storage size: 	21504 KiB
Storage in use: 	39 KiB
Inactive storage: 	26 KiB

           Key: https://www.pan1.co.uk/favicon.ico
     Data size: 25214 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:53:16
       Expires: 2006-08-10 17:53:15

           Key: https://www.pan1.co.uk/app/ktml4/cache.html
     Data size: 1468 bytes
   Fetch count: 2
 Last modified: 2006-08-10 17:53:55
       Expires: 2006-08-10 17:53:55

           Key: https://www.pan1.co.uk/app/ktml4/empty.js
     Data size: 0 bytes
   Fetch count: 2
 Last modified: 2006-08-10 17:53:56
       Expires: 2006-08-10 17:53:56

           Key: https://www.pan1.co.uk/favicon.ico
     Data size: 1024 bytes
   Fetch count: 7
 Last modified: 2006-08-10 17:53:16
       Expires: 2006-08-10 17:53:15

           Key: chrome://global/skin/throbber/Throbber-small.gif
     Data size: 6656 bytes
   Fetch count: 2
 Last modified: 2006-08-10 17:52:55
       Expires: No expiration time

           Key: chrome://global/skin/arrow/arrow-dn.gif
     Data size: 60 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:52:57
       Expires: No expiration time

           Key: chrome://browser/skin/Secure.png
     Data size: 1024 bytes
   Fetch count: 2
 Last modified: 2006-08-10 17:53:14
       Expires: No expiration time

           Key: chrome://global/skin/icons/Warning.png
     Data size: 4096 bytes
   Fetch count: 1
 Last modified: 2006-08-10 17:53:14
       Expires: No expiration time
</pre>



Reproducible: Always

Steps to Reproduce:
Unzip the attached archive and run over https.



Actual Results:  
Press the F5 key: Should receive 2 alerts, but you get only one instead:
1. onload event fired on body! 

Expected Results:  
Should receive 2 alerts: 
1. onload event fired on body! 
2. onload event fired on script!
Attached file files for the test
Unfortunatelly I cannot upload empty files into the bugzilla, so you'll have to download the files  from here (zipped): https://bugzilla.mozilla.org/attachment.cgi?id=233078
The bug does not reproduce on http, only on https.
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.8 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: