If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Function openWindowWithPost no work in ver. 31.0

RESOLVED WORKSFORME

Status

()

Firefox
Untriaged
RESOLVED WORKSFORME
3 years ago
2 years ago

People

(Reporter: Carlos, Unassigned)

Tracking

31 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(3 attachments)

4.82 KB, text/html
Details
312.06 KB, application/zip
Details
209 bytes, application/x-php
Details
(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0 (Beta/Release)
Build ID: 20140716183446

Steps to reproduce:


Shipping a code example of how the JavaScript function that is giving us problems with the latest version of the Firefox browser (Mozilla Firefox 31.0)

It is a function that we use to open from a Flash movie and an overlay window maximized flash movie or another PHP file sending POST parameters.

This function (openWindowWithPost) is integrated in the code file that opens the Flash movie.

http://www.itenm.net/owp/index.html

<!-- saved from url=(0014)about:internet -->
<html lang="en">

<!-- 
Smart developers always View Source. 

This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR. 

Learn more about Flex at http://flex.org 
// -->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!--  BEGIN Browser History required section -->
<link rel="stylesheet" type="text/css" href="history/history.css" />
<!--  END Browser History required section -->

<title></title>
<script src="AC_OETags.js" language="javascript"></script>

<!--  BEGIN Browser History required section -->
<script src="history/history.js" language="javascript"></script>
<!--  END Browser History required section -->

<style>
body { margin: 0px; overflow:hidden }
</style>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 124;


function openWindowWithPost(url,name,key,val,features)
{
var newWindow = window.open(url,name,features); 
if (!newWindow) return 0;
var html = "";
var keys=key.split(" ");
var values=val.split(" ");
html += "<html><head></head><body><form id='formid' method='post' action='" + url + "'>";
if (keys && values && (keys.length == values.length))
for (var i=0; i < keys.length; i++)
html += "<input type='hidden' name='" + keys[i] + "' value='" + values[i] + "'/>";
html += "</form><script type='text/javascript'>document.getElementById(\"formid\").submit()</script></body></html>";
newWindow.document.write(html);
return 1;
}


// -----------------------------------------------------------------------------
// -->
</script>
</head>

<body scroll="no">
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

if ( hasProductInstall && !hasRequestedVersion ) {
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

	AC_FL_RunContent(
		"src", "playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "100%",
		"height", "100%",
		"align", "middle",
		"id", "OpenWithPost",
		"quality", "high",
		"bgcolor", "#869ca7",
		"name", "OpenWithPost",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
			"src", "OpenWithPost",
			"width", "100%",
			"height", "100%",
			"align", "middle",
			"id", "OpenWithPost",
			"quality", "high",
			"bgcolor", "#869ca7",
			"name", "OpenWithPost",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here. '
  	+ 'This content requires the Adobe Flash Player. '
   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
// -->
</script>
<noscript>
  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="OpenWithPost" width="100%" height="100%"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
			<param name="movie" value="OpenWithPost.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#869ca7" />
			<param name="allowScriptAccess" value="sameDomain" />
			<embed src="OpenWithPost.swf" quality="high" bgcolor="#869ca7"
				width="100%" height="100%" name="OpenWithPost" align="middle"
				play="true"
				loop="false"
				quality="high"
				allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
	</object>
</noscript>
</body>
</html>

The function is called within the ActionScript code in the Flash movie example we have created, and open a file Destino.php overlay by sending POST data filled in the form.

The ActionScript code is OpenWithPost.swf file:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
	<![CDATA[
	
	[Bindable]
		private var Navegador:String="IE"; 
	
	private function getBrowserName():String
	{
            var browser:String;
            var browserAgent:String = ExternalInterface.call("function getBrowser(){return navigator.userAgent;}");
           
           if(browserAgent != null && browserAgent.indexOf("Firefox") >= 0) {
                browser = "Firefox";
            } 
            else if(browserAgent != null && browserAgent.indexOf("Safari") >= 0){
                browser = "Safari";
            }             
            else if(browserAgent != null && browserAgent.indexOf("MSIE") >= 0){
                browser = "IE";
            }         
            else if(browserAgent != null && browserAgent.indexOf("Opera") >= 0){
                browser = "Opera";
            }
            else {
                browser = "Undefined";
            }
            return (browser);
    }	
    
    private function openWindow2(my_earl:String, window:String ,key:String,val:String ) : void 
	{ 
		var features:String = ""
		var WINDOW_OPEN_FUNCTION:String = "openWindowWithPost"; 
  		if(getBrowserName() == "IE")
  		{
  			features="fullscreen=yes,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,top=0,left=0'";
   		}
   		else
   		{
        	var ScreenWidth:int= ExternalInterface.call("function getScreenWidth(){return screen.width;}");
        	var ScreenHeight:int= ExternalInterface.call("function getScreenHeight(){return screen.height;}");
        	features = "width=" + String(ScreenWidth-5) + ",height=" + String(ScreenHeight-30) + ",top=0,left=0,menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no";
  		}
		if (ExternalInterface.available) 
 		{
			var respuesta:int= int(ExternalInterface.call(WINDOW_OPEN_FUNCTION, my_earl,"Visor",key,val, features)); 
		} 
	}
	
	private function IraDestino():void
	{
		
		var direccion:String="";
		var key:String ="";
		var val:String="";
		
		direccion="http://www.itenm.net/Destino.php";
 		key+="DATO1 DATO2";
		val+= txtDATO1.text+" ";
		val+= txtDATO2.text;
		
 		openWindow2(direccion,"_blank",key,val);
	}
	   
	]]>
</mx:Script>
	<mx:Label x="50" y="72" text="DATO1" width="50" fontWeight="bold"/>
	<mx:TextInput x="108" y="70" text="valor1" id="txtDATO1" restrict="A-Za-z0-9" />
	<mx:Label x="50" y="100" text="DATO2" width="50" fontWeight="bold"/>
	<mx:TextInput x="108" y="98" text="valor2" id="txtDATO2" restrict="A-Za-z0-9"/>
	<mx:Button x="50" y="128" label="Enviar datos a nueva ventana" width="218" click="IraDestino()"/>
	<mx:Text x="50" y="24" text="Prueba funcionamiento window.open con POST" width="218" height="38" textAlign="center"/>
	
</mx:Application>



The PHP file created in the example only shows the data received as POST parameters

http://www.itenm.net/Destino.php

<html>
<head>
<title>Destino</title>
</head>
<body>
   	DATO1=<?php echo $_REQUEST["DATO1"]; ?><br />
	DATO2=<?php echo $_REQUEST["DATO2"]; ?><br />
    <?php var_dump($_REQUEST); ?>
</body>
</html>


Actual results:

Your results in any browser other than the latest version of Mozilla is:

DATO1=valor1
DATO2=valor2
array(2) { ["DATO1"]=> string(6) "valor1" ["DATO2"]=> string(6) "valor2" } 


Expected results:

and the latest version of Mozilla:

DATO1=
DATO2=
array(0) { }
(Reporter)

Updated

3 years ago

Comment 1

3 years ago
Could you attach a minimal testcase?
(Reporter)

Comment 2

3 years ago
Created attachment 8466904 [details]
index.html
(Reporter)

Comment 3

3 years ago
Created attachment 8466905 [details]
OpenWithPost.zip
(Reporter)

Comment 4

3 years ago
Created attachment 8466906 [details]
Destino.php
Hi Carlos, 

I have tested the mentioned issues using your test case on latest Firefox release (43.0.4) and latest Nightly (46.0a1) and I could not reproduce it. The results received after pressing the page button were:
DATO1=valor1
DATO2=valor2
array(2) { ["DATO1"]=> string(6) "valor1" ["DATO2"]=> string(6) "valor2" } 

Firefox 43.0.4, Build ID: 20160105164030, User Agent:  Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0

Firefox: 46.0a1, Build ID: 20160106030225, User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0

Can you please test this on the latest Firefox release (43.0.4) or latest Nightly (46.0a1, https://nightly.mozilla.org/) and tell me if this still reproduces for you ? When doing this please use a new fresh Firefox profile, maybe also in safe mode (https://support.mozilla.org/en-US/kb/troubleshoot-and-diagnose-firefox-problems). 

Thanks,
Cosmin.
Flags: needinfo?(carlos)
Considering the fact that the reporter did not provided more information on my request, I will mark this issue as resolved - worksforme. 
If you can still reproduce this, feel free to reopen it and provide the requested information.

Thanks,
Cosmin.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Flags: needinfo?(carlos)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.