Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 178003 Details for
Bug 324244
[Browser-Safari] windows opened through Javascript ignore size setting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
browser with a page containing a JS window.open with width/height
BrowserJSWindowSize.java (text/x-java), 3.33 KB, created by
Christopher Deckers
on 2010-09-01 16:22:06 EDT
(
hide
)
Description:
browser with a page containing a JS window.open with width/height
Filename:
MIME Type:
Creator:
Christopher Deckers
Created:
2010-09-01 16:22:06 EDT
Size:
3.33 KB
patch
obsolete
>package test; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.SWTError; >import org.eclipse.swt.browser.Browser; >import org.eclipse.swt.browser.CloseWindowListener; >import org.eclipse.swt.browser.OpenWindowListener; >import org.eclipse.swt.browser.VisibilityWindowListener; >import org.eclipse.swt.browser.WindowEvent; >import org.eclipse.swt.graphics.Point; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Shell; > >public class BrowserJSWindowSize { > >private static final boolean isMozilla; > >static { > isMozilla = false; > System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "/Library/Frameworks/XUL.framework/Versions/1.9.2.8"); >} > >protected static final String LS = System.getProperty("line.separator"); > >public static void main(String[] args) { > Display display = new Display(); > Shell shell = new Shell(display); > shell.setText("Main Window"); > shell.setLayout(new FillLayout()); > final Browser browser; > try { > browser = new Browser(shell, isMozilla? SWT.MOZILLA: SWT.NONE); > } catch (SWTError e) { > System.out.println("Could not instantiate Browser: " + e.getMessage()); > display.dispose(); > return; > } > initialize(display, browser); > shell.open(); > browser.setText( > "<html>" + LS + > " <head>" + LS + > " <script type=\"text/javascript\">" + LS + > " function open_win() {" + LS + > " window.open(\"http://www.google.com\",\"_blank\",\"toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400\");" + LS + > " }" + LS + > " </script>" + LS + > " </head>" + LS + > " <body>" + LS + > " <a href=\"http://www.google.com\">http://www.google.com</a>: normal link.<br/>" + LS + > "<form><input type=\"button\" value=\"Open new window of size 400x400\" onclick=\"open_win()\"></form>" + LS + > " </body>" + LS + > "</html>"); > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) { > display.sleep(); > } > } > display.dispose(); > } > >/* register WindowEvent listeners */ >static void initialize(final Display display, Browser browser) { > browser.addOpenWindowListener(new OpenWindowListener() { > public void open(WindowEvent event) { > if (!event.required) { > return; /* only do it if necessary */ > } > Shell shell = new Shell(display); > shell.setText("New Window"); > shell.setLayout(new FillLayout()); > Browser browser = new Browser(shell, isMozilla? SWT.MOZILLA: SWT.NONE); > initialize(display, browser); > event.browser = browser; > } > }); > browser.addVisibilityWindowListener(new VisibilityWindowListener() { > public void hide(WindowEvent event) { > Browser browser = (Browser)event.widget; > Shell shell = browser.getShell(); > shell.setVisible(false); > } > public void show(WindowEvent event) { > Browser browser = (Browser)event.widget; > final Shell shell = browser.getShell(); > if (event.location != null) { > shell.setLocation(event.location); > } > if (event.size != null) { > Point size = event.size; > shell.setSize(shell.computeSize(size.x, size.y)); > } > shell.open(); > } > }); > browser.addCloseWindowListener(new CloseWindowListener() { > public void close(WindowEvent event) { > Browser browser = (Browser)event.widget; > Shell shell = browser.getShell(); > shell.close(); > } > }); >} >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 324244
: 178003