Open Bug 435136 Opened 16 years ago Updated 2 years ago

Javascript alert while in Print Preview causes strange undesired UI behavior

Categories

(Core :: Print Preview, defect)

defect

Tracking

()

People

(Reporter: ppicazo, Unassigned)

References

()

Details

Attachments

(4 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

Javascript alerts triggered from out of focus tabs while in Print Preview for the active tab cause alert to be displayed and Print Preview UI to become unresponsive, while displaying tabs again.

Reproducible: Always

Steps to Reproduce:
1. Open a page which will popup a javascript alert in the near future (example, with setTimeout("alert('test')",5000); in it's javascript.
2. Open a new tab and go use print preview
3. Wait for alert to trigger
Actual Results:  
Print Preview UI looks like it is permanently stuck open until window is closed (with loss of information on all tabs highly probably). It seems like the alert is triggered and displayed. Tabs are now visible again, tab which was in Print Preview is stuck in "Preview", but the rest of the tabs remain responsive. New tabs can be created with keyboard shortcuts, bookmarks / history sidebars, etc. The usual address bar, menus and buttons are not restored. Clicking close on the Print Preview UI has no result.

Expected Results:  
When the alert triggers and its tab is the one in the print preview, the alert is not displayed until after the Print Preview is closed. It seems like this behavior should be consistent even if the tab which triggered the alert is not in focus.

Tested on 32 and 64 bit versions of Microsoft Vista, both with the same build of Firefox, same behavior on both computers.
Same behavior on Firefox 3.0rc1
I'm seeing the same on the latest trunk, XPSP3.
->Core>print preview
Status: UNCONFIRMED → NEW
Component: General → Print Preview
Ever confirmed: true
OS: Windows Vista → Windows XP
Product: Firefox → Core
QA Contact: general → printing
Version: unspecified → Trunk
Attached file testcase
note that the print preview will switch to the contents of the testcase, and will print that.
Ran test case on Firefox 2.0.0.12 running on Mac OS X Leopard. It does not appear to be affected by the bug as the print preview is handled outside of Firefox. This bug is most likely confined to Firefox running on Windows (all versions).
Just observed exactly same behaviour on 3.0.3
Also present in FF3.5. Once print preview opens, it cannot be closed by pressing the `Close` button. Closing the window forcefully closes FF itself resulting in data loss.
There' some more weird behavior I came across in FF3.5 while testing using the above testcase. Once you're in the print preview window, and the alert shows, the print preview contents change to the page that sent the alert. Now, if you press `Landscape' and then press `Close`, the print preview pane closes (previously, it didn't - see last comment). BUT, the page I was initially previewing appears as a preview inside the browser tab (see screenshot). Keyboard shortcuts do not work. And if I search for a bug in the top-right corner and press Enter, I get an error that says 'The document cannot change while Printing or in Print Preview mode' (see second screenshot). In fact, if I try to do anything (like click on a link in the bookmarks toolbar) or type a URL in the location bar and press Enter, I get the same error. This behavior is just limited to this tab only and all other tabs work fine. This is totally reproducible in FF3.5. Closing the tab fixes the problem.

Btw, I'm running an Intel Dual Core 1.83Ghz, 2.5GB RAM. Just upgraded to FF3.5.
Confirmed this bug on Ubuntu Linux using a mozilla-central nightly.  Platform --> ALL.  (Though comment #4 is correct -- Mac wouldn't be affected, since Firefox on Mac uses an external application to show print-preview.)

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a1pre) Gecko/20090630 Minefield/3.6a1pre
OS: Windows XP → All
Hardware: x86 → All
http://firefox-bugzilla.tipjar.com/Demonstration-493143.htm is a demonstration page for this bug.
Once bug 487667 is done, we could for example open print preview in a new window.
Depends on: 487667
@Olli: can't just handle the exception shown in this screenshot?
http://firefox-bugzilla.tipjar.com/error-console-493143.gif
this is a simple option to at least get rid of the non-working-browser -situation.

Other options are to open print preview in a new window, or make print preview UI
somehow per tab. But these options need more changes.
Attachment #418195 - Flags: review?
Attachment #418195 - Flags: review? → review?(gavin.sharp)
Comment on attachment 418195 [details] [diff] [review]
exit preview before bringing background tab to front

Hmm, what do you think about putting this in tabbrowser's selectedTab setter instead?
Attachment #418195 - Flags: review?(gavin.sharp) → review+
Uh, the patch doesn't work anymore. Something else has changed.
Er, I'm running make in a wrong way. (Never remember what to make when handling FF changes :) )
(In reply to comment #16)
> (From update of attachment 418195 [details] [diff] [review])
> Hmm, what do you think about putting this in tabbrowser's selectedTab setter
> instead?
That doesn't work so easily, since exiting print preview sets selectedTab.
But sure, that would be better in general.
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: