Closed Bug 267208 Opened 20 years ago Closed 20 years ago

menuitem oncommand=window.open should not be blocked by popup blocker

Categories

(Core :: XUL, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 247965

People

(Reporter: mozilla, Unassigned)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

If a <menuitem> has an oncommand handler that invokes window.open(), the window
gets blocked by the Mozilla popup-blocker. This should not happen: choosing a
menuitem is a user-initiated action just like clicking a link, so the
window.open() call should be considered a REQUESTED popup, not an unrequested
one. Therefore the window.open call should be treated just like e.g., the
onclick event of an HREF, which is NOT blocked by the popup blocker.

Code sample:

<menubar>
 <menu id="HelpMenu" label="Help">
  <menupopup>
   <menuitem label="Help on the Web..." oncommand="Help();"/>
  </menupopup>
 </menu>
</menubar>

function Help() {
    window.open("http://www.mozilla.org/");
}


This used to work (not blocked) in earlier versions of Mozilla 1.x.

Note: Putting "localhost" in the popup exception list does not stop the problem.



Reproducible: Always
Steps to Reproduce:
1. Create a XUL file containing the above code.
2. Choose the Help menu item
3. The popup window gets blocked. (Make sure the popup blocker is on.)

Actual Results:  
Popup was blocked.

Expected Results:  
Popup window should appear.
Mozilla 1.7.3

*** This bug has been marked as a duplicate of 247965 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Component: XP Toolkit/Widgets: Menus → XUL
QA Contact: xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.