JavaScript command window.print (); does not work anymore
Categories
(Core :: Privacy: Anti-Tracking, defect, P3)
Tracking
()
People
(Reporter: rd, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
|
9.37 KB,
text/plain
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0
Steps to reproduce:
We use window.print(); inside a javascript
Actual results:
The printer dialog box appears and then Firefox (86 or 85) hang.
It worked fine with previous Firefox version (Its OK with Seamonkey 2.53.6)
Expected results:
If we use the debbuger, when we inspect our button which launch the script, the authentication dialog appears and we can print without problem.
Why the authentication dialog appears because we have done authentication with index.html pagepreviously?
We have no problem with last version of Chrome or Egde...
Comment 1•5 years ago
|
||
BP, could you please be more specific on the steps to reproduce? Is there a web page or a test case that could help us understand this issue better?
Please also see Bug 1668322.
Comment 2•5 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Printing: Setup' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 3•5 years ago
|
||
Do you have a URL or page where it doesn't work? I'd be more than happy to take a look. Thanks!
Hi Emilio,
Sorry but it is an embedded web server inside our medical device.
The problem appears with new Firefox version 85.0.x.
With Firefox developper edition version 86.0.x we have the same problem.
Now with latest Developper Edition 86.0b9 (64 bits), if I debug step by step, when I execute the line window.print(); Firefox seems to hang but if i do a menu click, i hear the alert sound like if it is forbidden to click at this moment.
Maybe the authentication dialog window is opened but it is not displayed !
The only way to quit Firefox is to kill the task with the task manager.
Thanks for your help
BP
PS: Sorry for my poor english !
Hi Simona,
Here is (below) the javascript code :
imprimer_page(etape) means in english print_page(step)
function imprimer_page(etape)
{
var tempo=100;
switch(etape)
{
case 1 :
if(document.getElementById("entête clinique").innerHTML=="Entête Clinique : Activée")
{
document.getElementById("entete").className="entete";
document.getElementById("enteteTable").className="enteteTable";
//modif 2.00.00 du 06/07/2017 : gestion mise en page 3 pop 5 pop titre 1 ligne 2 lignes
if(POPULATION=="3" || POPULATION=="34")
{
if(document.getElementById("NomClinique").innerHTML.length>30)
{
document.getElementById("descripteur").style.marginTop = "50px";
}
else
{
document.getElementById("descripteur").style.marginTop = "30px";
}
}
if(POPULATION=="5" || POPULATION=="54")
{
if(document.getElementById("NomClinique").innerHTML.length>30)
{
document.getElementById("descripteur").style.marginTop = "15px";
}
else
{
document.getElementById("descripteur").style.marginTop = "0px";
}
}
}
else
{
document.getElementById("enteteTable").className="hidden";
}
setTimeout(function(){imprimer_page(2)}, 100);
break;
case 2 :
if(document.getElementById("Pied clinique").innerHTML=="Pied Clinique : Activé")
{
document.getElementById("PiedDePage").className="Pied";
document.getElementById("PiedDePageTable").className="PiedTable";
//modif 2.00.00 du 06/07/2017 : gestion mise en page 3 pop 5 pop titre 1 ligne 2 lignes
if(POPULATION=="3" || POPULATION=="34")
{
if(document.getElementById("NomClinique").innerHTML.length>30)
{
document.getElementById("PiedDePage").style.marginTop = "35px";
}
else
{
document.getElementById("PiedDePage").style.marginTop = "60px";
}
}
if(POPULATION=="5" || POPULATION=="54")
{
if(document.getElementById("NomClinique").innerHTML.length>30)
{
document.getElementById("PiedDePage").style.marginTop = "5px";
}
else
{
document.getElementById("PiedDePage").style.marginTop = "10px";
}
}
}
else{document.getElementById("PiedDePage").className="hidden";}
setTimeout(function(){imprimer_page(3)}, 100);
break;
case 3 :
if(document.getElementById("logo").innerHTML=="Importation : Activé")
{
document.getElementById("entete").className="entete";
document.getElementById("logoEnteteH").className="enteteTable";
//BP20210112-01 Gestion taille impression logo (taille moyenne par défaut !)
if(document.getElementById("SizeLogo").innerHTML=="petite")
{
document.getElementById("logo_clinique").className="tailleImageS"; ////BP20210108-01
}
else if (document.getElementById("SizeLogo").innerHTML=="grande")
{
document.getElementById("logo_clinique").className="tailleImageL"; ////BP20210108-01
}
//BP20210112-01 Gestion position impression logo (droite par défaut)
if(document.getElementById("PositionLogo").innerHTML=="gauche")
{
document.getElementById("logo_clinique").style.float = "left"; //BP20210107-02
}
//else if (document.getElementById("PositionLogo").innerHTML=="droite")
// {
// document.getElementById("logo_clinique").style.float = "right"; //BP20210107-02
// }
}
else
{
document.getElementById("logoEnteteH").className="hidden";
}
setTimeout(function(){imprimer_page(4)}, tempo);
break;
case 4 :
if(document.getElementById("logo").innerHTML=="Importation : Activé")
{
document.getElementById("entete").className="entete";
document.getElementById("logoEnteteB").className="enteteTable";
}
else
{
document.getElementById("logoEnteteB").className="hidden";
}
setTimeout(function(){imprimer_page(5)}, tempo);
break;
case 5 :
if(document.getElementById("entête clinique").innerHTML=="Entête Clinique : Activée")
{
document.getElementById("enteteB").className="enteteB";
document.getElementById("enteteTableB").className="enteteTable";
//BP20201223-01 Gestion taille impression (grande taille par défaut !)
if(document.getElementById("SizeEntete").innerHTML=="petite")
{
document.getElementById("NomClinique").className="enteteLigne1P";
document.getElementById("Adrclinique").className="enteteLigne2P";
document.getElementById("Code").className="enteteLigne2P";
document.getElementById("NomCliniqueB").className="enteteLigne1P";
document.getElementById("AdrcliniqueB").className="enteteLigne2P";
document.getElementById("CodeB").className="enteteLigne2P";
}
else if(document.getElementById("SizeEntete").innerHTML=="moyenne")
{
document.getElementById("NomClinique").className="enteteLigne1M";
document.getElementById("Adrclinique").className="enteteLigne2M";
document.getElementById("Code").className="enteteLigne2M";
document.getElementById("NomCliniqueB").className="enteteLigne1M";
document.getElementById("AdrcliniqueB").className="enteteLigne2M";
document.getElementById("CodeB").className="enteteLigne2M";
}
//BP20210119-01 Gestion position entete (gauche par défaut !)
if(document.getElementById("PositionEntete").innerHTML=="centre")
{
document.getElementById("NomClinique").style.textAlign = "center"; //BP20210119-01
document.getElementById("Adrclinique").style.textAlign = "center";
document.getElementById("Code").style.textAlign = "center";
document.getElementById("NomCliniqueB").style.textAlign = "center";
document.getElementById("AdrcliniqueB").style.textAlign = "center";
document.getElementById("CodeB").style.textAlign = "center";
}
else if(document.getElementById("PositionEntete").innerHTML=="droite")
{
document.getElementById("NomClinique").style.textAlign = "right"; //BP20210119-01
document.getElementById("Adrclinique").style.textAlign = "right";
document.getElementById("Code").style.textAlign = "right";
document.getElementById("NomCliniqueB").style.textAlign = "right";
document.getElementById("AdrcliniqueB").style.textAlign = "right";
document.getElementById("CodeB").style.textAlign = "right";
}
}
else
{
document.getElementById("enteteTableB").className="hidden";
}
setTimeout(function(){imprimer_page(6)}, tempo);
break;
case 6 :
if(document.getElementById("Pied clinique").innerHTML=="Pied Clinique : Activé")
{
document.getElementById("PiedDePageB").className="PiedB";
document.getElementById("PiedDePageBTable").className="PiedTable";
//BP20201223-01 Gestion taille impression (grande taille par défaut !)
if(document.getElementById("SizePied").innerHTML=="petite")
{
document.getElementById("Ligne1").className="piedLigneP";
document.getElementById("Ligne2").className="piedLigneP";
document.getElementById("Ligne3").className="piedLigneP";
document.getElementById("Ligne1B").className="piedLigneP";
document.getElementById("Ligne2B").className="piedLigneP";
document.getElementById("Ligne3B").className="piedLigneP";
}
else if(document.getElementById("SizePied").innerHTML=="moyenne")
{
document.getElementById("Ligne1").className="piedLigneM";
document.getElementById("Ligne2").className="piedLigneM";
document.getElementById("Ligne3").className="piedLigneM";
document.getElementById("Ligne1B").className="piedLigneM";
document.getElementById("Ligne2B").className="piedLigneM";
document.getElementById("Ligne3B").className="piedLigneM";
}
//BP20210120-01 Gestion position pied (gauche par défaut !)
if(document.getElementById("PositionPied").innerHTML=="centre")
{
document.getElementById("Ligne1").style.textAlign = "center"; //BP20210120-01
document.getElementById("Ligne2").style.textAlign = "center";
document.getElementById("Ligne3").style.textAlign = "center";
document.getElementById("Ligne1B").style.textAlign = "center";
document.getElementById("Ligne2B").style.textAlign = "center";
document.getElementById("Ligne3B").style.textAlign = "center";
}
else if(document.getElementById("PositionPied").innerHTML=="droite")
{
document.getElementById("Ligne1").style.textAlign = "right"; //BP20210120-01
document.getElementById("Ligne2").style.textAlign = "right";
document.getElementById("Ligne3").style.textAlign = "right";
document.getElementById("Ligne1B").style.textAlign = "right";
document.getElementById("Ligne2B").style.textAlign = "right";
document.getElementById("Ligne3B").style.textAlign = "right";
}
}
else{
document.getElementById("PiedDePageB").className="hidden";
}
setTimeout(function(){imprimer_page(7)}, tempo);
break;
case 7 :
window.print();
break;
}
}
Firefox hangs when it executes case 7.
If i click on the firefox menu bar, I hear an alert system sound which means that it is forbidden to access to the menu bar !
Thanks for your help
BP
Comment 7•5 years ago
|
||
Is there any chance of giving me temporarily access to the site so that I can debug it? So far that code looks reasonable.
If not, is there any chance you could run mozregression to figure out what caused this? I'm happy to assist using it if you have any questions, either here or via email.
Hi Emilio,
Thanks for your answer.
I try mozregression but my antivirus has removed the exe file !
I'll try later.
I have done a test with Firefox on macOS Big Sur.
I confirm the problem. When i click our print button, the authentication dialog window appears and i can enter authentication data and print out is OK and works fine.
But the problem on macOS is sometimes i cannot see the authentication dialog and why did we need to authenticate ?
We do authentication the first time we access index.html...
With the new version 86 (or with developper version 87), the printout doesnot work again, BUT NOW i can access to the menu bar and i can quit Firefox properly (rather than to use task manager and kill the task manually).
Thanks for your help
Bertrand
Comment 9•5 years ago
|
||
(In reply to BP from comment #8)
Hi Emilio,
Thanks for your answer.
I try mozregression but my antivirus has removed the exe file !
Yeah, that is a known false positive, see bug 1366570, you need to manually allow it.
With the new version 86 (or with developper version 87), the printout doesnot work again, BUT NOW i can access to the menu bar and i can quit Firefox properly (rather than to use task manager and kill the task manually).
That's something I guess... But I'd still love to know when this regressed. Thanks!
| Reporter | ||
Comment 10•5 years ago
|
||
I add that we have no problem with Safari 14.0.3 on macOS Big Sur...
| Reporter | ||
Comment 11•5 years ago
|
||
Hi Emilio,
I try mozregression and... it works properly with 86.0a1 2021-01-03 to 86.0a1 2021-01-20...
And it works also with 87.0a1 2021-01-26 to 2021-01-31 !!!
How is it possible because when i use 86.0 (release version) it doesnot work ?
When i click on our print button the authentication dialog appears !
I cannot test more today.
I'll continue tests on next monday.
Thanks for your help
regards
Bertrand
| Reporter | ||
Comment 12•5 years ago
|
||
Hi Emilio,
I hope you had a good we !
I've done mozregression and to test the problem i use inspect element.
With Firefox up to version 78 it is OK.
With Firefox version 79.0a1 up to 2020-06-12 it is OK
With Firefox version 79.0a1 2020-06-13 it is BAD ! When i click on inspect element, the authentication dialog window appears !
I've found that Dimi Lee modify storage permission (Fri Jun 12 07:30:35) see bug 1643115
Here is the results of Mozregression :
pushlog_url: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=9388507a8b1f5c1550a7941483333db77478056f&tochange=4e04aefa055870b8cebf7b1d22685515dce9ae8f
Thanks in advance for your help
Best regards
Bertrand PICARD
| Reporter | ||
Comment 13•5 years ago
|
||
Hi Emilio,
Here is the results of Mozregression :
app_name: firefox
build_date: 2020-06-12 09:51:16.236000
build_file: C:\Users\bp.mozilla\mozregression\persist\4e04aefa0558-shippable--autoland--target.zip
build_type: integration
build_url: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/D5FEhWIESLiikT078LtJIA/runs/0/artifacts/public%2Fbuild%2Ftarget.zip
changeset: 4e04aefa055870b8cebf7b1d22685515dce9ae8f
pushlog_url: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=9388507a8b1f5c1550a7941483333db77478056f&tochange=4e04aefa055870b8cebf7b1d22685515dce9ae8f
repo_name: autoland
repo_url: https://hg.mozilla.org/integration/autoland
task_id: D5FEhWIESLiikT078LtJIA
Thanks in advance for your help
Best regards
Bertrand PICARD
Comment 14•5 years ago
|
||
Thank you! Dimi, do you have a hunch about why this might be? Are we not copying the right state to print documents?
Updated•5 years ago
|
Comment 15•5 years ago
|
||
Hi BP, thank you for helping test with mozregression.
I still need some help from you to do a further investigation:
- Bug 1643115 has a regression, which was fixed in Firefox 80 (Bug 1645777), could you help check if it can be reproduced after 80?
I want to make sure the problem you ran into while testing with mozregression is not caused by a problem we have already fixed. - Whether the bug can be reproduced if you set Enhanced Tracking Protection to OFF ("What to do if a site seems broken" section in this link shows how to disable it)
- Is the code calling
window.print();in a iframe? If yes, what is the url of the iframe and the url of the tab?
Thanks!
| Reporter | ||
Comment 16•5 years ago
|
||
Hi Dimi,
- Bug 1643115 has a regression, which was fixed in Firefox 80 (Bug 1645777),
could you help check if it can be reproduced after 80?
I want to make sure the problem you ran into while testing with
mozregression is not caused by a problem we have already fixed.
I've done mozregression and the problem still exists with Firefox 81.0a1.
- Whether the bug can be reproduced if you set Enhanced Tracking Protection to
OFF ("What to do if a site seems broken" section in this
[link](https://support.mozilla.org/en-US/kb/enhanced-tracking-protection-firefo
x-desktop)
shows how to disable it)
The problem still exists if i disable protection
- Is the code calling
window.print();in a iframe? If yes, what is the url
of the iframe and the url of the tab?
No the code is not in a iframe
Updated•5 years ago
|
Comment 17•5 years ago
|
||
Hi Emilio,
Given that this can still be reproduced by disabling ETP and window.print() is not called in a iframe, I feel this bug might not related to Bug 1643115. Could it be caused by other changeset?
Comment 18•5 years ago
|
||
Well, I don't know off-hand, mozregression points to your commit, but maybe the bisection was incorrect?
Reporter, is there any chance I could get access to the site somehow to investigate? Otherwise it seems a bit hard to make progress here.
Comment 19•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #18)
Well, I don't know off-hand, mozregression points to your commit, but maybe the bisection was incorrect?
I mean, from mozregression result in Comment 12, the changeset causing the regression might be any one between
9388507a8b1f5c1550a7941483333db77478056f to 4e04aefa055870b8cebf7b1d22685515dce9ae8f, not only my commit, or do I misunderstand it?
Comment 20•5 years ago
|
||
Well, sure, but of those commits, only yours, 5742bc131451a5af275ebe5bf99ea77e493f1a94 (a GC change), and 4e04aefa055870b8cebf7b1d22685515dce9ae8f (a layout change) could potentially change behavior in a release build.
And I don't think any of the other two commits could cause an authentication dialog to appear where it didn't appear before (meanwhile your patch seemed to do something with permissions etc, which I guess could potentially cause extra HTTP auth dialogs).
Comment 21•5 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)
Well, sure, but of those commits, only yours, 5742bc131451a5af275ebe5bf99ea77e493f1a94 (a GC change), and 4e04aefa055870b8cebf7b1d22685515dce9ae8f (a layout change) could potentially change behavior in a release build.
And I don't think any of the other two commits could cause an authentication dialog to appear where it didn't appear before (meanwhile your patch seemed to do something with permissions etc, which I guess could potentially cause extra HTTP auth dialogs).
I see, thanks for the explanation. The "permission" in the patch refers to permission used internally in anti-tracking to see if a third-party frame has the permission to access cookie, local storage, etc. I won't say it is impossible to cause a regression like this because maybe not be able to access cookies causes the behavior change somehow), but if ETP is off and it is called in a 1st-party, I don't really have any idea how it could related to this issue.
| Reporter | ||
Comment 22•5 years ago
|
||
Hi Emilio, Dimi,
With the new Firefox 86.0.1, the print preview page appears BUT the authentication dialog appears also and if we click the OK button of the autentication dialog, the authentication dialog and preview page are closed and the tab is hanged. Mouse events (left or right click) donot work anymore and we need to close the tab !
| Reporter | ||
Comment 23•5 years ago
|
||
Hi Emilio, Dimi,
With the new Firefox Developer edition 87.0b9, it is the same...
BUT the difference is that if i open a new tab with developer tools open and try again it works ! No more authentication dialog !!!
I need to add a big difference with older Firefox version.
With older version, when we click our print button, the printer setup dialog box appears.
To see the print preview page, we need to choose print from the Firefox menu.
With the new version, print preview appears with our print button but Firefox hangs !
Updated•4 years ago
|
Updated•3 years ago
|
Description
•