Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 384468

Summary: [p2] The site generated by the "Update Site Project" doesn't work in Chrome/Chromium
Product: [Eclipse Project] PDE Reporter: Matias Emanuel Serrano <matutetandil>
Component: UIAssignee: PDE-UI-Inbox <pde-ui-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, curtis.windatt.public, matutetandil, Shalini.Gupta
Version: 4.2Keywords: helpwanted
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug

Description Matias Emanuel Serrano CLA 2012-07-06 08:53:05 EDT
Build Identifier: I20120608-1400

When a new Update Site Project is created with the "Generate a web page listing all the available features within the site" option enabled. It generates an index.html file, that doesn't work in Chrome/Chromium.

Reproducible: Always

Steps to Reproduce:
1. Create a new Update Site Project with the "Generate a web page listing all the available features within the site" option enabled.
2. Open the generated Index.html in Chrome/Chromium.
3. An alert is been displaying with the message: "Document could not be loaded by browser." This is because the Document hasn't got the load() function.
4. Open the same file in onother browser (Firefox, Safari, IE). It works OK!
Comment 1 Matias Emanuel Serrano CLA 2012-07-06 09:02:01 EDT
I find a solution for that. I copy paste my new index.html, with the fix I found. I Commented the fix
<html>
<head>
<title>Oromix Development Environment</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>@import url("web/site.css");</style>
<script type="text/javascript">
	var returnval = 0;
	var stylesheet, xmlFile, cache, doc;
	function init(){
		// NSCP 7.1+ / Mozilla 1.4.1+ / Safari
		// Use the standard DOM Level 2 technique, if it is supported
		if (document.implementation && document.implementation.createDocument) {
			xmlFile = document.implementation.createDocument("", "", null);
			stylesheet = document.implementation.createDocument("", "", null);
			if (xmlFile.load){
				xmlFile.load("site.xml");
				stylesheet.load("web/site.xsl");
				
				xmlFile.addEventListener("load", transform, false);
				stylesheet.addEventListener("load", transform, false);
				
			} else { /////////////////////// THIS IS THE FIX ///////////////////////
				//alert("Document could not be loaded by browser.");
				// Chrome
				var xmlhttp = new window.XMLHttpRequest();
				xmlhttp.open("GET","site.xml",false);
				xmlhttp.send(null);
				xmlFile = xmlhttp.responseXML.documentElement;
				
				xmlhttp.open("GET","web/site.xsl",false);
				xmlhttp.send(null);
				stylesheet = xmlhttp.responseXML.documentElement;
				
                                // I HAVE TO CALL TWICE THIS FUNCTION, BECAUSE IT HAS A COUNTER THAT MUST BE 2 (THIS MAY BE FIXED TOO)
				transform();
				transform();
			} /////////////////////////// END OF THE FIX ///////////////////////////
			
		}
		//IE 6.0+ solution
		else if (window.ActiveXObject) {
			xmlFile = new ActiveXObject("msxml2.DOMDocument.3.0");
			xmlFile.async = false;
			xmlFile.load("site.xml");
			stylesheet = new ActiveXObject("msxml2.FreeThreadedDOMDocument.3.0");
			stylesheet.async = false;
			stylesheet.load("web/site.xsl");
			cache = new ActiveXObject("msxml2.XSLTemplate.3.0");
			cache.stylesheet = stylesheet;
			transformData();
		}
	}
	// separate transformation function for IE 6.0+
	function transformData(){
		var processor = cache.createProcessor();
		processor.input = xmlFile;
		processor.transform();
		data.innerHTML = processor.output;
	}
	// separate transformation function for NSCP 7.1+ and Mozilla 1.4.1+ 
	function transform(){
		returnval+=1;
		if (returnval==2){
			var processor = new XSLTProcessor();
			processor.importStylesheet(stylesheet); 
			doc = processor.transformToDocument(xmlFile);
			document.getElementById("data").innerHTML = doc.documentElement.innerHTML;
		}
	}
</script>
</head>
<body onload="init();">
<!--[insert static HTML here]-->
<div id="data"><!-- this is where the transformed data goes --></div>
</body>
</html>

var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET","site.xml",false);
xmlhttp.send(null);
xmlFile = xmlhttp.responseXML.documentElement;
				
xmlhttp.open("GET","web/site.xsl",false);
xmlhttp.send(null);
stylesheet = xmlhttp.responseXML.documentElement;
				
transform();
transform();

To the else branch of the
Comment 2 Andrew Niefer CLA 2012-07-09 10:42:46 EDT
I believe the html page is generated by pde/ui.  This is old update-site stuff which should probably be updated for p2.
Comment 3 Curtis Windatt CLA 2012-07-09 12:52:40 EDT
Perhaps the html creation should be turned off entirely as update is no longer included.

Obviously a p2 implementation would be neat, but there isn't enough committer time for it.
Comment 4 Curtis Windatt CLA 2013-01-11 12:09:25 EST
Everything I read about xslt in Chrome is that the browser has a security policy prevent loading files from within other pages.  See the following:

http://stackoverflow.com/questions/2981524/how-can-i-make-xslt-work-in-chrome

However, the page fails to load off of eclipse.org.  I also tried an example from a web site, but it does not work either:

http://www.w3schools.com/xsl/xsl_client.asp

I also tried the code from comment #1, but that didn't fix the issue locally or on the server.

This is not old update manager code, so there isn't a need to remove it.  However, I can't put any more time into trying to get this to work for 4.3.
Comment 5 Shalini CLA 2014-01-22 01:10:32 EST
We are using Eclipse Version: 4.2.1 , In this we are facing same problem.
site generated by Update site project works properly in Firefox but does not work in any other browser i.e chrome,IE,safari.

Please do needful.
Comment 6 Eclipse Genie CLA 2019-03-20 14:49:49 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Lars Vogel CLA 2019-10-08 10:50:05 EDT
This bug was marked as stalebug a while ago. Marking as wontfix.

If this report is still relevant for the current release, please
reopen and remove the stalebug whiteboard tag.