Closed Bug 273851 Opened 20 years ago Closed 15 years ago

popup blocking doesn't trap onfocus event

Categories

(Core :: DOM: Events, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: iizogii, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a6) Gecko/20041208 Spica/1.0+
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a6) Gecko/20041208 Spica/1.0+

When putting a window.open() into the onfocus event of the BODY element, Firefox
doesn't seem to successfully prevent windows from opening.  Any popup windows
are trapped when the page loads, but subsequent focus events appear to pop up
windows.  For instance, switching to another tab and then switching back will
cause the onfocus event to fire, and windows will pop up.

Even if it's argued that the popup blocker should only work during a page load,
there still seems to be something wrong.  The inline note at the top of the
screen is adding to the count of the windows that it *thinks* it blocked (eg.
"Firefox prevented this site from opening 42 popup windows.  Click here for
options..."), but the windows are still popping up.

I've reproduced this problem using Mozilla/5.0 (X11; U; NetBSD i386; en-US;
rv:1.7.5) Gecko/20041116 Firefox/1.0, and also Mozilla/5.0 (X11; U; Linux i686;
en-US; rv:1.8a6) Gecko/20041208 Spica/1.0+ (last night's nightly build).

Reproducible: Always
Steps to Reproduce:
1. Open the Preferences dialog and ensure that popup blocking is enabled.
2. Visit a site that has a window.open() attached to the onload event of the
BODY element, such as my example at
http://www.mcs.vuw.ac.nz/~jester/temp/test-popup/
3. Create a new tab (eg. Ctrl-T) and switch to it.
4. Switch back to the original tab, to trigger the onfocus event.

Actual Results:  
Two popup windows are triggered, although Firefox reports that two (more)
windows have been blocked in the inline page notification, as mentioned above. 
(I presume there are two because the onfocus event is being triggered twice for
some reason.)

Expected Results:  
Firefox should have reported that the windows were blocked (unless preferences
were set otherwise), and the popups should not have appeared.

I think this is quite an important bug.  Websites could potentially throw a
barrage of unexpected popup windows at a user who has simply switched tabs and
switched back again, or triggered the onfocus event in some other way.

I haven't tested it for the onfocus event on elements besides the BODY element.
Oops -- I've just noticed that step 2 of the reproducing instructions stated
that the window.open() code should be attached to the onload event.  It should,
of course, have referred to the onfocus event.
Confirming with Mozilla 1.8a6 current build on WinNT4, I always get 2 popups and
1-4 blocked popups.
Assignee: firefox → events
Component: General → DOM: Events
OS: Linux → All
Product: Firefox → Core
QA Contact: firefox.general → ian
Version: unspecified → Trunk
Assignee: events → nobody
Status: UNCONFIRMED → NEW
Component: DOM: Events → XP Apps: GUI Features
Ever confirmed: true
Product: Core → Mozilla Application Suite
...despite my request. PS y'all are noticing multiple popups instead of just
one because of bug 164686.
Blocks: popups
Component: XP Apps: GUI Features → UI Design
MASS-CHANGE:
This bug report is registered in the SeaMonkey product, but has been without a comment since the inception of the SeaMonkey project. This means that it was logged against the old Mozilla suite and we cannot determine that it's still valid for the current SeaMonkey suite. Because of this, we are setting it to an UNCONFIRMED state.

If you can confirm that this report still applies to current SeaMonkey 2.x nightly builds, please set it back to the NEW state along with a comment on how you reproduced it on what Build ID, or if it's an enhancement request, why it's still worth implementing and in what way.
If you can confirm that the report doesn't apply to current SeaMonkey 2.x nightly builds, please set it to the appropriate RESOLVED state (WORKSFORME, INVALID, WONTFIX, or similar).
If no action happens within the next few months, we move this bug report to an EXPIRED state.

Query tag for this change: mass-UNCONFIRM-20090614
Status: NEW → UNCONFIRMED
Status: UNCONFIRMED → NEW
Ever confirmed: true
For what it's worth, I think this may be able to be closed pending further confirmation.

I can no longer reproduce it from the local test case within my current Firefox (actually Iceweasel).  When switching between tabs, Firefox now reports that it's blocked additional popup windows as I'd expect it to.  The full version string is:

Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091123 Iceweasel/3.5.6 (like Firefox/3.5.6; Debian-3.5.6-1)
Yes, I don't think that reviving a six years old bug report makes much sense unless somebody can reproduce it in the current Firefox version. I'll move it to the correct component and resolve as WORKSFORME.
Status: NEW → RESOLVED
Closed: 15 years ago
Component: UI Design → DOM: Events
Product: SeaMonkey → Core
QA Contact: ian → events
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: