Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346064 - Showing a JFace Dialog including a Browser under Internet Explorer 7 causes a Javascript error
Summary: Showing a JFace Dialog including a Browser under Internet Explorer 7 causes a...
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.4   Edit
Hardware: PC Windows XP
: P2 critical (vote)
Target Milestone: 1.4 RC2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-17 05:57 EDT by Serge Démoulin CLA
Modified: 2011-05-18 05:56 EDT (History)
0 users

See Also:


Attachments
Proposed patch (727 bytes, patch)
2011-05-17 07:33 EDT, Ivan Furnadjiev CLA
tbuschto: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Serge Démoulin CLA 2011-05-17 05:57:28 EDT
Build Identifier: 1.4.0.20110504-1831

RAP Version : 1.4M7
the error message under IE7 is :
Javascript error occurred: Could not find iframe which was loaded [B]!





Reproducible: Always

Steps to Reproduce:
1. make a new plugin based on the example RAP application with View
2. replace the ViewPart with the given code (siehe under)
3. start the application
4. click on the button


ViewPart class

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.part.ViewPart;

public class View extends ViewPart {
	public static class BrowserDialog extends Dialog {
	
		public BrowserDialog(Shell parentShell) {
			super(parentShell);
		}
		@Override
		protected Control createDialogArea(Composite parent) {
			Browser browser = new Browser(parent, SWT.BORDER);
			browser.setLayoutData(new GridData(GridData.FILL_BOTH));
			return browser;
		}
		
	}
	public static final String ID = "TestRAP14_dialog.view";

	/**
	 * This is a callback that will allow us to create the viewer and initialize it.
	 */
	public void createPartControl(Composite parent) {
		Button button = new Button(parent, SWT.PUSH);
		button.setText("show dialog");

		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				super.widgetSelected(e);
				BrowserDialog rtd = new BrowserDialog(Display.getCurrent().getActiveShell());
				rtd.open();
				
				/*
				 * Absturz unter IE7 nach dem Click auf der "OK" Schaltfläche.
				 * Javascript error occurred: Could not find iframe which was loaded [B]!
				 */
			}
		});

	}

	@Override
	public void setFocus() {
	}

}
Comment 1 Ivan Furnadjiev CLA 2011-05-17 06:08:08 EDT
Serge, I think that this bug is a duplicate of bug 345082, which has been fixed in CVS HEAD and in the upcoming RC1. Could you confirm this?
Comment 2 Ivan Furnadjiev CLA 2011-05-17 06:22:33 EDT
OK... I can reproduce it with current CVS HEAD and IE9.
Comment 3 Ivan Furnadjiev CLA 2011-05-17 07:33:11 EDT
Created attachment 195837 [details]
Proposed patch

In some cases ( can't really detect what/when/why IE does that ) IE fires onload DOM event on iframe, which has already been removed from the DOM (with parentNode null). The fix is not to throw an error in this case.
Comment 4 Tim Buschtoens CLA 2011-05-18 04:31:02 EDT
Comment on attachment 195837 [details]
Proposed patch

Patch is good.
Comment 5 Ivan Furnadjiev CLA 2011-05-18 04:36:14 EDT
Applied patch to CVS HEAD and v14_Maintenance.
Comment 6 Serge Démoulin CLA 2011-05-18 05:56:14 EDT
(In reply to comment #1)
> Serge, I think that this bug is a duplicate of bug 345082, which has been fixed
> in CVS HEAD and in the upcoming RC1. Could you confirm this?

Yes I confirm. I'd check-out the nightly build 20110516 and now it works perfectly under IE7 and IE8. Thanks.